lsst.pex.policy
13.0-1-g47a359c+18
|
a representation of a string containing Policy parameter data More...
#include <PolicyString.h>
Public Member Functions | |
PolicyString (const std::string &data, const SupportedFormats::Ptr &fmts=defaultFormats) | |
create a PolicyString that's wrapped around a given string. More... | |
PolicyString (const SupportedFormats::Ptr &fmts=defaultFormats) | |
create a "null" Policy formed from an empty string. More... | |
const std::string & | getData () const |
return the wrapped policy data as a string More... | |
virtual const std::string & | getFormatName () |
return the name of the format that the data is stored in. More... | |
const std::string & | getFormatName () const |
return the name of the format that the data is stored in. More... | |
virtual void | load (Policy &policy) |
load the data from this Policy source into a Policy object More... | |
void | load (Policy &policy) const |
load the data from this Policy source into a Policy object More... | |
![]() | |
PolicySource (SupportedFormats::Ptr fmts=defaultFormats) | |
create a Policy file that points a file with given path. More... | |
virtual | ~PolicySource () |
destroy the source More... | |
Static Public Attributes | |
static const boost::regex | SPACE_RE |
static const boost::regex | COMMENT |
reg-exp for an empty line More... | |
static const boost::regex | CONTENTID |
reg-exp for the start of a comment More... | |
![]() | |
static SupportedFormats::Ptr | defaultFormats |
returns true if the given string containing a content identifier indicates that it contains dictionary data. More... | |
Protected Attributes | |
std::string | _data |
the policy data More... | |
![]() | |
SupportedFormats::Ptr | _formats |
a representation of a string containing Policy parameter data
This class facilitates reading data from a string. This class is especially useful for supporting string I/O from Python. The data is encoded in a supported format (just like the contents of a policy file).
Definition at line 52 of file PolicyString.h.
|
explicit |
create a PolicyString that's wrapped around a given string.
data | the path to the file, either as a string or a boost::filesystem::path instance |
fmts | a SupportedFormats object to use. An instance encapsulates a configured set of known formats. |
lsst::pex::policy::PolicyString::PolicyString | ( | const SupportedFormats::Ptr & | fmts = defaultFormats | ) |
create a "null" Policy formed from an empty string.
fmts | a SupportedFormats object to use. An instance encapsulates a configured set of known formats. |
|
inline |
return the wrapped policy data as a string
Definition at line 75 of file PolicyString.h.
|
virtual |
return the name of the format that the data is stored in.
This may cause the first few records of the source to be read. In this implementation, once the format is definitely determined, the format name is cached internally, preventing re-determination on the next call to this function.
IOError | if an error occurs while reading the first few characters of the source stream. |
Implements lsst::pex::policy::PolicySource.
|
inline |
return the name of the format that the data is stored in.
This may cause the first few records of the source to be read. In this implementation, once the format is definitely determined, the format name is cached internally, preventing re-determination on the next call to this function.
IOError | if an error occurs while reading the first few characters of the source stream. |
Definition at line 88 of file PolicyString.h.
|
virtual |
load the data from this Policy source into a Policy object
policy | the policy object to load the data into |
ParserException | if an error occurs while parsing the data |
IOError | if an I/O error occurs while reading from the source stream. |
Implements lsst::pex::policy::PolicySource.
|
inlinevirtual |
load the data from this Policy source into a Policy object
policy | the policy object to load the data into |
ParserException | if an error occurs while parsing the data |
IOError | if an I/O error occurs while reading from the source stream. |
Implements lsst::pex::policy::PolicySource.
Definition at line 102 of file PolicyString.h.
|
protected |
the policy data
Definition at line 118 of file PolicyString.h.
|
static |
reg-exp for an empty line
Definition at line 108 of file PolicyString.h.
|
static |
reg-exp for the start of a comment
reg-exp for a Policy content identifier, "<?cfg [format] [content] ?>"
Definition at line 112 of file PolicyString.h.
|
static |
Definition at line 107 of file PolicyString.h.