b311480e |
1 | // Created on: 2001-06-28 |
2 | // Created by: Alexander GRIGORIEV |
973c2be1 |
3 | // Copyright (c) 2001-2014 OPEN CASCADE SAS |
b311480e |
4 | // |
973c2be1 |
5 | // This file is part of Open CASCADE Technology software library. |
b311480e |
6 | // |
d5f74e42 |
7 | // This library is free software; you can redistribute it and/or modify it under |
8 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
9 | // by the Free Software Foundation, with special exception defined in the file |
10 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
11 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
12 | // |
973c2be1 |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
7fd59977 |
15 | |
16 | #ifndef LDOM_XmlWriter_HeaderFile |
17 | #define LDOM_XmlWriter_HeaderFile |
18 | |
4ff92abe |
19 | #include <Standard_OStream.hxx> |
7fd59977 |
20 | #include <Standard_TypeDef.hxx> |
21 | #include <stdio.h> |
22 | |
7fd59977 |
23 | class LDOM_Document; |
24 | class LDOM_Node; |
25 | class LDOMBasicString; |
26 | |
27 | class LDOM_XmlWriter |
28 | { |
4ff92abe |
29 | public: |
7fd59977 |
30 | |
4ff92abe |
31 | Standard_EXPORT LDOM_XmlWriter (const char* theEncoding = NULL); |
32 | |
7fd59977 |
33 | Standard_EXPORT ~LDOM_XmlWriter (); |
7fd59977 |
34 | |
7fd59977 |
35 | // Set indentation for output (by default 0) |
4ff92abe |
36 | void SetIndentation (const Standard_Integer theIndent) { myIndent = theIndent; } |
7fd59977 |
37 | |
4ff92abe |
38 | Standard_EXPORT void Write (Standard_OStream& theOStream, const LDOM_Document& theDoc); |
7fd59977 |
39 | |
7fd59977 |
40 | // Stream out a DOM node, and, recursively, all of its children. This |
41 | // function is the heart of writing a DOM tree out as XML source. Give it |
42 | // a document node and it will do the whole thing. |
4ff92abe |
43 | Standard_EXPORT void Write (Standard_OStream& theOStream, const LDOM_Node& theNode); |
7fd59977 |
44 | |
4ff92abe |
45 | private: |
7fd59977 |
46 | |
47 | LDOM_XmlWriter (const LDOM_XmlWriter& anOther); |
7fd59977 |
48 | |
49 | LDOM_XmlWriter& operator = (const LDOM_XmlWriter& anOther); |
4ff92abe |
50 | |
51 | void Write (Standard_OStream& theOStream, const LDOMBasicString& theString); |
52 | void Write (Standard_OStream& theOStream, const char* theString); |
53 | void Write (Standard_OStream& theOStream, const char theChar); |
54 | |
55 | void WriteAttribute (Standard_OStream& theOStream, const LDOM_Node& theAtt); |
7fd59977 |
56 | |
57 | private: |
58 | |
4ff92abe |
59 | char* myEncodingName; |
60 | Standard_Integer myIndent; |
61 | Standard_Integer myCurIndent; |
62 | char* myABuffer; |
63 | Standard_Integer myABufferLen; |
7fd59977 |
64 | }; |
65 | |
66 | #endif |