VTK  9.3.20240423
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
18VTK_ABI_NAMESPACE_BEGIN
20
21class VTKIOXMLPARSER_EXPORT vtkXMLUtilities : public vtkObject
22{
23public:
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
65 vtkXMLDataElement*, VTK_FILEPATH const char* filename, vtkIndent* indent = nullptr);
66
68
83 const char* str, int encoding = VTK_ENCODING_NONE);
86 VTK_FILEPATH const char* filename, int encoding = VTK_ENCODING_NONE);
88
98 vtkXMLDataElement* element, const char** atts, int encoding);
99
109 vtkXMLDataElement* elem, vtkXMLDataElement* tree, vtkXMLDataElement*** results);
110
112
120
121protected:
122 vtkXMLUtilities() = default;
123 ~vtkXMLUtilities() override = default;
124
128
129private:
130 vtkXMLUtilities(const vtkXMLUtilities&) = delete;
131 void operator=(const vtkXMLUtilities&) = delete;
132};
133
134VTK_ABI_NAMESPACE_END
135#endif
a simple class to control print indentation
Definition vtkIndent.h:108
abstract base class for most VTK objects
Definition vtkObject.h:162
Represents an XML element and those nested inside.
XML utilities.
static int UnFactorElementsInternal(vtkXMLDataElement *tree, vtkXMLDataElement *pool)
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static void ReadElementFromAttributeArray(vtkXMLDataElement *element, const char **atts, int encoding)
Sets attributes of an element from an array of encoded attributes.
static int FactorElementsInternal(vtkXMLDataElement *tree, vtkXMLDataElement *root, vtkXMLDataElement *pool)
static void FlattenElement(vtkXMLDataElement *, ostream &, vtkIndent *indent=nullptr, int indent_attributes=1)
Flatten a vtkXMLDataElement to a stream, i.e.
static vtkXMLDataElement * ReadElementFromStream(istream &, int encoding=VTK_ENCODING_NONE)
Read a vtkXMLDataElement from a stream, string or file.
static int WriteElementToFile(vtkXMLDataElement *, VTK_FILEPATH const char *filename, vtkIndent *indent=nullptr)
Write a vtkXMLDataElement to a file (in a flattened textual form) Note that the resulting character-e...
static void CollateAttributes(vtkXMLDataElement *, ostream &, const char *sep=nullptr)
Collate a vtkXMLDataElement's attributes to a stream as a series of name="value" pairs (the separator...
static void FactorElements(vtkXMLDataElement *tree)
Factor and unfactor a tree.
static vtkXMLUtilities * New()
~vtkXMLUtilities() override=default
static vtkXMLDataElement * ReadElementFromFile(VTK_FILEPATH const char *filename, int encoding=VTK_ENCODING_NONE)
Read a vtkXMLDataElement from a stream, string or file.
static vtkXMLDataElement * ReadElementFromString(const char *str, int encoding=VTK_ENCODING_NONE)
Read a vtkXMLDataElement from a stream, string or file.
static int FindSimilarElements(vtkXMLDataElement *elem, vtkXMLDataElement *tree, vtkXMLDataElement ***results)
Find all elements in 'tree' that are similar to 'elem' (using the vtkXMLDataElement::IsEqualTo() pred...
vtkXMLUtilities()=default
static void UnFactorElements(vtkXMLDataElement *tree)
Factor and unfactor a tree.
static void EncodeString(const char *input, int input_encoding, ostream &output, int output_encoding, int special_entities=0)
Encode a string from one format to another (see VTK_ENCODING_... constants).
#define VTK_ENCODING_NONE
#define VTK_FILEPATH
#define VTK_NEWINSTANCE