VTK  9.2.6
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  void PrintSelf(ostream& os, vtkIndent indent) override;
38 
45  static void EncodeString(const char* input, int input_encoding, ostream& output,
46  int output_encoding, int special_entities = 0);
47 
55  static void CollateAttributes(vtkXMLDataElement*, ostream&, const char* sep = nullptr);
56 
67  static void FlattenElement(
68  vtkXMLDataElement*, ostream&, vtkIndent* indent = nullptr, int indent_attributes = 1);
69 
75  static int WriteElementToFile(
76  vtkXMLDataElement*, VTK_FILEPATH const char* filename, vtkIndent* indent = nullptr);
77 
79 
91  static vtkXMLDataElement* ReadElementFromStream(istream&, int encoding = VTK_ENCODING_NONE);
93  static vtkXMLDataElement* ReadElementFromString(
94  const char* str, int encoding = VTK_ENCODING_NONE);
96  static vtkXMLDataElement* ReadElementFromFile(
97  VTK_FILEPATH const char* filename, int encoding = VTK_ENCODING_NONE);
99 
108  static void ReadElementFromAttributeArray(
109  vtkXMLDataElement* element, const char** atts, int encoding);
110 
119  static int FindSimilarElements(
120  vtkXMLDataElement* elem, vtkXMLDataElement* tree, vtkXMLDataElement*** results);
121 
123 
128  static void FactorElements(vtkXMLDataElement* tree);
129  static void UnFactorElements(vtkXMLDataElement* tree);
131 
132 protected:
133  vtkXMLUtilities() = default;
134  ~vtkXMLUtilities() override = default;
135 
136  static int FactorElementsInternal(
138  static int UnFactorElementsInternal(vtkXMLDataElement* tree, vtkXMLDataElement* pool);
139 
140 private:
141  vtkXMLUtilities(const vtkXMLUtilities&) = delete;
142  void operator=(const vtkXMLUtilities&) = delete;
143 };
144 
145 #endif
XML utilities.
abstract base class for most VTK objects
Definition: vtkObject.h:62
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:39
#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...