scifir-units 2.0.0
scifir-units is a library of units of measurement, angles, coordinates, fields, and related data, all lightweight, that help in the development of scientific software and scientific machines
Loading...
Searching...
No Matches
zid.hpp
Go to the documentation of this file.
1#ifndef SCIFIR_UNITS_SPECIAL_UNITS_ZID_HPP_INCLUDED
2#define SCIFIR_UNITS_SPECIAL_UNITS_ZID_HPP_INCLUDED
3
4#include "./aid.hpp"
5
6#include <string>
7#include <vector>
8
9using namespace std;
10
11namespace scifir
12{
13 class zid
14 {
15 public:
17
18 zid();
19 zid(const zid& x);
20 zid(zid&& x);
21 explicit zid(const scifir::aid& new_aid,const zid::type& new_zid_type,const string& new_country);
22 explicit zid(const scifir::aid& new_aid,const string& new_country,const vector<string>& new_regions);
23 explicit zid(const scifir::aid& new_aid,const zid::type& new_zid_type,const string& new_country,const vector<string>& new_regions,const string& new_zone);
24 explicit zid(const scifir::aid& new_aid,const string& init_zid);
25 explicit zid(const string& init_zid_full);
26
27 zid& operator =(const zid& x);
28 zid& operator =(zid&& x);
29 zid& operator =(const string& init_zid_full);
30
31 bool has_no_country() const;
32 bool has_unknown_country() const;
33
34 string display() const;
35 string partial_display() const;
36
39 string country;
40 string zone;
42
43 private:
44 void initialize_from_string(const string& init_zid_full);
45 };
46
47 string to_string(const zid& x);
48 string to_string(const zid::type& x);
50}
51
52bool operator ==(const scifir::zid& x, const scifir::zid& y);
53bool operator !=(const scifir::zid& x, const scifir::zid& y);
54
55bool operator ==(const scifir::zid& x, const string& init_zid_full);
56bool operator !=(const scifir::zid& x, const string& init_zid_full);
57
58bool operator ==(const string& init_zid_full, const scifir::zid& x);
59bool operator !=(const string& init_zid_full, const scifir::zid& x);
60
61void operator +=(string& x, const scifir::zid& y);
62string operator +(const string& x, const scifir::zid& y);
63string operator +(const scifir::zid& y, const string& x);
64
65ostream& operator <<(ostream& os, const scifir::zid& x);
66istream& operator >>(istream& is, scifir::zid& x);
67
68#endif // SCIFIR_UNITS_SPECIAL_UNITS_ZID_HPP_INCLUDED
Class that stores astronomical ids, not as an integer but with an string as identifier....
Definition aid.hpp:14
Class that allows to store information about a zone, including the astronomical object inside which t...
Definition zid.hpp:14
zid::type zone_type
The type of zone. It can be any value of the enum zid::type. The possible values are COUNTRY,...
Definition zid.hpp:41
bool has_unknown_country() const
Returns true if the value of country is the predefined value 'unknown-country'.
Definition zid.cpp:134
void initialize_from_string(const string &init_zid_full)
Internal function. It's used by the string constructor and the string assignment of zid to initialize...
Definition zid.cpp:181
string display() const
Returns a string representation of zid, including the string representation of his aid.
Definition zid.cpp:139
bool has_no_country() const
Returns true if the value of country is the predefined value 'no-country'.
Definition zid.cpp:129
string partial_display() const
Returns a string representation of zid, without the string representation of his aid.
Definition zid.cpp:162
zid & operator=(const zid &x)
Copy assigment. The member-variables are copied from the zid x.
Definition zid.cpp:103
scifir::aid aid
The aid of the astronomical object where the zone is.
Definition zid.hpp:37
zid()
Default constructor. There's no data about any zone, the aid member-variable is also empty.
Definition zid.cpp:12
vector< string > regions
The different administrative regions where the zone is. There can be any number of administrative reg...
Definition zid.hpp:38
string zone
The name of the zone. Personal zones with a personal name are allowed, it's not necessary that the zo...
Definition zid.hpp:40
type
Type of zone.
Definition zid.hpp:16
@ REGION
A region.
Definition zid.hpp:16
@ ZONE
A zone. A zone is any surface inside an astronomical object, of any shape. It's not necessary to be a...
Definition zid.hpp:16
@ COUNTRY
A country.
Definition zid.hpp:16
@ SETTLEMENT
A settlement.
Definition zid.hpp:16
@ NONE
No zone.
Definition zid.hpp:16
string country
The country where the zone is. In extraterrestrial planets, it's considered a country any division of...
Definition zid.hpp:39
The namespace scifir contains all scifir-units, excepting the string literals, which are outside.
Definition address.cpp:6
string to_string(const aid &x)
Creates a string representation of aid, it's for aid equivalent to the display() function of aid.
Definition aid.cpp:582
zid::type create_zone_type(const string &zone_type_abbreviation)
Creates an instance of a zid::type with the given string, which is the reverse as the to_string() fun...
Definition zid.cpp:311
bool operator==(const scifir::zid &x, const scifir::zid &y)
Returns true if the type and all data are the same between x and y.
Definition zid.cpp:336
istream & operator>>(istream &is, scifir::zid &x)
Allows that an istream initializes by string a zid x.
Definition zid.cpp:424
ostream & operator<<(ostream &os, const scifir::zid &x)
Adds the string representation of the zid x to an output stream os.
Definition zid.cpp:419
void operator+=(string &x, const scifir::zid &y)
Concatenates the string representation of zid y to the string x.
Definition zid.cpp:396
string operator+(const string &x, const scifir::zid &y)
Concatenates x with the string representation of zid y.
Definition zid.cpp:403
bool operator!=(const scifir::zid &x, const scifir::zid &y)
Returns true if the type or any data is different between x and y.
Definition zid.cpp:369