summaryrefslogtreecommitdiff
path: root/libcutl/cutl/xml/parser.ixx
blob: 65834b63f34a8adfe380196269b4f08a51476fa6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// file      : cutl/xml/parser.ixx
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC
// license   : MIT; see accompanying LICENSE file

#include <cutl/xml/value-traits.hxx>

namespace cutl
{
  namespace xml
  {
    inline const std::string& parser::
    attribute (const std::string& n) const
    {
      return attribute (qname_type (n));
    }

    template <typename T>
    inline T parser::
    attribute (const std::string& n) const
    {
      return attribute<T> (qname_type (n));
    }

    inline std::string parser::
    attribute (const std::string& n, const std::string& dv) const
    {
      return attribute (qname_type (n), dv);
    }

    template <typename T>
    inline T parser::
    attribute (const std::string& n, const T& dv) const
    {
      return attribute<T> (qname_type (n), dv);
    }

    template <typename T>
    inline T parser::
    attribute (const qname_type& qn) const
    {
      return value_traits<T>::parse (attribute (qn), *this);
    }

    inline bool parser::
    attribute_present (const std::string& n) const
    {
      return attribute_present (qname_type (n));
    }

    inline const parser::attribute_map_type& parser::
    attribute_map () const
    {
      if (const element_entry* e = get_element ())
      {
        e->attr_unhandled_ = 0; // Assume all handled.
        return e->attr_map_;
      }

      return empty_attr_map_;
    }

    inline void parser::
    next_expect (event_type e, const qname_type& qn)
    {
      return next_expect (e, qn.namespace_ (), qn.name ());
    }

    inline void parser::
    next_expect (event_type e, const std::string& n)
    {
      return next_expect (e, std::string (), n);
    }
  }
}