/usr/include/belcard/belcard_property.hpp is in libbelcard-dev 1.0.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 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 | /*
belcard_property.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/>.
*/
#ifndef belcard_property_hpp
#define belcard_property_hpp
#include <belr/grammarbuilder.hh>
#include <belr/abnf.hh>
#include "belcard_utils.hpp"
#include "belcard/belcard_generic.hpp"
#include "belcard_params.hpp"
#include "belcard/belcard_parser.hpp"
#include <string>
#include <list>
#include <sstream>
namespace belcard {
class BelCardProperty : public BelCardGeneric {
protected:
std::string _group;
std::string _name;
std::string _value;
std::shared_ptr<BelCardLanguageParam> _lang_param;
std::shared_ptr<BelCardValueParam> _value_param;
std::shared_ptr<BelCardPrefParam> _pref_param;
std::shared_ptr<BelCardAlternativeIdParam> _altid_param;
std::shared_ptr<BelCardParamIdParam> _pid_param;
std::shared_ptr<BelCardTypeParam> _type_param;
std::shared_ptr<BelCardMediaTypeParam> _mediatype_param;
std::shared_ptr<BelCardCALSCALEParam> _calscale_param;
std::shared_ptr<BelCardSortAsParam> _sort_as_param;
std::shared_ptr<BelCardGeoParam> _geo_param;
std::shared_ptr<BelCardTimezoneParam> _tz_param;
std::list<std::shared_ptr<BelCardParam>> _params;
public:
template <typename T>
static std::shared_ptr<T> parseProperty(const std::string& rule, const std::string& input) {
size_t parseLength;
std::shared_ptr<BelCardParser> parser = BelCardParser::getInstance();
std::shared_ptr<BelCardGeneric> ret = parser->_parser->parseInput(rule, input, &parseLength);
// -2 because the input is terminated by a new line.
return ret && parseLength == input.length() - 2
? std::dynamic_pointer_cast<T>(ret)
: nullptr;
}
BELCARD_PUBLIC static std::shared_ptr<BelCardProperty> parse(const std::string& input);
BELCARD_PUBLIC static void setHandlerAndCollectors(belr::Parser<std::shared_ptr<BelCardGeneric>> *parser);
BELCARD_PUBLIC BelCardProperty();
BELCARD_PUBLIC virtual void setGroup(const std::string &group);
BELCARD_PUBLIC virtual const std::string &getGroup() const;
BELCARD_PUBLIC virtual void setName(const std::string &name);
BELCARD_PUBLIC virtual const std::string &getName() const;
BELCARD_PUBLIC virtual void setValue(const std::string &value);
BELCARD_PUBLIC virtual const std::string &getValue() const;
BELCARD_PUBLIC virtual void setLanguageParam(const std::shared_ptr<BelCardLanguageParam> ¶m);
BELCARD_PUBLIC virtual const std::shared_ptr<BelCardLanguageParam> &getLanguageParam() const;
BELCARD_PUBLIC virtual void setValueParam(const std::shared_ptr<BelCardValueParam> ¶m);
BELCARD_PUBLIC virtual const std::shared_ptr<BelCardValueParam> &getValueParam() const;
BELCARD_PUBLIC virtual void setPrefParam(const std::shared_ptr<BelCardPrefParam> ¶m);
BELCARD_PUBLIC virtual const std::shared_ptr<BelCardPrefParam> &getPrefParam() const;
BELCARD_PUBLIC virtual void setAlternativeIdParam(const std::shared_ptr<BelCardAlternativeIdParam> ¶m);
BELCARD_PUBLIC virtual const std::shared_ptr<BelCardAlternativeIdParam> &getAlternativeIdParam() const;
BELCARD_PUBLIC virtual void setParamIdParam(const std::shared_ptr<BelCardParamIdParam> ¶m);
BELCARD_PUBLIC virtual const std::shared_ptr<BelCardParamIdParam> &getParamIdParam() const;
BELCARD_PUBLIC virtual void setTypeParam(const std::shared_ptr<BelCardTypeParam> ¶m);
BELCARD_PUBLIC virtual const std::shared_ptr<BelCardTypeParam> &getTypeParam() const;
BELCARD_PUBLIC virtual void setMediaTypeParam(const std::shared_ptr<BelCardMediaTypeParam> ¶m);
BELCARD_PUBLIC virtual const std::shared_ptr<BelCardMediaTypeParam> &getMediaTypeParam() const;
BELCARD_PUBLIC virtual void setCALSCALEParam(const std::shared_ptr<BelCardCALSCALEParam> ¶m);
BELCARD_PUBLIC virtual const std::shared_ptr<BelCardCALSCALEParam> &getCALSCALEParam() const;
BELCARD_PUBLIC virtual void setSortAsParam(const std::shared_ptr<BelCardSortAsParam> ¶m);
BELCARD_PUBLIC virtual const std::shared_ptr<BelCardSortAsParam> &getSortAsParam() const;
BELCARD_PUBLIC virtual void setGeoParam(const std::shared_ptr<BelCardGeoParam> ¶m);
BELCARD_PUBLIC virtual const std::shared_ptr<BelCardGeoParam> &getGeoParam() const;
BELCARD_PUBLIC virtual void setTimezoneParam(const std::shared_ptr<BelCardTimezoneParam> ¶m);
BELCARD_PUBLIC virtual const std::shared_ptr<BelCardTimezoneParam> &getTimezoneParam() const;
BELCARD_PUBLIC virtual void addParam(const std::shared_ptr<BelCardParam> ¶m);
BELCARD_PUBLIC virtual const std::list<std::shared_ptr<BelCardParam>> &getParams() const;
BELCARD_PUBLIC virtual void removeParam(const std::shared_ptr<BelCardParam> ¶m);
BELCARD_PUBLIC virtual void serialize(std::ostream &output) const;
};
}
#endif
|