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
Classes | Namespaces | Functions
zid.hpp File Reference
#include "./aid.hpp"
#include <string>
#include <vector>
Include dependency graph for zid.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  scifir::zid
 Class that allows to store information about a zone, including the astronomical object inside which the zone is. The zone can be in any astronomical object, not only the Earth is supported. Initialization string example: "(P) universe:milky-way:solar-system:earth (Z) chile:region-metropolitana:santiago:providencia". More...
 

Namespaces

namespace  scifir
 The namespace scifir contains all scifir-units, excepting the string literals, which are outside.
 

Functions

string scifir::to_string (const zid &x)
 Returns a string representation of zid, same as display().
 
string scifir::to_string (const zid::type &x)
 Converts a value of the enum zid::type to its string representation, which is a single letter. The value COUNTRY returns C. The value REGION returns R. The value SETTLEMENT returns S. The value ZONE returns Z.
 
zid::type scifir::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() function of zid::type.
 
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.
 
bool operator!= (const scifir::zid &x, const scifir::zid &y)
 Returns true if the type or any data is different between x and y.
 
bool operator== (const scifir::zid &x, const string &init_zid_full)
 Returns true if x and the zid constructed with init_zid_full are equal.
 
bool operator!= (const scifir::zid &x, const string &init_zid_full)
 Returns true if x and the zid constructed with init_zid_full are different.
 
bool operator== (const string &init_zid_full, const scifir::zid &x)
 Returns true if x and the zid constructed with init_zid_full are equal.
 
bool operator!= (const string &init_zid_full, const scifir::zid &x)
 Returns true if x and the zid constructed with init_zid_full are different.
 
void operator+= (string &x, const scifir::zid &y)
 Concatenates the string representation of zid y to the string x.
 
string operator+ (const string &x, const scifir::zid &y)
 Concatenates x with the string representation of zid y.
 
string operator+ (const scifir::zid &y, const string &x)
 Concatenates x with the string representation of zid y.
 
ostream & operator<< (ostream &os, const scifir::zid &x)
 Adds the string representation of the zid x to an output stream os.
 
istream & operator>> (istream &is, scifir::zid &x)
 Allows that an istream initializes by string a zid x.
 

Function Documentation

◆ operator!=() [1/3]

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 at line 369 of file zid.cpp.

370{
371 return !(x == y);
372}

◆ operator!=() [2/3]

bool operator!= ( const scifir::zid x,
const string &  init_zid_full 
)

Returns true if x and the zid constructed with init_zid_full are different.

Definition at line 380 of file zid.cpp.

381{
382 return !(x == init_zid_full);
383}

◆ operator!=() [3/3]

bool operator!= ( const string &  init_zid_full,
const scifir::zid x 
)

Returns true if x and the zid constructed with init_zid_full are different.

Definition at line 391 of file zid.cpp.

392{
393 return !(init_zid_full == x);
394}

◆ operator+() [1/2]

string operator+ ( const scifir::zid y,
const string &  x 
)

Concatenates x with the string representation of zid y.

Definition at line 411 of file zid.cpp.

412{
413 ostringstream output;
414 output << y;
415 output << x;
416 return output.str();
417}

◆ operator+() [2/2]

string operator+ ( const string &  x,
const scifir::zid y 
)

Concatenates x with the string representation of zid y.

Definition at line 403 of file zid.cpp.

404{
405 ostringstream output;
406 output << x;
407 output << y;
408 return output.str();
409}

◆ operator+=()

void operator+= ( string &  x,
const scifir::zid y 
)

Concatenates the string representation of zid y to the string x.

Definition at line 396 of file zid.cpp.

397{
398 ostringstream output;
399 output << y;
400 x += output.str();
401}

◆ operator<<()

ostream & operator<< ( ostream &  os,
const scifir::zid x 
)

Adds the string representation of the zid x to an output stream os.

Definition at line 419 of file zid.cpp.

420{
421 return os << to_string(x);
422}
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

◆ operator==() [1/3]

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 at line 336 of file zid.cpp.

337{
338 if (x.aid == y.aid)
339 {
340 if (x.country == y.country)
341 {
342 for (unsigned int i = 0; i < x.regions.size(); i++)
343 {
344 if (x.regions[i] != y.regions[i])
345 {
346 return false;
347 }
348 }
349 if (x.zone == y.zone)
350 {
351 return true;
352 }
353 else
354 {
355 return false;
356 }
357 }
358 else
359 {
360 return false;
361 }
362 }
363 else
364 {
365 return false;
366 }
367}
scifir::aid aid
The aid of the astronomical object where the zone is.
Definition zid.hpp:37
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
string country
The country where the zone is. In extraterrestrial planets, it's considered a country any division of...
Definition zid.hpp:39

◆ operator==() [2/3]

bool operator== ( const scifir::zid x,
const string &  init_zid_full 
)

Returns true if x and the zid constructed with init_zid_full are equal.

Definition at line 374 of file zid.cpp.

375{
376 scifir::zid y = scifir::zid(init_zid_full);
377 return (x == y);
378}
Class that allows to store information about a zone, including the astronomical object inside which t...
Definition zid.hpp:14

◆ operator==() [3/3]

bool operator== ( const string &  init_zid_full,
const scifir::zid x 
)

Returns true if x and the zid constructed with init_zid_full are equal.

Definition at line 385 of file zid.cpp.

386{
387 scifir::zid y = scifir::zid(init_zid_full);
388 return (x == y);
389}

◆ operator>>()

istream & operator>> ( istream &  is,
scifir::zid x 
)

Allows that an istream initializes by string a zid x.

Definition at line 424 of file zid.cpp.

425{
426 char a[256];
427 is.getline(a, 256);
428 string b(a);
429 boost::trim(b);
430 x = scifir::zid(b);
431 return is;
432}