belcard_params.hpp 4.52 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
/*
	belcard_params.hpp
	Copyright (C) 2015  Belledonne Communications SARL

	This program is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

19 20 21
#ifndef belcard_params_hpp
#define belcard_params_hpp

Sylvain Berfini's avatar
Sylvain Berfini committed
22
#include <belr/parser-impl.cc>
23 24
#include <belr/grammarbuilder.hh>
#include <belr/abnf.hh>
Sylvain Berfini's avatar
Sylvain Berfini committed
25
#include "belcard_generic.hpp"
26 27

#include <string>
Sylvain Berfini's avatar
Sylvain Berfini committed
28
#include <sstream>
29 30 31 32 33

using namespace::std;
using namespace::belr;

namespace belcard {
Sylvain Berfini's avatar
Sylvain Berfini committed
34 35 36 37 38
	class BelCardParam : public BelCardGeneric {
	private:
		string _name;
		string _value;
	public:
Sylvain Berfini's avatar
Sylvain Berfini committed
39 40
		template <typename T>
		static shared_ptr<T> parseParam(const string& rule, const string& input);
Sylvain Berfini's avatar
Sylvain Berfini committed
41 42
		static shared_ptr<BelCardParam> parse(const string& input);
		static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
Sylvain Berfini's avatar
Sylvain Berfini committed
43
		static void setAllParamsHandlersAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
Sylvain Berfini's avatar
Sylvain Berfini committed
44 45 46 47 48 49 50 51 52
		
		BelCardParam();
		
		virtual void setName(const string &name);
		virtual const string &getName() const;
		
		virtual void setValue(const string &value) ;
		virtual const string &getValue() const;
		
53
		virtual void serialize(ostream &output) const;
Sylvain Berfini's avatar
Sylvain Berfini committed
54 55
	};
	
56 57 58 59 60 61 62 63
	class BelCardLanguageParam : public BelCardParam {
	public:
		static shared_ptr<BelCardLanguageParam> parse(const string& input);
		static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
		
		BelCardLanguageParam();
	};
	
64 65 66 67 68 69 70
	class BelCardValueParam : public BelCardParam {
	public:
		static shared_ptr<BelCardValueParam> parse(const string& input);
		static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
		
		BelCardValueParam();
	};
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
	
	class BelCardPrefParam : public BelCardParam {
	public:
		static shared_ptr<BelCardPrefParam> parse(const string& input);
		static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
		
		BelCardPrefParam();
	};
	
	class BelCardAlternativeIdParam : public BelCardParam {
	public:
		static shared_ptr<BelCardAlternativeIdParam> parse(const string& input);
		static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
		
		BelCardAlternativeIdParam();
	};
	
	class BelCardParamIdParam : public BelCardParam {
	public:
		static shared_ptr<BelCardParamIdParam> parse(const string& input);
		static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
		
		BelCardParamIdParam();
	};
	
	class BelCardTypeParam : public BelCardParam {
	public:
		static shared_ptr<BelCardTypeParam> parse(const string& input);
		static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
		
		BelCardTypeParam();
	};
	
	class BelCardMediaTypeParam : public BelCardParam {
	public:
		static shared_ptr<BelCardMediaTypeParam> parse(const string& input);
		static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
		
		BelCardMediaTypeParam();
	};
	
	class BelCardCALSCALEParam : public BelCardParam {
	public:
		static shared_ptr<BelCardCALSCALEParam> parse(const string& input);
		static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
		
		BelCardCALSCALEParam();
	};
	
	class BelCardSortAsParam : public BelCardParam {
	public:
		static shared_ptr<BelCardSortAsParam> parse(const string& input);
		static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
		
		BelCardSortAsParam();
	};
	
	class BelCardGeoParam : public BelCardParam {
	public:
		static shared_ptr<BelCardGeoParam> parse(const string& input);
		static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
		
		BelCardGeoParam();
	};
	
	class BelCardTimezoneParam : public BelCardParam {
	public:
		static shared_ptr<BelCardTimezoneParam> parse(const string& input);
		static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
		
		BelCardTimezoneParam();
	};
143 144 145 146 147 148 149 150
	
	class BelCardLabelParam : public BelCardParam {
	public:
		static shared_ptr<BelCardLabelParam> parse(const string& input);
		static void setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric>> *parser);
		
		BelCardLabelParam();
	};
151 152 153
}

#endif