VTK  9.3.1
vtkXMLUtilities.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
12 #ifndef vtkXMLUtilities_h
13 #define vtkXMLUtilities_h
14 
15 #include "vtkIOXMLParserModule.h" // For export macro
16 #include "vtkObject.h"
17 
18 VTK_ABI_NAMESPACE_BEGIN
19 class vtkXMLDataElement;
20 
21 class VTKIOXMLPARSER_EXPORT vtkXMLUtilities : public vtkObject
22 {
23 public:
24  static vtkXMLUtilities* New();
25  vtkTypeMacro(vtkXMLUtilities, vtkObject);
26  void PrintSelf(ostream& os, vtkIndent indent) override;
27 
34  static void EncodeString(const char* input, int input_encoding, ostream& output,
35  int output_encoding, int special_entities = 0);
36 
44  static void CollateAttributes(vtkXMLDataElement*, ostream&, const char* sep = nullptr);
45 
56  static void FlattenElement(
57  vtkXMLDataElement*, ostream&, vtkIndent* indent = nullptr, int indent_attributes = 1);
58 
64  static int WriteElementToFile(
65  vtkXMLDataElement*, VTK_FILEPATH const char* filename, vtkIndent* indent = nullptr);
66 
68 
80  static vtkXMLDataElement* ReadElementFromStream(istream&, int encoding = VTK_ENCODING_NONE);
82  static vtkXMLDataElement* ReadElementFromString(
83  const char* str, int encoding = VTK_ENCODING_NONE);
85  static vtkXMLDataElement* ReadElementFromFile(
86  VTK_FILEPATH const char* filename, int encoding = VTK_ENCODING_NONE);
88 
97  static void ReadElementFromAttributeArray(
98  vtkXMLDataElement* element, const char** atts, int encoding);
99 
108  static int FindSimilarElements(
109  vtkXMLDataElement* elem, vtkXMLDataElement* tree, vtkXMLDataElement*** results);
110 
112 
117  static void FactorElements(vtkXMLDataElement* tree);
118  static void UnFactorElements(vtkXMLDataElement* tree);
120 
121 protected:
122  vtkXMLUtilities() = default;
123  ~vtkXMLUtilities() override = default;
124 
125  static int FactorElementsInternal(
127  static int UnFactorElementsInternal(vtkXMLDataElement* tree, vtkXMLDataElement* pool);
128 
129 private:
130  vtkXMLUtilities(const vtkXMLUtilities&) = delete;
131  void operator=(const vtkXMLUtilities&) = delete;
132 };
133 
134 VTK_ABI_NAMESPACE_END
135 #endif
XML utilities.
abstract base class for most VTK objects
Definition: vtkObject.h:51
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
Represents an XML element and those nested inside.
a simple class to control print indentation
Definition: vtkIndent.h:28
#define VTK_ENCODING_NONE
#define VTK_NEWINSTANCE
#define VTK_FILEPATH
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...