44 using boost::regex_match;
45 using boost::regex_search;
63 : PolicySource(fmts), Persistable(), _data(), _pfact() {}
71 : PolicySource(fmts), Persistable(), _data(data), _pfact() {}
73 #define PolStr_ERROR_MSG(use, msg, input) \ 74 std::ostringstream use; \ 75 use << msg << ": '"; \ 76 if (input.length() > 40) \ 79 use << input.substr(0, 40) << "..."; \ 92 PolStr_ERROR_MSG(msg,
"failure opening input Policy string", _data);
104 PolStr_ERROR_MSG(msg,
"failure reading input Policy string", _data);
112 return cacheName(_formats->recognizeType(line));
124 if (!pfactory.get()) {
125 const string& fmtname = getFormatName();
126 if (fmtname.empty()) {
127 PolStr_ERROR_MSG(ms,
"Unknown Policy format for string data", _data);
130 pfactory = _formats->getFactory(fmtname);
137 PolStr_ERROR_MSG(msg,
"failure opening Policy string", _data);
definition of the PolicyParser class
definition of the PolicyFile class
virtual void load(Policy &policy)
load the data from this Policy source into a Policy object
a class for creating PAFParser objects
definition of Policy parsing exceptions
static const boost::regex COMMENT
reg-exp for an empty line
virtual const std::string & getFormatName()
return the name of the format that the data is stored in.
std::shared_ptr< PolicyParserFactory > Ptr
definition of the PAFParserFactory class
definition of Policy-specific exceptions classes
PolicyString(const std::string &data, const SupportedFormats::Ptr &fmts=defaultFormats)
create a PolicyString that's wrapped around a given string.
static const boost::regex CONTENTID
reg-exp for the start of a comment
#define LSST_EXCEPT(type,...)
static const boost::regex SPACE_RE
T regex_search(T... args)
static const std::string FORMAT_NAME
a name for the format
definition of the PolicyString class