XML Parser (and supporting constructs) |
Classes | |
class | attribute_set_t |
An associated array based on adobe::token_range_t. A utility class for the xml_parser_t. More... | |
class | line_position_t |
A type detailing parser position information. More... | |
class | stream_error_t |
An exception class thrown during parsing failures. More... | |
class | xml_parser_t< O > |
A relatively lightweight and simple xml (subset) parser. More... | |
Typedefs | |
typedef std::pair< uchar_ptr_t, uchar_ptr_t > | token_range_t |
Functions | |
template<typename I1 , typename I2 , typename BP > | |
bool | bounded_equal (I1 first1, I1 last1, I2 first2, I2 last2, BP pred) |
template<typename I1 , typename I2 > | |
bool | bounded_equal (I1 first1, I1 last1, I2 first2, I2 last2) |
template<typename R1 , typename R2 > | |
bool | bounded_equal (R1 &range1, R2 &range2) |
std::ostream & | operator<< (std::ostream &s, const token_range_t &x) |
template<typename T > | |
token_range_t | static_token_range (T *begin) |
bool | token_range_equal (const token_range_t &x, const token_range_t &y) |
bool | token_range_less (const token_range_t &x, const token_range_t &y) |
Typedef Documentation
typedef std::pair<uchar_ptr_t, uchar_ptr_t> token_range_t |
A range of pointers denoting a token within a character stream.
token_range_t is a utility class mostly used by the in-memory ASL parsers such as xml_parser_t. Token ranges are accompanied by a host of algorithms used to compare them to one another. Because they are a pair of pointers they do not copy any memory dynamically, and so are very fast to construct and copy. The data to which they point could be shared across countless other token_range_t instances, so the modification of the tokens they represent is prohibited.
A NULL-token as it relates to token_range_t is one where both the first and second value are equivalent, but any value. Typically this value is 0, but this is not required.
Definition at line 145 of file lex_shared_fwd.hpp.
Function Documentation
bool adobe::bounded_equal | ( | I1 | first1, |
I1 | last1, | ||
I2 | first2, | ||
I2 | last2, | ||
BP | pred | ||
) |
Compares two ranges of data with a binary predicate.
- Parameters:
-
first1 Iterator to the first element of the first range last1 Iterator to one-past the last element of the first range first2 Iterator to the first element of the second range last2 Iterator to one-past the last element of the second range pred ConvertibleToFunction that models a BinaryPredicate
- Returns:
- When the two ranges are of equal length and pairwise-comparison of the ranges' elements returns true, the function itself returns true. Otherwise, the function returns false.
Definition at line 66 of file lex_shared_fwd.hpp.
bool adobe::bounded_equal | ( | I1 | first1, |
I1 | last1, | ||
I2 | first2, | ||
I2 | last2 | ||
) |
Compares two ranges of data with a default binary predicate (std::equal_to<>()).
- Parameters:
-
first1 Iterator to the first element of the first range last1 Iterator to one-past the last element of the first range first2 Iterator to the first element of the second range last2 Iterator to one-past the last element of the second range
- Returns:
- When the two ranges are of equal length and pairwise-comparison of the ranges' elements returns true, the function itself returns true. Otherwise, the function returns false.
Definition at line 94 of file lex_shared_fwd.hpp.
bool adobe::bounded_equal | ( | R1 & | range1, |
R2 & | range2 | ||
) |
Compares two ranges of data with a default binary predicate (std::equal_to<>()).
- Parameters:
-
range1 Iterator range to the first range range2 Iterator range to the second range
- Returns:
- When the two ranges are of equal length and pairwise-comparison of the ranges' elements returns true, the function itself returns true. Otherwise, the function returns false.
Definition at line 119 of file lex_shared_fwd.hpp.
std::ostream& adobe::operator<< | ( | std::ostream & | s, |
const token_range_t & | x | ||
) |
Serializes a token_range_t to an output stream
- Parameters:
-
s stream to take the token_range_t x the token_range_t to be output to the stream
- Returns:
- the original output stream.
Definition at line 223 of file lex_shared_fwd.hpp.
token_range_t adobe::static_token_range | ( | T * | begin ) |
static_token_range is a utility class that creates an token_range_t from a compile-time NTBS (null-terminated byte string). The precondition for this function is that the token's source is an NTBS that exists at least as long as the token itself. Note that this function does not copy the character range internally, and makes no warranties as to string ownership.
Definition at line 245 of file lex_shared_fwd.hpp.
bool adobe::token_range_equal | ( | const token_range_t & | x, |
const token_range_t & | y | ||
) |
Compares two token ranges for equality.
For two token ranges to be equal their lengths must be the same and a character-by-character comparison of the two ranges must be true.
- Parameters:
-
x the first range to be compared y the second range to be compared
- Returns:
- true when a character-wise comparsion of the two ranges results in equality for each set of characters. false otherwise.
Definition at line 164 of file lex_shared_fwd.hpp.
bool adobe::token_range_less | ( | const token_range_t & | x, |
const token_range_t & | y | ||
) |
Compares two token ranges for strict weak ordering.
Unlike standard string comparison this algorithm optimizes sorting based on the lengths of the tokens involved. If a token is smaller than another it is considered to be "less" than the other. Character-based sorting only takes place when the length of the two tokens is the same. When this is the case the algorithm sorts the tokens in the same manner as adobe::mismatch.
- Parameters:
-
x the first range to be compared y the second range to be compared
- Returns:
- true when:
- the first range is smaller in length than the second range, or
- in the case when the ranges are the same length, that the character at the point when the two ranges differ is smaller in the first range.
- (false otherwise.)
Definition at line 194 of file lex_shared_fwd.hpp.