idaeim studio
 PVL: Parameter Value Language

Classes | Functions
idaeim::PVL Namespace Reference

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.
Listeroperator<< (std::ostream &out, Lister &lister)
 Output operator.
std::ostream & operator<< (std::ostream &out, const Parameter &parameter)
 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 &parameter)
 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.

Detailed Description

Parameter Value Language.


Function Documentation

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.

Parameters:
outThe ostream to be bound to the lister.
listerThe Lister to be bound.
Returns:
This lister.
See also:
Lister::output_stream(std::ostream&)
Lister::operator<<(const Parameter&)
Lister::operator<<(const Value&)
std::ostream& idaeim::PVL::operator<< ( std::ostream &  out,
const Parameter &  parameter 
)

Writes a Parameter on an output stream using PVL syntax.

Parameters:
outThe ostream to receive the PVL syntax.
parameterThe Parameter to be described.
Returns:
The ostream.
See also:
Lister::write(const Parameter&, int)
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.

Parameters:
inThe istream to be parsed for PVL syntax.
parameterThe Parameter to be assigned the Parameter definition that is read.
Returns:
The istream.
See also:
Parameter::read(Parser&)
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.

Parameters:
list_iteratorThe Aggregate::iterator to compare against.
depth_iteratorThe Depth_Iterator to compare against.
Returns:
true if the Depth_Iterator is not greater than or equal to the list iterator; false otherwise.
See also:
operator<(const Aggregate::iterator&)
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.

Parameters:
commentThe string to be written in a comment sequence.
outThe ostream where the output will be written.
depthThe indent depth to apply.
single_lineWhether to use single line (true) or multi-line commenting mode.
Returns:
The total number of bytes written.
See also:
Lister::write_comment(const std::string, int)
Lister::single_line_comments(const bool, const Lister::Which_Mode&)
Lister::flush(int)
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.

Parameters:
pathnameA Parameter pathname string.
Returns:
The basename substring from the pathname.
See also:
Parameter::path_delimiter()
Parameter::pathname(const Parameter*) const
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.

Parameters:
pathnameA Parameter pathname string.
Returns:
The leading path name substring from the pathname.
See also:
pathname(const Parameter*)
Parameter::path_delimiter()
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).

Parameters:
beginThe Aggregate::iterator for the first Parameter where sorting begins.
endThe Aggregate::iterator for the position after the last Parameter where sorting ends.
See also:
Parameter::operator<(const Parameter&) const

A bubble sort is applied, in place, using the less than (<) comparison for the Values in the interator range [begin, end).

Parameters:
beginThe Array::iterator for the first Value where sorting begins.
endThe Array::iterator for the position after the last Value where sorting ends.
See also:
Value::operator<(const Value&) const
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.

Parameters:
beginThe Aggregate::Depth_Iterator for the first Parameter where sorting begins.
endThe Aggregate::Depth_Iterator for the position after the last Parameter where sorting ends.
Exceptions:
Invalid_ArgumentIf the begin and end iterators are not positioned in the same Parameter list.
See also:
sort(Aggregate::iterator, Aggregate::iterator)
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.

Parameters:
nameThe name string to check.
Returns:
The Parameter::Type code associated with the name; or 0 if the name is not a special Parameter name.
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.

Parameters:
a_stringThe string to be translated.
Returns:
The translated string.
See also:
String::escape_to_special(Index, Index)
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.

Parameters:
a_stringThe string to be translated in place.
Returns:
The translated string reference.
See also:
String::special_to_escape()
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.

Parameters:
a_stringThe string to check.
Returns:
The index of the first reserved character found in the string, or string::npos if no reserved characters were found.
std::ostream& idaeim::PVL::operator<< ( std::ostream &  out,
const Value &  value 
)

Writes the Value to an ostream.

The Value is written with the indent depth set to 0.

Parameters:
outThe ostream to which the PVL syntax will be written.
valueThe Value to be written.
Returns:
The ostream.
See also:
Value::write(std::ostream&, int)
std::istream& idaeim::PVL::operator>> ( std::istream &  in,
Value &  value 
)

Reads an input stream parsed as PVL syntax into a Value.

Parameters:
inThe istream to be parsed for PVL syntax.
valueThe Value to be assigned the Value definition that is read.
Returns:
The in instream.
See also:
read(Parser&)
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.

Parameters:
list_iteratorThe Array::iterator to compare against.
depth_iteratorThe Depth_Iterator to compare against.
Returns:
true if the Depth_Iterator is not greater than or equal to the list iterator; false otherwise.
See also:
operator<(const Array::iterator&)
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.

Parameters:
beginThe Array::Depth_Iterator for the first Value where sorting begins.
endThe Array::Depth_Iterator for the position after the last Value where sorting ends.
Exceptions:
Invalid_ArgumentIf the begin and end iterators are not positioned in the same Value list.
See also:
sort(Array::iterator, Array::iterator)