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
coordinates
address.cpp
Go to the documentation of this file.
1
#include "
./address.hpp
"
2
3
using namespace
std;
4
5
namespace
scifir
6
{
7
address::address
() :
zid
(),location(),inner_location(),postal_code()
8
{}
9
10
address::address
(
const
address
& x) :
zid
(x.
zid
),location(x.location),inner_location(x.inner_location),postal_code(x.postal_code)
11
{}
12
13
address::address
(
address
&& x) :
zid
(std::move(x.
zid
)),location(std::move(x.location)),inner_location(std::move(x.inner_location)),postal_code(std::move(x.postal_code))
14
{}
15
16
address::address
(
const
scifir::zid
& new_zid,
const
string
& new_location,
const
string
& new_inner_location,
const
string
& new_postal_code) :
zid
(new_zid),location(new_location),inner_location(new_inner_location),postal_code(new_postal_code)
17
{}
18
19
address
&
address::operator =
(
const
address
& x)
20
{
21
zid
= x.
zid
;
22
location
= x.
location
;
23
inner_location
= x.
inner_location
;
24
postal_code
= x.
postal_code
;
25
return
*
this
;
26
}
27
28
address
&
address::operator =
(
address
&& x)
29
{
30
zid
= std::move(x.zid);
31
location
= std::move(x.location);
32
inner_location
= std::move(x.inner_location);
33
postal_code
= std::move(x.postal_code);
34
return
*
this
;
35
}
36
37
address::type
address::get_type
()
const
38
{
39
if
(
inner_location
!=
""
)
40
{
41
return
address::INTERNAL
;
42
}
43
else
44
{
45
return
address::EXTERNAL
;
46
}
47
}
48
49
string
address::display
()
const
50
{
51
if
(
inner_location
!=
""
)
52
{
53
return
zid
+
", "
+
location
+
" "
+
inner_location
;
54
}
55
else
56
{
57
return
partial_display
();
58
}
59
}
60
61
string
address::partial_display
()
const
62
{
63
return
location
+
" "
+
inner_location
;
64
}
65
66
string
address::text_display
()
const
67
{
68
ostringstream out;
69
out <<
zid
<<
"\n"
;
70
out <<
location
<<
"\n"
;
71
out <<
inner_location
<<
"\n"
;
72
return
out.str();
73
}
74
}
75
76
bool
operator ==
(
const
scifir::address
& x,
const
scifir::address
& y)
77
{
78
if
(x.
zid
== y.
zid
and x.
location
== y.
location
and x.
postal_code
== y.
postal_code
and x.
inner_location
== y.
inner_location
)
79
{
80
return
true
;
81
}
82
else
83
{
84
return
false
;
85
}
86
}
87
88
bool
operator !=
(
const
scifir::address
& x,
const
scifir::address
& y)
89
{
90
return
!(x == y);
91
}
92
93
ostream&
operator <<
(ostream& os,
const
scifir::address
& x)
94
{
95
return
os << x.
display
();
96
}
operator!=
bool operator!=(const scifir::address &x, const scifir::address &y)
Definition
address.cpp:88
operator==
bool operator==(const scifir::address &x, const scifir::address &y)
Definition
address.cpp:76
operator<<
ostream & operator<<(ostream &os, const scifir::address &x)
Definition
address.cpp:93
address.hpp
scifir::address
Definition
address.hpp:15
scifir::address::inner_location
string inner_location
Definition
address.hpp:35
scifir::address::location
string location
Definition
address.hpp:34
scifir::address::type
type
Definition
address.hpp:17
scifir::address::EXTERNAL
@ EXTERNAL
Definition
address.hpp:17
scifir::address::INTERNAL
@ INTERNAL
Definition
address.hpp:17
scifir::address::postal_code
string postal_code
Definition
address.hpp:36
scifir::address::get_type
address::type get_type() const
Definition
address.cpp:37
scifir::address::display
string display() const
Definition
address.cpp:49
scifir::address::operator=
address & operator=(const address &x)
Definition
address.cpp:19
scifir::address::text_display
string text_display() const
Definition
address.cpp:66
scifir::address::partial_display
string partial_display() const
Definition
address.cpp:61
scifir::address::zid
scifir::zid zid
Definition
address.hpp:33
scifir::address::address
address()
Definition
address.cpp:7
scifir::zid
Class that allows to store information about a zone, including the astronomical object inside which t...
Definition
zid.hpp:14
scifir
The namespace scifir contains all scifir-units, excepting the string literals, which are outside.
Definition
address.cpp:6
Generated by
1.9.8