aboutsummaryrefslogtreecommitdiff
path: root/examples/cxx/hybrid/evolution/passthrough/unknown-type-pimpl.hxx
blob: 1faa088409f46b7ce5c70df104a2d8b527a9df63 (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
// file      : examples/cxx/hybrid/evolution/passthrough/unknown-type-pimpl.hxx
// copyright : not copyrighted - public domain

#ifndef UNKNOWN_TYPE_PIMPL_HXX
#define UNKNOWN_TYPE_PIMPL_HXX

namespace transform
{
  // Customized unknown_type parser implementation.
  //
  class unknown_type_pimpl: public unknown_type_base_pimpl
  {
  public:
    virtual void
    _pre ();

    // Wildcard content callbacks. All the unknown content is routed
    // to these functions. We use them to construct the raw XML
    // representation of the unknown transformation.
    //
    virtual void
    _start_any_element (const xml_schema::ro_string& ns,
                        const xml_schema::ro_string& name,
                        const char* type);

    virtual void
    _end_any_element (const xml_schema::ro_string& ns,
                      const xml_schema::ro_string& name);

    virtual void
    _any_attribute (const xml_schema::ro_string& ns,
                    const xml_schema::ro_string& name,
                    const xml_schema::ro_string& value);

    virtual void
    _any_characters (const xml_schema::ro_string&);

    // Low-level content callbacks. These are normally implemented by
    // the generated parsers. However, we need to intercept them and
    // re-route the known elements and attributes to the base parser
    // and the unknown content to the wildcard callbacks above.
    //
    virtual void
    _start_element (const xml_schema::ro_string& ns,
                        const xml_schema::ro_string& name,
                        const char* type);

    virtual void
    _end_element (const xml_schema::ro_string& ns,
                      const xml_schema::ro_string& name);

    virtual void
    _attribute (const xml_schema::ro_string& ns,
                    const xml_schema::ro_string& name,
                    const xml_schema::ro_string& value);

    virtual void
    _characters (const xml_schema::ro_string&);

  private:
    xml::element* cur_;
  };
}

#endif // UNKNOWN_TYPE_PIMPL_HXX