3#include "boost/algorithm/string.hpp"
312 aid::aid(
const aid::type& new_astronomical_type,
const string& new_astro1,
const string& new_astro2,
const string& new_astro3,
const string& new_astro4) : universe(),galaxy(),solar_system(),
astronomical_body(),astronomical_type(
aid::
NONE)
321 if (new_astro2 !=
"")
334 if (new_astro3 !=
"")
348 if (new_astro4 !=
"")
381 galaxy = std::move(x.galaxy);
401 return (
universe ==
"unknown-universe");
406 return (
galaxy ==
"no-galaxy");
411 return (
galaxy ==
"unknown-galaxy");
446 vector<string> values;
447 boost::split(values,init_aid,boost::is_any_of(
":"));
449 if (values[0].front() ==
'(' and isalpha(values[0][1]))
452 if (isalpha(values[0][2]))
455 if (values[0].at(4) !=
' ')
457 new_value1 = values[0].substr(4);
461 new_value1 = values[0].substr(5);
467 if (values[0].at(3) !=
' ')
469 new_value1 = values[0].substr(3);
473 new_value1 = values[0].substr(4);
478 if (values.size() == 4)
485 else if (values.size() == 3)
499 if (values.size() == 3)
505 else if (values.size() == 2)
518 if (values.size() == 2)
523 else if (values.size() == 1)
615 if (astronomical_type_abbreviation ==
"U")
619 else if (astronomical_type_abbreviation ==
"G")
623 else if (astronomical_type_abbreviation ==
"SS")
627 else if (astronomical_type_abbreviation ==
"P")
631 else if (astronomical_type_abbreviation ==
"ST")
635 else if (astronomical_type_abbreviation ==
"A")
639 else if (astronomical_type_abbreviation ==
"MN")
643 else if (astronomical_type_abbreviation ==
"MT")
679 return !(x == init_aid);
690 return !(init_aid == x);
695 ostringstream output;
702 ostringstream output;
710 ostringstream output;
718 return os << to_string(x);
bool operator==(const scifir::aid &x, const scifir::aid &y)
Returns true if the type and all data are the same between x and y.
istream & operator>>(istream &is, scifir::aid &x)
Allows that an istream initializes by string an aid x.
void operator+=(string &x, const scifir::aid &y)
Concatenates the string representation of aid y to the string x.
bool operator!=(const scifir::aid &x, const scifir::aid &y)
Returns true if the type or any data is different between x and y.
ostream & operator<<(ostream &os, const scifir::aid &x)
Adds the string representation of the aid x to an output stream os.
string operator+(const string &x, const scifir::aid &y)
Concatenates x with the string representation of aid y.
Class that stores astronomical ids, not as an integer but with an string as identifier....
bool has_unknown_asteroid() const
Returns true if the asteroid has the special value "unknown-asteroid".
string universe
The universe of the astronomical body. The predefined value no-universe means that there's no univers...
void initialize_from_string(const string &init_aid)
Internal function. Initializes the member-variables with an initialization string of aid.
bool has_unknown_solar_system() const
Returns true if the solar system has the special value "unknown-solar-system".
bool has_unknown_star() const
Returns true if the star has the special value "unknown-star".
string galaxy
The galaxy of the astronomical body. The predefined value no-galaxy means that the astronomical objec...
aid::type astronomical_type
The type of the astronomical body, which can be any value of the enum aid::type.
bool has_no_solar_system() const
string solar_system
The solar system of the astronomical body. The predefined value no-solar-system means that the astron...
bool has_unknown_planet() const
Returns true if the planet has the special value "unknown-planet".
bool has_unknown_galaxy() const
Returns true if the galaxy has the special value "unknown-galaxy".
string display() const
Returns a string representation of aid.
aid & operator=(const aid &x)
Copy assignment. The member-variables are copied from the aid x.
bool has_unknown_universe() const
Returns true if the universe has the special value "unknown-universe".
aid()
Default constructor. The astronomical type is NONE, the other member-variables are empty strings.
bool has_unknown_moon() const
Returns true if the moon has the special value "unknown-moon".
bool has_no_galaxy() const
type
Type of astronomical body.
@ NONE
No astronomical body.
@ MOON
A moon. A moon is a natural satellite of a planet. His string representation is MN.
@ ASTEROID
An asteroid. An asteroid is an astronomical object that orbits another astronomical object....
@ METEOR
A meteor. His string representation is MT.
@ GALAXY
A galaxy. His string representation is G.
@ SOLAR_SYSTEM
A solar system. A solar system is composed of planets orbiting a star. His string representation is S...
@ UNIVERSE
A universe. His string representation is U.
@ STAR
A star. His string representation is ST.
@ PLANET
A planet. A planet is an astronomical object with atmosphere. His string representation is P.
bool has_no_universe() const
string astronomical_body
The name of the astronomical body. The predefined value unknown-planet means that it's not known the ...
The namespace scifir contains all scifir-units, excepting the string literals, which are outside.
astronomical_body
Contains predefined astronomical bodies to be set automatically in the aid class. All of them are imp...
@ IAPETUS
The moon of Saturn Iapetus.
@ DYSNOMIA
The moon of Eris Dysnomia.
@ ENCELADUS
The moon of Saturn Enceladus.
@ MILKY_WAY
The Milky Way galaxy.
@ MIMAS
The moon of Saturn Mimas.
@ CERES
The dwarf planet Ceres.
@ OBERON
The moon of Uranus Oberon.
@ RHEA
The moon of Saturn Rhea.
@ ANDROMEDA
The Andromeda galaxy, 2.5 million light years from Earth.
@ GANYMEDE
The moon of Jupiter Ganymede.
@ EUROPA
The moon of Jupiter Europa.
@ TITANIA
The moon of Uranus Titania.
@ SATURN
The planet Saturn.
@ HAUMEA
The dwarf planet Haumea.
@ MIRANDA
The moon of Uranus Miranda.
@ UMBRIEL
The moon of Uranus Umbriel.
@ QUAOAR
The dwarf planet Quaoar.
@ URANUS
The planet Uranus.
@ TITAN
The moon of Saturn Titan.
@ ERIS
The dwarf planet Eris.
@ GONGGONG
The possible dwarf planet Gonggong.
@ SUN
The Sun, the sun of the solar system of the Earth.
@ TRITON
The moon of Neptune Triton.
@ ARIEL
The moon of Uranus Ariel.
@ JUPITER
The planet Jupiter.
@ NEPTUNE
The planet Neptune.
@ SEDNA
The minor body Sedna.
@ CALLISTO
The moon of Jupiter Callisto.
@ MERCURY
The planet Mercury.
@ TETHYS
The moon of Saturn Tethys.
@ NONE
No predefined astronomical body selected.
@ DIONE
The moon of Saturn Dione.
@ CHARON
The moon of Pluto Charon.
@ PLUTO
The dwarf planet Pluto.
@ MAKEMAKE
The dwarf planet Makemake.
@ MOON
The Moon of the Earth.
@ IO
The moon of Jupiter Io.
@ ORCUS
The possible dwarf planet Orcus.
@ SOLAR_SYSTEM
The Solar System of the Earth.
string to_string(const aid &x)
Creates a string representation of aid, it's for aid equivalent to the display() function of aid.
aid::type create_astronomical_type(const string &astronomical_type_abbreviation)
Creates an instance of an aid::type with the given string, which is the reverse as the to_string() fu...