Integration of OCCT 6.5.0 from SVN
[occt.git] / src / LDOM / LDOM_XmlWriter.hxx
1 // File:      LDOM_XmlWriter.hxx
2 // Created:   28.06.01 10:26:52
3 // Author:    Alexander GRIGORIEV
4 // Copyright: OpenCascade 2001
5
6
7 #ifndef LDOM_XmlWriter_HeaderFile
8 #define LDOM_XmlWriter_HeaderFile
9
10 #include <Standard_TypeDef.hxx>
11 #include <stdio.h>
12
13 typedef char LXMLCh;
14
15 class LDOM_Document;
16 class LDOM_Node;
17 class LDOMBasicString;
18
19 class LDOM_XmlWriter
20 {
21  public:
22
23   Standard_EXPORT LDOM_XmlWriter (FILE * aFile, const char * theEncoding= NULL);
24   // Constructor
25
26   Standard_EXPORT ~LDOM_XmlWriter ();
27   // Destructor
28
29   void SetIndentation (const Standard_Integer theIndent) { myIndent=theIndent; }
30   // Set indentation for output (by default 0)
31
32   Standard_EXPORT LDOM_XmlWriter& operator<<    (const LDOM_Document& aDoc);
33
34   Standard_EXPORT LDOM_XmlWriter& operator<<    (const LDOM_Node& toWrite);
35   //  ostream << DOM_Node   
36   //  Stream out a DOM node, and, recursively, all of its children. This
37   //  function is the heart of writing a DOM tree out as XML source. Give it
38   //  a document node and it will do the whole thing.
39
40  private:
41
42   void  WriteAttribute (const LDOM_Node& theAtt);
43
44   LDOM_XmlWriter& operator<< (const LDOMBasicString&);
45   //  Stream out LDOM String
46
47   inline LDOM_XmlWriter& operator<< (const LXMLCh * toWrite);
48   //  Stream out a character string. Doing this requires that we first transcode
49   //  to char * form in the default code page for the system
50
51   inline LDOM_XmlWriter& operator <<    (const LXMLCh aChar);
52
53   LDOM_XmlWriter (const LDOM_XmlWriter& anOther);
54   //    Copy constructor - prohibited
55
56   LDOM_XmlWriter& operator = (const LDOM_XmlWriter& anOther);
57   //    Assignment operator - prohibited
58
59  private:
60
61   FILE                          * myFile;
62   LXMLCh                        * myEncodingName;
63   Standard_Integer              myIndent;
64   Standard_Integer              myCurIndent;
65   char *                        myABuffer;      // for WriteAttribute()
66   Standard_Integer              myABufferLen;   // for WriteAttribute()
67 };
68
69 #endif