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 "vtkObject.h"
27 
28 class vtkXMLDataElement;
29 
31 {
32 public:
33  static vtkXMLUtilities* New();
34  vtkTypeMacro(vtkXMLUtilities, vtkObject);
35 
37 
40  static void EncodeString(const char *input, int input_encoding,
41  ostream &output, int output_encoding,
42  int special_entities = 0);
44 
46 
51  static void CollateAttributes(vtkXMLDataElement*,
52  ostream&,
53  const char *sep = 0);
55 
56  //BTX
58 
65  static void FlattenElement(vtkXMLDataElement*,
66  ostream&,
67  vtkIndent *indent = 0,
68  int indent_attributes = 1);
70 
72 
75  static int WriteElementToFile(vtkXMLDataElement*,
76  const char *filename,
77  vtkIndent *indent = 0);
78  //ETX
80 
81  //BTX
83 
92  static vtkXMLDataElement* ReadElementFromStream(
93  istream&, int encoding = VTK_ENCODING_NONE);
94  static vtkXMLDataElement* ReadElementFromString(
95  const char *str, int encoding = VTK_ENCODING_NONE);
96  static vtkXMLDataElement* ReadElementFromFile(
97  const char *filename, int encoding = VTK_ENCODING_NONE);
98  //ETX
100 
102 
109  static void ReadElementFromAttributeArray(
110  vtkXMLDataElement *element,
111  const char** atts,
112  int encoding);
114 
115  //BTX
117 
123  static int FindSimilarElements(vtkXMLDataElement *elem,
124  vtkXMLDataElement *tree,
125  vtkXMLDataElement ***results);
126  //ETX
128 
130 
133  static void FactorElements(vtkXMLDataElement *tree);
134  static void UnFactorElements(vtkXMLDataElement *tree);
136 
137 protected:
140 
141  static int FactorElementsInternal(vtkXMLDataElement *tree,
142  vtkXMLDataElement *root,
143  vtkXMLDataElement *pool);
144  static int UnFactorElementsInternal(vtkXMLDataElement *tree,
145  vtkXMLDataElement *pool);
146 
147 private:
148  vtkXMLUtilities(const vtkXMLUtilities&); // Not implemented
149  void operator=(const vtkXMLUtilities&); // Not implemented
150 };
151 
152 #endif
153 
154