~ubuntu-branches/ubuntu/wily/afnix/wily

« back to all changes in this revision

Viewing changes to src/mod/xml/shl/XmlTexter.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Anibal Monsalve Salazar
  • Date: 2011-03-16 21:31:18 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20110316213118-gk4k3ez3e5d2huna
Tags: 2.0.0-1
* QA upload.
* New upstream release
* Debian source format is 3.0 (quilt)
* Fix debhelper-but-no-misc-depends
* Fix ancient-standards-version
* Fix package-contains-linda-override
* debhelper compatibility is 7
* Fix dh-clean-k-is-deprecated

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
// - the copyright holder be liable for any  direct, indirect, incidental or -
12
12
// - special damages arising in any way out of the use of this software.     -
13
13
// ---------------------------------------------------------------------------
14
 
// - copyright (c) 1999-2007 amaury darsch                                   -
 
14
// - copyright (c) 1999-2011 amaury darsch                                   -
15
15
// ---------------------------------------------------------------------------
16
16
 
17
17
#include "XmlRoot.hpp"
37
37
    XmlBuffer xbuf;
38
38
    try {
39
39
      // loop as long as we have a valid stream
40
 
      while (xis.valid () == true) xbuf.add (xis.rduc ());
 
40
      while (xis.valid () == true) xbuf.add (xis.getu ());
41
41
      // create a xml text node
42
42
      XmlNode* result = new XmlText (xbuf.totext ());
43
43
      // here it is
77
77
 
78
78
  XmlTexter::~XmlTexter (void) {
79
79
    reset ();
80
 
    Object::dref (p_root);
81
80
  }
82
81
 
83
82
  // return the document class name
86
85
    return "XmlTexter";
87
86
  }
88
87
 
89
 
  // make this document shared
90
 
 
91
 
  void XmlTexter::mksho (void) {
92
 
    if (p_shared != nilp) return;
93
 
    Object::mksho ();
94
 
    if (p_root != nilp) p_root->mksho ();
95
 
  }
96
 
 
97
88
  // reset this texter
98
89
 
99
90
  void XmlTexter::reset (void) {
100
91
    wrlock ();
 
92
    Object::iref (this);
101
93
    try {
 
94
      if (p_root != nilp) p_root->release ();
102
95
      Object::dref (p_root);
103
96
      p_root = nilp;
 
97
      Object::tref (this);
104
98
      unlock ();
105
99
    } catch (...) {
 
100
      Object::tref (this);
106
101
      unlock ();
107
102
      throw;
108
103
    }
119
114
 
120
115
  // parse the input stream
121
116
 
122
 
  void XmlTexter::parse (Input* is) {
 
117
  void XmlTexter::parse (InputStream* is) {
123
118
    // check the input stream
124
119
    if (is == nilp) return;
125
120
    // create a xml stream
155
150
 
156
151
  void XmlTexter::parse (const String& value) {
157
152
    // create an input stream
158
 
    Input* is = new InputString (value);
 
153
    InputStream* is = new InputString (value);
159
154
    // lock and parse
160
155
    wrlock ();
161
156
    try {
233
228
        Object* obj = argv->get (0);
234
229
        if (obj == nilp) return nilp;
235
230
        // check for an input stream
236
 
        Input* is = dynamic_cast <Input*> (obj);
 
231
        InputStream* is = dynamic_cast <InputStream*> (obj);
237
232
        if (is != nilp) {
238
233
          parse (is);
239
234
          return nilp;