VTK  9.0.1
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, ostream& output,
45  int output_encoding, int special_entities = 0);
46 
54  static void CollateAttributes(vtkXMLDataElement*, ostream&, const char* sep = nullptr);
55 
66  static void FlattenElement(
67  vtkXMLDataElement*, ostream&, vtkIndent* indent = nullptr, int indent_attributes = 1);
68 
74  static int WriteElementToFile(
75  vtkXMLDataElement*, const char* filename, vtkIndent* indent = nullptr);
76 
78 
89  static vtkXMLDataElement* ReadElementFromStream(istream&, int encoding = VTK_ENCODING_NONE);
90  static vtkXMLDataElement* ReadElementFromString(
91  const char* str, int encoding = VTK_ENCODING_NONE);
92  static vtkXMLDataElement* ReadElementFromFile(
93  const char* filename, int encoding = VTK_ENCODING_NONE);
95 
104  static void ReadElementFromAttributeArray(
105  vtkXMLDataElement* element, const char** atts, int encoding);
106 
115  static int FindSimilarElements(
116  vtkXMLDataElement* elem, vtkXMLDataElement* tree, vtkXMLDataElement*** results);
117 
119 
124  static void FactorElements(vtkXMLDataElement* tree);
125  static void UnFactorElements(vtkXMLDataElement* tree);
127 
128 protected:
130  ~vtkXMLUtilities() override {}
131 
132  static int FactorElementsInternal(
134  static int UnFactorElementsInternal(vtkXMLDataElement* tree, vtkXMLDataElement* pool);
135 
136 private:
137  vtkXMLUtilities(const vtkXMLUtilities&) = delete;
138  void operator=(const vtkXMLUtilities&) = delete;
139 };
140 
141 #endif
142 
143 // VTK-HeaderTest-Exclude: vtkXMLUtilities.h
vtkXMLUtilities
XML utilities.
Definition: vtkXMLUtilities.h:32
VTK_ENCODING_NONE
#define VTK_ENCODING_NONE
Definition: vtkSystemIncludes.h:127
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:62
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkXMLDataElement
Represents an XML element and those nested inside.
Definition: vtkXMLDataElement.h:36
vtkObject.h
vtkXMLUtilities::vtkXMLUtilities
vtkXMLUtilities()
Definition: vtkXMLUtilities.h:129
vtkXMLUtilities::~vtkXMLUtilities
~vtkXMLUtilities() override
Definition: vtkXMLUtilities.h:130