VTK
vtkXMLUtilities.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkXMLUtilities.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
23 #ifndef vtkXMLUtilities_h
24 #define vtkXMLUtilities_h
25 
26 #include "vtkIOXMLParserModule.h" // For export macro
27 #include "vtkObject.h"
28 
29 class vtkXMLDataElement;
30 
32 {
33 public:
34  static vtkXMLUtilities* New();
35  vtkTypeMacro(vtkXMLUtilities, vtkObject);
36 
38 
41  static void EncodeString(const char *input, int input_encoding,
42  ostream &output, int output_encoding,
43  int special_entities = 0);
45 
47 
52  static void CollateAttributes(vtkXMLDataElement*,
53  ostream&,
54  const char *sep = 0);
56 
57  //BTX
59 
66  static void FlattenElement(vtkXMLDataElement*,
67  ostream&,
68  vtkIndent *indent = 0,
69  int indent_attributes = 1);
71 
73 
76  static int WriteElementToFile(vtkXMLDataElement*,
77  const char *filename,
78  vtkIndent *indent = 0);
79  //ETX
81 
82  //BTX
84 
93  static vtkXMLDataElement* ReadElementFromStream(
94  istream&, int encoding = VTK_ENCODING_NONE);
95  static vtkXMLDataElement* ReadElementFromString(
96  const char *str, int encoding = VTK_ENCODING_NONE);
97  static vtkXMLDataElement* ReadElementFromFile(
98  const char *filename, int encoding = VTK_ENCODING_NONE);
99  //ETX
101 
103 
110  static void ReadElementFromAttributeArray(
111  vtkXMLDataElement *element,
112  const char** atts,
113  int encoding);
115 
116  //BTX
118 
124  static int FindSimilarElements(vtkXMLDataElement *elem,
125  vtkXMLDataElement *tree,
126  vtkXMLDataElement ***results);
127  //ETX
129 
131 
134  static void FactorElements(vtkXMLDataElement *tree);
135  static void UnFactorElements(vtkXMLDataElement *tree);
137 
138 protected:
141 
142  static int FactorElementsInternal(vtkXMLDataElement *tree,
143  vtkXMLDataElement *root,
144  vtkXMLDataElement *pool);
145  static int UnFactorElementsInternal(vtkXMLDataElement *tree,
146  vtkXMLDataElement *pool);
147 
148 private:
149  vtkXMLUtilities(const vtkXMLUtilities&); // Not implemented
150  void operator=(const vtkXMLUtilities&); // Not implemented
151 };
152 
153 #endif
154 
155 
156 // VTK-HeaderTest-Exclude: vtkXMLUtilities.h
XML utilities.
#define VTKIOXMLPARSER_EXPORT
abstract base class for most VTK objects
Definition: vtkObject.h:61
Represents an XML element and those nested inside.
a simple class to control print indentation
Definition: vtkIndent.h:38
#define VTK_ENCODING_NONE
static vtkObject * New()