30 #include <boost/scoped_ptr.hpp>
48 using boost::regex_match;
49 using boost::regex_search;
50 using boost::scoped_ptr;
53 namespace pexExcept = lsst::pex::exceptions;
67 : PolicySource(fmts), Persistable(), _data(), _pfact()
77 : PolicySource(fmts), Persistable(), _data(data), _pfact()
80 #define PolStr_ERROR_MSG(use, msg, input) \
81 std::ostringstream use; \
82 use << msg << ": '"; \
83 if (input.length() > 40) \
86 use << input.substr(0,40) << "..."; \
98 std::istringstream is(
_data);
100 PolStr_ERROR_MSG(msg,
"failure opening input Policy string",
_data);
113 PolStr_ERROR_MSG(msg,
"failure reading input Policy string",
_data);
136 if (! pfactory.get()) {
138 if (fmtname.empty()) {
139 PolStr_ERROR_MSG(ms,
"Unknown Policy format for string data",
_data);
142 pfactory =
_formats->getFactory(fmtname);
145 scoped_ptr<PolicyParser> parser(pfactory->createParser(policy));
147 std::istringstream is(
_data);
149 PolStr_ERROR_MSG(msg,
"failure opening Policy string",
_data);
const std::string & cacheName(const std::string &name)
definition of the PolicyParser class
definition of the PolicyFile class
virtual void load(Policy &policy)
definition of Policy-specific exceptions classes
PolicyParserFactory::Ptr _pfact
definition of Policy parsing exceptions
static const boost::regex COMMENT
reg-exp for an empty line
virtual const std::string & getFormatName()
SupportedFormats::Ptr _formats
definition of the PAFParserFactory class
PolicyString(const std::string &data, const SupportedFormats::Ptr &fmts=defaultFormats)
static const boost::regex CONTENTID
reg-exp for the start of a comment
#define LSST_EXCEPT(type,...)
static const boost::regex SPACE_RE
boost::shared_ptr< PolicyParserFactory > Ptr
static const std::string FORMAT_NAME
definition of the PolicyString class