~ubuntu-branches/ubuntu/maverick/aspectc++/maverick

« back to all changes in this revision

Viewing changes to AspectC++/RepoXMLDoc.h

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2008-04-10 17:40:52 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20080410174052-xdnsm7oi8hauyyf1
Tags: 1.0pre4~svn.20080409+dfsg-3
Fix another missing include, this time in Ag++/StdSystem.cc

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
#include "RepoXMLNode.h"
23
23
 
 
24
#include <fcntl.h>
 
25
#include <unistd.h>
 
26
 
 
27
#include <libxml/xmlsave.h>
 
28
 
24
29
class RepoXMLDoc {
25
30
  xmlDocPtr _doc;
 
31
  int fd;
26
32
public:
27
33
  RepoXMLDoc () : _doc (0) {}
28
34
  ~RepoXMLDoc () {
37
43
                                   (const xmlChar*)root_name, NULL);
38
44
  }
39
45
  RepoXMLNode root () const { return _doc->children; }
 
46
  bool load_fd (int fd, const char *name) {
 
47
    _doc = xmlReadFd (fd, name, 0,
 
48
                      XML_PARSE_NODICT | XML_PARSE_NOERROR |
 
49
                      XML_PARSE_NOWARNING | XML_PARSE_NOBLANKS);
 
50
    return (_doc != 0);
 
51
  }
40
52
  bool load (const char *name) {
41
53
    _doc = xmlReadFile (name, 0,
42
54
                         XML_PARSE_NODICT | XML_PARSE_NOERROR |
43
55
                         XML_PARSE_NOWARNING | XML_PARSE_NOBLANKS);
44
56
    return (_doc != 0);
45
57
  }
 
58
  bool save_fd (int fd) {
 
59
    xmlSaveCtxtPtr ctx = xmlSaveToFd (fd, 0, XML_SAVE_FORMAT);
 
60
    if (xmlSaveDoc (ctx, _doc) == -1)
 
61
      return false;
 
62
    return (xmlSaveClose (ctx) != -1);
 
63
  }
46
64
  bool save (const char *name) {
47
65
    return (xmlSaveFormatFile (name, _doc, 1) != -1);
48
66
  }