1 | /* |
---|
2 | Copyright (C) 2014 |
---|
3 | Alejandro Mujica (amujica@cenditel.gob.ve) |
---|
4 | José Ruiz (jruiz@cenditel.gob.ve) |
---|
5 | Julie Vera (jvera@cenditel.gob.ve) |
---|
6 | |
---|
7 | CENDITEL Fundación Centro Nacional de Desarrollo e Investigación en |
---|
8 | Tecnologías Libres |
---|
9 | |
---|
10 | Este programa es software libre; Usted puede usarlo bajo los términos de la |
---|
11 | licencia de software GPL versión 2.0 de la Free Software Foundation. |
---|
12 | |
---|
13 | Este programa se distribuye con la esperanza de que sea útil, pero SIN |
---|
14 | NINGUNA GARANTÍA; tampoco las implícitas garantías de MERCANTILIDAD o |
---|
15 | ADECUACIÓN A UN PROPÓSITO PARTICULAR. |
---|
16 | Consulte la licencia GPL para más detalles. Usted debe recibir una copia |
---|
17 | de la GPL junto con este programa; si no, escriba a la Free Software |
---|
18 | Foundation Inc. 51 Franklin Street,5 Piso, Boston, MA 02110-1301, USA. |
---|
19 | */ |
---|
20 | |
---|
21 | /* |
---|
22 | Autor: Alejandro J. Mujica |
---|
23 | Fecha de creación: 05/06/2014 |
---|
24 | Este archivo contiene la implementación de la abstracción de un Bien. |
---|
25 | */ |
---|
26 | |
---|
27 | # include <good.H> |
---|
28 | |
---|
29 | Good::Good() |
---|
30 | : company_rif(), company_name(), company_location(), nationality("N"), id(0), |
---|
31 | name(), tariff_code(), measurement_unit(), level(0) |
---|
32 | { |
---|
33 | // Empty |
---|
34 | } |
---|
35 | |
---|
36 | Good::Good(const Good & good) |
---|
37 | : company_rif(good.company_rif), company_name(good.company_name), |
---|
38 | company_location(good.company_location), nationality(good.nationality), |
---|
39 | id(good.id), name(good.name), tariff_code(good.tariff_code), |
---|
40 | measurement_unit(good.measurement_unit), level(good.level) |
---|
41 | { |
---|
42 | // Empty |
---|
43 | } |
---|
44 | |
---|
45 | Good::Good(Good && good) |
---|
46 | : company_rif(), company_name(), company_location(), nationality("N"), id(0), |
---|
47 | name(), tariff_code(), measurement_unit(), level(0) |
---|
48 | { |
---|
49 | std::swap(company_rif, good.company_rif); |
---|
50 | std::swap(company_name, good.company_name); |
---|
51 | std::swap(company_location, good.company_location); |
---|
52 | std::swap(nationality, good.nationality); |
---|
53 | std::swap(id, good.id); |
---|
54 | std::swap(name, good.name); |
---|
55 | std::swap(tariff_code, good.tariff_code); |
---|
56 | std::swap(measurement_unit, good.measurement_unit); |
---|
57 | std::swap(level, good.level); |
---|
58 | } |
---|
59 | |
---|
60 | const std::string & Good::get_company_rif() const |
---|
61 | { |
---|
62 | return company_rif; |
---|
63 | } |
---|
64 | |
---|
65 | void Good::set_company_rif(const std::string & _company_rif) |
---|
66 | { |
---|
67 | company_rif = _company_rif; |
---|
68 | } |
---|
69 | |
---|
70 | void Good::set_company_rif(std::string && _company_rif) |
---|
71 | { |
---|
72 | company_rif = std::move(_company_rif); |
---|
73 | } |
---|
74 | |
---|
75 | const std::string & Good::get_company_name() const |
---|
76 | { |
---|
77 | return company_name; |
---|
78 | } |
---|
79 | |
---|
80 | void Good::set_company_name(const std::string & _company_name) |
---|
81 | { |
---|
82 | company_name = _company_name; |
---|
83 | } |
---|
84 | |
---|
85 | void Good::set_company_name(std::string && _company_name) |
---|
86 | { |
---|
87 | company_name = std::move(_company_name); |
---|
88 | } |
---|
89 | |
---|
90 | const std::string & Good::get_company_location() const |
---|
91 | { |
---|
92 | return company_location; |
---|
93 | } |
---|
94 | |
---|
95 | void Good::set_company_location(const std::string & _company_location) |
---|
96 | { |
---|
97 | company_location = _company_location; |
---|
98 | } |
---|
99 | |
---|
100 | void Good::set_company_location(std::string && _company_location) |
---|
101 | { |
---|
102 | company_location = std::move(_company_location); |
---|
103 | } |
---|
104 | |
---|
105 | const std::string & Good::get_nationality() const |
---|
106 | { |
---|
107 | return nationality; |
---|
108 | } |
---|
109 | |
---|
110 | void Good::set_nationality(const std::string & _nationality) |
---|
111 | { |
---|
112 | nationality = _nationality; |
---|
113 | } |
---|
114 | |
---|
115 | void Good::set_nationality(std::string && _nationality) |
---|
116 | { |
---|
117 | nationality = std::move(_nationality); |
---|
118 | } |
---|
119 | |
---|
120 | |
---|
121 | const db_id_t & Good::get_id() const |
---|
122 | { |
---|
123 | return id; |
---|
124 | } |
---|
125 | |
---|
126 | void Good::set_id(const db_id_t & _id) |
---|
127 | { |
---|
128 | id = _id; |
---|
129 | } |
---|
130 | |
---|
131 | const std::string & Good::get_name() const |
---|
132 | { |
---|
133 | return name; |
---|
134 | } |
---|
135 | |
---|
136 | void Good::set_name(const std::string & _name) |
---|
137 | { |
---|
138 | name = _name; |
---|
139 | } |
---|
140 | |
---|
141 | void Good::set_name(std::string && _name) |
---|
142 | { |
---|
143 | name = std::move(_name); |
---|
144 | } |
---|
145 | |
---|
146 | const std::string & Good::get_tariff_code() const |
---|
147 | { |
---|
148 | return tariff_code; |
---|
149 | } |
---|
150 | |
---|
151 | void Good::set_tariff_code(const std::string & _tariff_code) |
---|
152 | { |
---|
153 | tariff_code = _tariff_code; |
---|
154 | } |
---|
155 | |
---|
156 | void Good::set_tariff_code(std::string && _tariff_code) |
---|
157 | { |
---|
158 | tariff_code = std::move(_tariff_code); |
---|
159 | } |
---|
160 | |
---|
161 | const std::string & Good::get_measurement_unit() const |
---|
162 | { |
---|
163 | return measurement_unit; |
---|
164 | } |
---|
165 | |
---|
166 | void Good::set_measurement_unit(const std::string & _measurement_unit) |
---|
167 | { |
---|
168 | measurement_unit = _measurement_unit; |
---|
169 | } |
---|
170 | |
---|
171 | void Good::set_measurement_unit(std::string && _measurement_unit) |
---|
172 | { |
---|
173 | measurement_unit = std::move(_measurement_unit); |
---|
174 | } |
---|
175 | |
---|
176 | const int & Good::get_level() const |
---|
177 | { |
---|
178 | return level; |
---|
179 | } |
---|
180 | |
---|
181 | void Good::set_level(const int & _level) |
---|
182 | { |
---|
183 | level = _level; |
---|
184 | } |
---|
185 | |
---|
186 | Good & Good::operator = (const Good & good) |
---|
187 | { |
---|
188 | if (&good == this) |
---|
189 | return *this; |
---|
190 | |
---|
191 | company_rif = good.company_rif; |
---|
192 | company_name = good.company_name; |
---|
193 | nationality = good.nationality; |
---|
194 | id = good.id; |
---|
195 | name = good.name; |
---|
196 | tariff_code = good.tariff_code; |
---|
197 | measurement_unit = good.measurement_unit; |
---|
198 | level = good.level; |
---|
199 | |
---|
200 | return *this; |
---|
201 | } |
---|
202 | |
---|
203 | Good & Good::operator = (Good && good) |
---|
204 | { |
---|
205 | std::swap(company_rif, good.company_rif); |
---|
206 | std::swap(company_name, good.company_name); |
---|
207 | std::swap(nationality, good.nationality); |
---|
208 | std::swap(id, good.id); |
---|
209 | std::swap(name, good.name); |
---|
210 | std::swap(tariff_code, good.tariff_code); |
---|
211 | std::swap(measurement_unit, good.measurement_unit); |
---|
212 | std::swap(level, good.level); |
---|
213 | |
---|
214 | return *this; |
---|
215 | } |
---|
216 | |
---|
217 | std::string Good::to_dot() const |
---|
218 | { |
---|
219 | std::stringstream sstr; |
---|
220 | |
---|
221 | sstr << "RIF: " << company_rif << "\\n" |
---|
222 | << "Empresa: " << company_name << "\\n" |
---|
223 | << "Nac: " << nationality << "\\n" |
---|
224 | << "ID: " << id << "\\n" |
---|
225 | << "Producto: " << name << "\\n" |
---|
226 | << "Cod Aran: " << tariff_code << "\\n" |
---|
227 | << "Unidad Medida: " << measurement_unit << "\\n" |
---|
228 | << "Nivel: " << level; |
---|
229 | |
---|
230 | return sstr.str(); |
---|
231 | } |
---|
232 | |
---|