| 1 |
// file : cutl/xml/parser.ixx |
| 2 |
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC |
| 3 |
// license : MIT; see accompanying LICENSE file |
| 4 |
|
| 5 |
#include <cutl/xml/value-traits.hxx> |
| 6 |
|
| 7 |
namespace cutl |
| 8 |
{ |
| 9 |
namespace xml |
| 10 |
{ |
| 11 |
inline const std::string& parser:: |
| 12 |
attribute (const std::string& n) const |
| 13 |
{ |
| 14 |
return attribute (qname_type (n)); |
| 15 |
} |
| 16 |
|
| 17 |
template <typename T> |
| 18 |
inline T parser:: |
| 19 |
attribute (const std::string& n) const |
| 20 |
{ |
| 21 |
return attribute<T> (qname_type (n)); |
| 22 |
} |
| 23 |
|
| 24 |
inline std::string parser:: |
| 25 |
attribute (const std::string& n, const std::string& dv) const |
| 26 |
{ |
| 27 |
return attribute (qname_type (n), dv); |
| 28 |
} |
| 29 |
|
| 30 |
template <typename T> |
| 31 |
inline T parser:: |
| 32 |
attribute (const std::string& n, const T& dv) const |
| 33 |
{ |
| 34 |
return attribute<T> (qname_type (n), dv); |
| 35 |
} |
| 36 |
|
| 37 |
template <typename T> |
| 38 |
inline T parser:: |
| 39 |
attribute (const qname_type& qn) const |
| 40 |
{ |
| 41 |
return value_traits<T>::parse (attribute (qn), *this); |
| 42 |
} |
| 43 |
|
| 44 |
inline bool parser:: |
| 45 |
attribute_present (const std::string& n) const |
| 46 |
{ |
| 47 |
return attribute_present (qname_type (n)); |
| 48 |
} |
| 49 |
|
| 50 |
inline const parser::attribute_map_type& parser:: |
| 51 |
attribute_map () const |
| 52 |
{ |
| 53 |
if (const element_entry* e = get_element ()) |
| 54 |
{ |
| 55 |
e->attr_unhandled_ = 0; // Assume all handled. |
| 56 |
return e->attr_map_; |
| 57 |
} |
| 58 |
|
| 59 |
return empty_attr_map_; |
| 60 |
} |
| 61 |
|
| 62 |
inline void parser:: |
| 63 |
next_expect (event_type e, const qname_type& qn) |
| 64 |
{ |
| 65 |
return next_expect (e, qn.namespace_ (), qn.name ()); |
| 66 |
} |
| 67 |
|
| 68 |
inline void parser:: |
| 69 |
next_expect (event_type e, const std::string& n) |
| 70 |
{ |
| 71 |
return next_expect (e, std::string (), n); |
| 72 |
} |
| 73 |
} |
| 74 |
} |