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 =========================================================================*/
24 #ifndef vtkXMLUtilities_h
25 #define vtkXMLUtilities_h
26 
27 #include "vtkIOXMLParserModule.h" // For export macro
28 #include "vtkObject.h"
29 
30 class vtkXMLDataElement;
31 
32 class VTKIOXMLPARSER_EXPORT vtkXMLUtilities : public vtkObject
33 {
34 public:
35  static vtkXMLUtilities* New();
36  vtkTypeMacro(vtkXMLUtilities, vtkObject);
37 
44  static void EncodeString(const char *input, int input_encoding,
45  ostream &output, int output_encoding,
46  int special_entities = 0);
47 
55  static void CollateAttributes(vtkXMLDataElement*,
56  ostream&,
57  const char *sep = 0);
58 
69  static void FlattenElement(vtkXMLDataElement*,
70  ostream&,
71  vtkIndent *indent = 0,
72  int indent_attributes = 1);
73 
79  static int WriteElementToFile(vtkXMLDataElement*,
80  const char *filename,
81  vtkIndent *indent = 0);
82 
84 
95  static vtkXMLDataElement* ReadElementFromStream(
96  istream&, int encoding = VTK_ENCODING_NONE);
97  static vtkXMLDataElement* ReadElementFromString(
98  const char *str, int encoding = VTK_ENCODING_NONE);
99  static vtkXMLDataElement* ReadElementFromFile(
100  const char *filename, int encoding = VTK_ENCODING_NONE);
102 
111  static void ReadElementFromAttributeArray(
112  vtkXMLDataElement *element,
113  const char** atts,
114  int encoding);
115 
124  static int FindSimilarElements(vtkXMLDataElement *elem,
125  vtkXMLDataElement *tree,
126  vtkXMLDataElement ***results);
127 
129 
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&) VTK_DELETE_FUNCTION;
150  void operator=(const vtkXMLUtilities&) VTK_DELETE_FUNCTION;
151 };
152 
153 #endif
154 
155 
156 // VTK-HeaderTest-Exclude: vtkXMLUtilities.h
XML utilities.
abstract base class for most VTK objects
Definition: vtkObject.h:59
Represents an XML element and those nested inside.
a simple class to control print indentation
Definition: vtkIndent.h:39
#define VTK_ENCODING_NONE
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...