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 : Boris Mikhailenko <stg34@stargazer.dp.ua>
19 * Author : Maxim Mamontov <faust@stargazer.dp.ua>
22 #ifndef __STG_SGCONFIG_PARSER_TARIFFS_H__
23 #define __STG_SGCONFIG_PARSER_TARIFFS_H__
27 #include "stg/tariff_conf.h"
28 #include "stg/common.h"
41 class GET_TARIFFS: public BASE_PARSER
44 class FACTORY : public BASE_PARSER::FACTORY
47 explicit FACTORY(const TARIFFS & tariffs) : m_tariffs(tariffs) {}
48 virtual BASE_PARSER * create(const ADMIN & admin) { return new GET_TARIFFS(admin, m_tariffs); }
49 static void Register(REGISTRY & registry, const TARIFFS & tariffs)
50 { registry[ToLower(tag)] = new FACTORY(tariffs); }
52 const TARIFFS & m_tariffs;
55 static const char * tag;
57 GET_TARIFFS(const ADMIN & admin, const TARIFFS & tariffs)
58 : BASE_PARSER(admin, tag), m_tariffs(tariffs) {}
61 const TARIFFS & m_tariffs;
66 class ADD_TARIFF: public BASE_PARSER
69 class FACTORY : public BASE_PARSER::FACTORY
72 explicit FACTORY(TARIFFS & tariffs) : m_tariffs(tariffs) {}
73 virtual BASE_PARSER * create(const ADMIN & admin) { return new ADD_TARIFF(admin, m_tariffs); }
74 static void Register(REGISTRY & registry, TARIFFS & tariffs)
75 { registry[ToLower(tag)] = new FACTORY(tariffs); }
80 static const char * tag;
82 ADD_TARIFF(const ADMIN & admin, TARIFFS & tariffs)
83 : BASE_PARSER(admin, tag), m_tariffs(tariffs) {}
84 int Start(void * data, const char * el, const char ** attr);
93 class DEL_TARIFF: public BASE_PARSER
96 class FACTORY : public BASE_PARSER::FACTORY
99 FACTORY(TARIFFS & tariffs, const USERS & users) : m_tariffs(tariffs), m_users(users) {}
100 virtual BASE_PARSER * create(const ADMIN & admin) { return new DEL_TARIFF(admin, m_users, m_tariffs); }
101 static void Register(REGISTRY & registry, TARIFFS & tariffs, const USERS & users)
102 { registry[ToLower(tag)] = new FACTORY(tariffs, users); }
105 const USERS & m_users;
108 static const char * tag;
110 DEL_TARIFF(const ADMIN & admin, const USERS & users, TARIFFS & tariffs)
111 : BASE_PARSER(admin, tag), m_users(users), m_tariffs(tariffs) {}
112 int Start(void * data, const char * el, const char ** attr);
116 const USERS & m_users;
122 class CHG_TARIFF: public BASE_PARSER
125 class FACTORY : public BASE_PARSER::FACTORY
128 explicit FACTORY(TARIFFS & tariffs) : m_tariffs(tariffs) {}
129 virtual BASE_PARSER * create(const ADMIN & admin) { return new CHG_TARIFF(admin, m_tariffs); }
130 static void Register(REGISTRY & registry, TARIFFS & tariffs)
131 { registry[ToLower(tag)] = new FACTORY(tariffs); }
136 static const char * tag;
138 CHG_TARIFF(const ADMIN & admin, TARIFFS & tariffs)
139 : BASE_PARSER(admin, tag), m_tariffs(tariffs) {}
140 int Start(void * data, const char * el, const char ** attr);
146 int CheckTariffData();
150 } // namespace PARSER