1 | /* |
---|
2 | Copyright (C) 2012 |
---|
3 | Alejandro Mujica (amujica@cenditel.gob.ve) |
---|
4 | Erwin Paredes (eparedes@cenditel.gob.ve) |
---|
5 | José Ruiz (jruiz@cenditel.gob.ve) |
---|
6 | Rodolfo Rangel (rrangel@cenditel.gob.ve) |
---|
7 | Julie Vera (jvera@cenditel.gob.ve) |
---|
8 | |
---|
9 | CENDITEL Fundación Centro Nacional de Desarrollo e Investigación en |
---|
10 | Tecnologías Libres |
---|
11 | |
---|
12 | Este programa es software libre; Usted puede usarlo bajo los términos de la |
---|
13 | licencia de software GPL versión 2.0 de la Free Software Foundation. |
---|
14 | |
---|
15 | Este programa se distribuye con la esperanza de que sea útil, pero SIN |
---|
16 | NINGUNA GARANTÍA; tampoco las implícitas garantías de MERCANTILIDAD o |
---|
17 | ADECUACIÓN A UN PROPÓSITO PARTICULAR. |
---|
18 | Consulte la licencia GPL para más detalles. Usted debe recibir una copia |
---|
19 | de la GPL junto con este programa; si no, escriba a la Free Software |
---|
20 | Foundation Inc. 51 Franklin Street,5 Piso, Boston, MA 02110-1301, USA. |
---|
21 | */ |
---|
22 | |
---|
23 | /* |
---|
24 | Autor: Alejandro J. Mujica |
---|
25 | Fecha de creación: 10/09/2013 |
---|
26 | Este archivo contiene la implementación de la clase Good. |
---|
27 | */ |
---|
28 | |
---|
29 | # include <good.H> |
---|
30 | |
---|
31 | Good::Good() |
---|
32 | : id(-1), name("NULL"), technicalSpecifications("NULL"), tariffCode("NULL"), |
---|
33 | measurementUnit("NULL"), trademark("NULL"), usedCapacity(0.0), |
---|
34 | quantity(0.0), totalQuantity(0.0), unitarianPrice(0.0) { |
---|
35 | |
---|
36 | // Empty |
---|
37 | } |
---|
38 | |
---|
39 | Good::Good(const Good & good) |
---|
40 | : id(good.id), name(good.name), |
---|
41 | technicalSpecifications(good.technicalSpecifications), |
---|
42 | tariffCode(good.tariffCode), measurementUnit(good.measurementUnit), |
---|
43 | trademark(good.trademark), usedCapacity(good.usedCapacity), |
---|
44 | quantity(good.quantity), totalQuantity(good.totalQuantity), |
---|
45 | unitarianPrice(good.unitarianPrice) { |
---|
46 | |
---|
47 | // Empty |
---|
48 | } |
---|
49 | |
---|
50 | Good::Good(Good && good) |
---|
51 | : id(-1), name("NULL"), technicalSpecifications("NULL"), tariffCode("NULL"), |
---|
52 | measurementUnit("NULL"), trademark("NULL"), usedCapacity(0.0), |
---|
53 | quantity(0.0), totalQuantity(0.0), unitarianPrice(0.0) { |
---|
54 | |
---|
55 | std::swap(id, good.id); |
---|
56 | std::swap(name, good.name); |
---|
57 | std::swap(technicalSpecifications, good.technicalSpecifications); |
---|
58 | std::swap(tariffCode, good.tariffCode); |
---|
59 | std::swap(measurementUnit, good.measurementUnit); |
---|
60 | std::swap(trademark, good.trademark); |
---|
61 | std::swap(usedCapacity, good.usedCapacity); |
---|
62 | std::swap(quantity, good.quantity); |
---|
63 | std::swap(totalQuantity, good.totalQuantity); |
---|
64 | std::swap(unitarianPrice, good.unitarianPrice); |
---|
65 | } |
---|
66 | |
---|
67 | Good::~Good() { |
---|
68 | // Empty |
---|
69 | } |
---|
70 | |
---|
71 | const long & Good::getId() const { |
---|
72 | return id; |
---|
73 | } |
---|
74 | |
---|
75 | void Good::setId(const long & id) { |
---|
76 | this->id = id; |
---|
77 | } |
---|
78 | |
---|
79 | const std::string & Good::getName() const { |
---|
80 | return name; |
---|
81 | } |
---|
82 | |
---|
83 | void Good::setName(const std::string & name) { |
---|
84 | this->name = name; |
---|
85 | } |
---|
86 | |
---|
87 | void Good::setName(std::string && name) { |
---|
88 | this->name = std::move(name); |
---|
89 | } |
---|
90 | |
---|
91 | const std::string & Good::getTechnicalSpecifications() const { |
---|
92 | return technicalSpecifications; |
---|
93 | } |
---|
94 | |
---|
95 | void Good::setTechnicalSpecifications( |
---|
96 | const std::string & technicalSpecifications) { |
---|
97 | this->technicalSpecifications = technicalSpecifications; |
---|
98 | } |
---|
99 | |
---|
100 | void Good::setTechnicalSpecifications(std::string && technicalSpecifications) { |
---|
101 | this->technicalSpecifications = std::move(technicalSpecifications); |
---|
102 | } |
---|
103 | |
---|
104 | const std::string & Good::getTariffCode() const { |
---|
105 | return tariffCode; |
---|
106 | } |
---|
107 | |
---|
108 | void Good::setTariffCode(const std::string & tariffCode) { |
---|
109 | this->tariffCode = tariffCode; |
---|
110 | } |
---|
111 | |
---|
112 | void Good::setTariffCode(std::string && tariffCode) { |
---|
113 | this->tariffCode = std::move(tariffCode); |
---|
114 | } |
---|
115 | |
---|
116 | const std::string & Good::getMeasurementUnit() const { |
---|
117 | return measurementUnit; |
---|
118 | } |
---|
119 | |
---|
120 | void Good::setMeasurementUnit(const std::string & measurementUnit) { |
---|
121 | this->measurementUnit = measurementUnit; |
---|
122 | } |
---|
123 | |
---|
124 | void Good::setMeasurementUnit(std::string && measurementUnit) { |
---|
125 | this->measurementUnit = std::move(measurementUnit); |
---|
126 | } |
---|
127 | |
---|
128 | const std::string & Good::getTrademark() const { |
---|
129 | return trademark; |
---|
130 | } |
---|
131 | |
---|
132 | void Good::setTrademark(const std::string & trademark) { |
---|
133 | this->trademark = trademark; |
---|
134 | } |
---|
135 | |
---|
136 | void Good::setTrademark(std::string && trademark) { |
---|
137 | this->trademark = std::move(trademark); |
---|
138 | } |
---|
139 | |
---|
140 | const real & Good::getUsedCapacity() const { |
---|
141 | return usedCapacity; |
---|
142 | } |
---|
143 | |
---|
144 | void Good::setUsedCapacity(const real & usedCapacity) { |
---|
145 | this->usedCapacity = usedCapacity; |
---|
146 | } |
---|
147 | |
---|
148 | const real & Good::getQuantity() const { |
---|
149 | return quantity; |
---|
150 | } |
---|
151 | |
---|
152 | void Good::setQuantity(const real & quantity) { |
---|
153 | this->quantity = quantity; |
---|
154 | } |
---|
155 | |
---|
156 | const real & Good::getTotalQuantity() const { |
---|
157 | return totalQuantity; |
---|
158 | } |
---|
159 | |
---|
160 | void Good::setTotalQuantity(const real & totalQuantity) { |
---|
161 | this->totalQuantity = totalQuantity; |
---|
162 | } |
---|
163 | |
---|
164 | const real & Good::getUnitarianPrice() const { |
---|
165 | return unitarianPrice; |
---|
166 | } |
---|
167 | |
---|
168 | void Good::setUnitarianPrice(const real & unitarianPrice) { |
---|
169 | this->unitarianPrice = unitarianPrice; |
---|
170 | } |
---|
171 | |
---|
172 | Good & Good::operator = (const Good & good) { |
---|
173 | |
---|
174 | if (&good == this) |
---|
175 | return *this; |
---|
176 | |
---|
177 | id = good.id; |
---|
178 | name = good.name; |
---|
179 | technicalSpecifications = good.technicalSpecifications; |
---|
180 | tariffCode = good.tariffCode; |
---|
181 | measurementUnit = good.measurementUnit; |
---|
182 | trademark = good.trademark; |
---|
183 | usedCapacity = good.usedCapacity; |
---|
184 | quantity = good.quantity; |
---|
185 | totalQuantity = good.totalQuantity; |
---|
186 | unitarianPrice = good.unitarianPrice; |
---|
187 | |
---|
188 | return *this; |
---|
189 | } |
---|
190 | |
---|
191 | Good & Good::operator = (Good && good) { |
---|
192 | |
---|
193 | std::swap(id, good.id); |
---|
194 | std::swap(name, good.name); |
---|
195 | std::swap(technicalSpecifications, good.technicalSpecifications); |
---|
196 | std::swap(tariffCode, good.tariffCode); |
---|
197 | std::swap(measurementUnit, good.measurementUnit); |
---|
198 | std::swap(trademark, good.trademark); |
---|
199 | std::swap(usedCapacity, good.usedCapacity); |
---|
200 | std::swap(quantity, good.quantity); |
---|
201 | std::swap(totalQuantity, good.totalQuantity); |
---|
202 | std::swap(unitarianPrice, good.unitarianPrice); |
---|
203 | |
---|
204 | return *this; |
---|
205 | } |
---|
206 | |
---|