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 : Maxim Mamontov <faust@stargazer.dp.ua>
 
  21 #ifndef SERVICE_CONF_H
 
  22 #define SERVICE_CONF_H
 
  24 #include "resetable.h"
 
  32     : name(), comment(), cost(0), payDay(0)
 
  34 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 SERVICE_CONF_RES & operator=(const SERVICE_CONF & conf)
 
  64 comment = conf.comment;
 
  70 SERVICE_CONF GetData() const
 
  73 sc.name = name.data();
 
  74 sc.comment = comment.data();
 
  75 sc.cost = cost.data();
 
  76 sc.payDay = payDay.data();
 
  80 RESETABLE<std::string> name;
 
  81 RESETABLE<std::string> comment;
 
  82 RESETABLE<double>      cost;
 
  83 RESETABLE<uint8_t>     payDay;
 
  87 bool operator==(const SERVICE_CONF & a, const SERVICE_CONF & b)
 
  89 return a.name == b.name;
 
  92 #endif //SERVICE_CONF_H