2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 * Author : Maksym Mamontov <stg@madf.info>
21 #ifndef SERVICE_CONF_H
22 #define SERVICE_CONF_H
24 #include "resetable.h"
32 : name(), comment(), cost(0), payDay(0)
34 explicit SERVICE_CONF(const std::string & n)
35 : name(n), comment(), cost(0), payDay(0)
37 SERVICE_CONF(const std::string & n, double c)
38 : name(n), comment(), cost(c), payDay(0)
40 SERVICE_CONF(const std::string & n, double c, unsigned p)
41 : name(n), comment(), cost(c), payDay(static_cast<uint8_t>(p))
43 SERVICE_CONF(const std::string & n, double c,
44 unsigned p, const std::string & com)
45 : name(n), comment(com), cost(c), payDay(static_cast<uint8_t>(p))
54 struct SERVICE_CONF_RES
61 explicit SERVICE_CONF_RES(const SERVICE_CONF & rhs)
62 : name(rhs.name), comment(rhs.comment),
63 cost(rhs.cost), payDay(rhs.payDay)
66 SERVICE_CONF_RES & operator=(const SERVICE_CONF & conf)
69 comment = conf.comment;
75 SERVICE_CONF GetData() const
78 sc.name = name.data();
79 sc.comment = comment.data();
80 sc.cost = cost.data();
81 sc.payDay = payDay.data();
85 void Splice(const SERVICE_CONF_RES & rhs)
87 name.splice(rhs.name);
88 comment.splice(rhs.comment);
89 cost.splice(rhs.cost);
90 payDay.splice(rhs.payDay);
93 RESETABLE<std::string> name;
94 RESETABLE<std::string> comment;
95 RESETABLE<double> cost;
96 RESETABLE<uint8_t> payDay;
100 bool operator==(const SERVICE_CONF & a, const SERVICE_CONF & b)
102 return a.name == b.name;
105 #endif //SERVICE_CONF_H