aboutsummaryrefslogtreecommitdiff
path: root/examples/cxx/tree/custom/mixed/people-custom.hxx
blob: 54dfb21db5b80d6827b168f45c2ba6dbe7ab4f67 (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
75
76
77
78
79
80
81
82
83
// file      : examples/cxx/tree/custom/mixed/people-custom.hxx
// copyright : not copyrighted - public domain

// Do not include this file directly, use people.hxx instead. This
// file is included into generated people.hxx so we do not need to
// guard against multiple inclusions.
//

#include <cassert>
#include <xercesc/dom/DOM.hpp>

namespace people
{
  class bio: public bio_base
  {
    // Standard constructors.
    //
  public:
    bio ();

    bio (const xercesc::DOMElement&,
         xml_schema::flags = 0,
         xml_schema::container* = 0);

    bio (const bio&,
         xml_schema::flags = 0,
         xml_schema::container* = 0);

    virtual bio*
    _clone (xml_schema::flags = 0,
            xml_schema::container* = 0) const;

    // XHTML bio as a DOM document.
    //
  public:
    const xercesc::DOMElement*
    xhtml () const
    {
      return xhtml_;
    }

    xercesc::DOMElement*
    xhtml ()
    {
      return xhtml_;
    }

    // The element should belong to the DOMDocument returned by
    // the dom_document() functions.
    //
    void
    xhtml (xercesc::DOMElement* e)
    {
      assert (e->getOwnerDocument () == doc_.get ());

      if (xhtml_ != 0)
        xhtml_->release ();

      xhtml_ = e;
    }

    const xercesc::DOMDocument&
    dom_document () const
    {
      return *doc_;
    }

    xercesc::DOMDocument&
    dom_document ()
    {
      return *doc_;
    }

  private:
    xercesc::DOMElement* xhtml_;
    xml_schema::dom::auto_ptr<xercesc::DOMDocument> doc_;
  };

  // Serialization operator.
  //
  void
  operator<< (xercesc::DOMElement&, const bio&);
}