PVL: Parameter Value Language
|
Parameter Value Language. More...
Classes | |
class | Aggregate |
An Aggregate implements a Parameter that is a list of Parameters. More... | |
struct | Aggregate_Closure_Mismatch |
Aggregate closure mismatch. More... | |
class | Array |
An Array implements a Value that is a list of Values. More... | |
struct | Array_Closure_Mismatch |
Array closure mismatch. More... | |
class | Assignment |
An Assignment implements a Parameter than contains a Value. More... | |
class | Integer |
An Integer implements a Value with an integer datum. More... | |
struct | Invalid_Aggregate_Value |
Invalid Aggregate Value. More... | |
class | Invalid_Syntax |
Invalid_Syntax is the base class for PVL exceptions. More... | |
struct | Invalid_Value |
Invalid Value. More... | |
class | Lister |
A Lister is used to manage the listing of PVL objects. More... | |
struct | Missing_Comment_End |
Missing comment end. More... | |
struct | Missing_Quote_End |
Missing quote end. More... | |
struct | Missing_Units_End |
Missing units end. More... | |
struct | Multiline_Comment |
Multiline comment. More... | |
class | Parameter |
A Parameter is a general-purpose, abstract, named parameter entity. More... | |
class | Parser |
A Parser interprets the characters of a Sliding_String as a sequence of Parameter Value Language (PVL) syntax statements. More... | |
class | Real |
A Real implements a Value with a floating point datum. More... | |
struct | Reserved_Character |
Reserved character found. More... | |
class | String |
A String implements a Value with a character string datum. More... | |
class | Value |
A Value is a general-purpose, abstract value entity. More... | |
Functions | |
std::string | basename (const std::string &pathname) |
Gets the basename portion of a pathname. | |
bool | operator< (const Array::iterator &list_iterator, const Array::Depth_Iterator &depth_iterator) |
Tests if the position of an Array list iterator is less than the positon of a Depth_Iterator. | |
bool | operator< (const Aggregate::iterator &list_iterator, const Aggregate::Depth_Iterator &depth_iterator) |
Tests if the position of an Aggregate list iterator is less than the positon of a Depth_Iterator. | |
Lister & | operator<< (std::ostream &out, Lister &lister) |
Output operator. | |
std::ostream & | operator<< (std::ostream &out, const Parameter ¶meter) |
Writes a Parameter on an output stream using PVL syntax. | |
std::ostream & | operator<< (std::ostream &out, const Value &value) |
Writes the Value to an ostream. | |
std::istream & | operator>> (std::istream &in, Parameter ¶meter) |
Reads an input stream parsed as PVL syntax into a Parameter. | |
std::istream & | operator>> (std::istream &in, Value &value) |
Reads an input stream parsed as PVL syntax into a Value. | |
std::string | pathname_to (const std::string &pathname) |
Gets the leading path name portion of a pathname. | |
std::string::size_type | reserved_character (const std::string &a_string) |
Checks a string for any character reserved by the PVL syntax. | |
void | sort (Aggregate::iterator begin, Aggregate::iterator end) |
Sorts an Aggregate's list iterator range. | |
void | sort (Array::depth_iterator begin, Array::depth_iterator end) |
Sorts the Values in the iterator range, and all Values in all Arrays contained within the range. | |
void | sort (Aggregate::depth_iterator begin, Aggregate::depth_iterator end) |
Sorts the Parameters in the iterator range, and all Parameters in all Aggregates contained within the range. | |
Parameter::Type | special_type (const std::string &name) |
Gets the Parameter::Type code corresponding to the specified name. | |
std::string & | translate_from_escape_sequences (std::string &a_string) |
Translates escape sequences in a string to their corresponding special characters. | |
std::string & | translate_to_escape_sequences (std::string &a_string) |
Translates special characters in a string to their corresponding escape sequences. | |
int | write_comment (const std::string &comment, std::ostream &out=std::cout, int depth=0, bool single_line=false) |
Writes a PVL comment sequence. |
Parameter Value Language.
Lister& idaeim::PVL::operator<< | ( | std::ostream & | out, |
Lister & | lister | ||
) |
Output operator.
Used to bind a leading ostream to this Lister and a following Parameter or Value. For example:
cout << lister.single_line_comments (true).page_width (64) << parameter;
N.B.: The leading ostream, and any applied syntax modes, remain bound to the lister. Thus, after the example above:
lister << aggregate;
will list all elements of the aggregate to cout with single line comments and a page width of 64 characters.
out | The ostream to be bound to the lister. |
lister | The Lister to be bound. |
std::ostream& idaeim::PVL::operator<< | ( | std::ostream & | out, |
const Parameter & | parameter | ||
) |
Writes a Parameter on an output stream using PVL syntax.
std::istream& idaeim::PVL::operator>> | ( | std::istream & | in, |
Parameter & | parameter | ||
) |
Reads an input stream parsed as PVL syntax into a Parameter.
N.B.: If the Parser operating behind the scene encounters a PVL::Exception the failbit of the istream is set, but no exception is thrown. To obtain details about the cause of an input failure construct a Parser on the istream and use the read method directly.
in | The istream to be parsed for PVL syntax. |
parameter | The Parameter to be assigned the Parameter definition that is read. |
bool idaeim::PVL::operator< | ( | const Aggregate::iterator & | list_iterator, |
const Aggregate::Depth_Iterator & | depth_iterator | ||
) | [inline] |
Tests if the position of an Aggregate list iterator is less than the positon of a Depth_Iterator.
list_iterator | The Aggregate::iterator to compare against. |
depth_iterator | The Depth_Iterator to compare against. |
int idaeim::PVL::write_comment | ( | const std::string & | comment, |
std::ostream & | out = std::cout , |
||
int | depth = 0 , |
||
bool | single_line = false |
||
) |
Writes a PVL comment sequence.
A default Lister, with the single line comments mode set to the single_line value, is used to write the comment string. Unless the depth is negative, the output will be completed with an end-of-line sequence; but the output is always flushed in any case.
Note: If the comment string is empty, no comment sequence is written.
comment | The string to be written in a comment sequence. |
out | The ostream where the output will be written. |
depth | The indent depth to apply. |
single_line | Whether to use single line (true) or multi-line commenting mode. |
std::string idaeim::PVL::basename | ( | const std::string & | pathname | ) |
Gets the basename portion of a pathname.
The basename is the portion of the string following the last path delimiter character. If the pathname ends with a sequence of one or more path delimiter characters, these characters are ignored and dropped from the result.
pathname | A Parameter pathname string. |
std::string idaeim::PVL::pathname_to | ( | const std::string & | pathname | ) |
Gets the leading path name portion of a pathname.
The leading path name is the portion of the string up to and including the last path delimiter character (or sequence of these characters, but only one will be included in the result). If the pathname does not contain a path delimiter character, then the empty string is returned.
pathname | A Parameter pathname string. |
void sort | ( | Aggregate::iterator | begin, |
Aggregate::iterator | end | ||
) |
Sorts an Aggregate's list iterator range.
Sorts an Array's list iterator range.
A bubble sort is applied, in place, using the less than (<) comparison for the Parameters in the interator range [begin, end).
begin | The Aggregate::iterator for the first Parameter where sorting begins. |
end | The Aggregate::iterator for the position after the last Parameter where sorting ends. |
A bubble sort is applied, in place, using the less than (<) comparison for the Values in the interator range [begin, end).
begin | The Array::iterator for the first Value where sorting begins. |
end | The Array::iterator for the position after the last Value where sorting ends. |
void idaeim::PVL::sort | ( | Aggregate::depth_iterator | begin, |
Aggregate::depth_iterator | end | ||
) |
Sorts the Parameters in the iterator range, and all Parameters in all Aggregates contained within the range.
This is a "deep" sort in that not only are the Parameters in the Aggregate of the iterator range sorted, but each Aggregate within the range has all of its Parameters sorted. Each Aggregate has its Parameters sorted independently (Parameters never leave their containing Aggregate). Though the iterator range is defined by a pair of Depth_Iterators, which are used to traverse the entire Aggregate hierarchy, they must both be positioned in the Parameter list of the same Aggregate which thus defines the range of Parameters to be sorted in the starting Aggregate.
begin | The Aggregate::Depth_Iterator for the first Parameter where sorting begins. |
end | The Aggregate::Depth_Iterator for the position after the last Parameter where sorting ends. |
Invalid_Argument | If the begin and end iterators are not positioned in the same Parameter list. |
Parameter::Type idaeim::PVL::special_type | ( | const std::string & | name | ) |
Gets the Parameter::Type code corresponding to the specified name.
The special Parameter names and their Type codes are:
Begin_Object - OBJECT
BeginObject - OBJECT
Object - OBJECT
End_Object - END_OBJECT
EndObject - END_OBJECT
Begin_Group - GROUP
BeginGroup - GROUP
Group - GROUP
End_Group - END_GROUP
EndGroup - END_GROUP
End - END
The names are not case senstive.
name | The name string to check. |
std::string& idaeim::PVL::translate_from_escape_sequences | ( | std::string & | a_string | ) |
Translates escape sequences in a string to their corresponding special characters.
The String::escape_to_special() method is used to translate escape sequences to special characters. However the occurance of Parser::VERBATIM_STRING_DELIMITERS starts a sequence of characters that are taken verbatim (they are not translated) up to the next Parser::VERBATIM_STRING_DELIMITERS or the end of the string. The Parser::VERBATIM_STRING_DELIMITERS are dropped.
a_string | The string to be translated. |
std::string& idaeim::PVL::translate_to_escape_sequences | ( | std::string & | a_string | ) |
Translates special characters in a string to their corresponding escape sequences.
In addition to the special characters translated by the String::special_to_escape() method, the Parser::TEXT_DELIMITER and Parser::SYMBOL_DELIMITER characters are also escaped. The occurance of Parser::VERBATIM_STRING_DELIMITERS starts a sequence of characters that are taken verbatim (they are not translated) up to and including the next Parser::VERBATIM_STRING_DELIMITERS or the end of the string.
a_string | The string to be translated in place. |
std::string::size_type idaeim::PVL::reserved_character | ( | const std::string & | a_string | ) |
Checks a string for any character reserved by the PVL syntax.
A reserved character is one of the Parser::RESERVED_CHARACTERS or a non-printable character.
a_string | The string to check. |
std::ostream& idaeim::PVL::operator<< | ( | std::ostream & | out, |
const Value & | value | ||
) |
std::istream& idaeim::PVL::operator>> | ( | std::istream & | in, |
Value & | value | ||
) |
bool idaeim::PVL::operator< | ( | const Array::iterator & | list_iterator, |
const Array::Depth_Iterator & | depth_iterator | ||
) | [inline] |
Tests if the position of an Array list iterator is less than the positon of a Depth_Iterator.
list_iterator | The Array::iterator to compare against. |
depth_iterator | The Depth_Iterator to compare against. |
void idaeim::PVL::sort | ( | Array::depth_iterator | begin, |
Array::depth_iterator | end | ||
) |
Sorts the Values in the iterator range, and all Values in all Arrays contained within the range.
This is a "deep" sort in that not only are the Values in the Array of the iterator range sorted, but each Array within the range has all of its Values sorted. Each Array has its Values sorted independently (Values never leave their containing Array). Though the iterator range is defined by a pair of Depth_Iterators, which are used to traverse the entire Array hierarchy, they must both be positioned in the Value list of the same Array which thus defines the range of Values to be sorted in the starting Array.
begin | The Array::Depth_Iterator for the first Value where sorting begins. |
end | The Array::Depth_Iterator for the position after the last Value where sorting ends. |
Invalid_Argument | If the begin and end iterators are not positioned in the same Value list. |