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);
static const boost::regex SPACE_RE
definition of the PolicyParser class
definition of the PolicyFile class
static const std::string FORMAT_NAME
static const boost::regex CONTENTID
reg-exp for the start of a comment
definition of Policy-specific exceptions classes
const std::string & cacheName(const std::string &name)
PolicyParserFactory::Ptr _pfact
definition of Policy parsing exceptions
SupportedFormats::Ptr _formats
definition of the PAFParserFactory class
virtual const std::string & getFormatName()
static const boost::regex COMMENT
reg-exp for an empty line
#define LSST_EXCEPT(type,...)
boost::shared_ptr< PolicyParserFactory > Ptr
definition of the PolicyString class
virtual void load(Policy &policy)
PolicyString(const std::string &data, const SupportedFormats::Ptr &fmts=defaultFormats)