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 =========================================================================*/
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,
45  ostream &output, int output_encoding,
46  int special_entities = 0);
47 
56  ostream&,
57  const char *sep = nullptr);
58 
70  ostream&,
71  vtkIndent *indent = nullptr,
72  int indent_attributes = 1);
73 
80  const char *filename,
81  vtkIndent *indent = nullptr);
82 
84 
96  istream&, int encoding = VTK_ENCODING_NONE);
98  const char *str, int encoding = VTK_ENCODING_NONE);
100  const char *filename, int encoding = VTK_ENCODING_NONE);
102 
112  vtkXMLDataElement *element,
113  const char** atts,
114  int encoding);
115 
125  vtkXMLDataElement *tree,
126  vtkXMLDataElement ***results);
127 
129 
134  static void FactorElements(vtkXMLDataElement *tree);
137 
138 protected:
140  ~vtkXMLUtilities() override {}
141 
143  vtkXMLDataElement *root,
144  vtkXMLDataElement *pool);
146  vtkXMLDataElement *pool);
147 
148 private:
149  vtkXMLUtilities(const vtkXMLUtilities&) = delete;
150  void operator=(const vtkXMLUtilities&) = delete;
151 };
152 
153 #endif
154 
155 
156 // VTK-HeaderTest-Exclude: vtkXMLUtilities.h
vtkXMLUtilities
XML utilities.
Definition: vtkXMLUtilities.h:33
VTK_ENCODING_NONE
#define VTK_ENCODING_NONE
Definition: vtkSystemIncludes.h:140
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:60
vtkXMLUtilities::FlattenElement
static void FlattenElement(vtkXMLDataElement *, ostream &, vtkIndent *indent=nullptr, int indent_attributes=1)
Flatten a vtkXMLDataElement to a stream, i.e.
vtkXMLUtilities::New
static vtkXMLUtilities * New()
vtkXMLUtilities::EncodeString
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_...
vtkXMLUtilities::WriteElementToFile
static int WriteElementToFile(vtkXMLDataElement *, const char *filename, vtkIndent *indent=nullptr)
Write a vtkXMLDataElement to a file (in a flattened textual form) Note that the resulting character-e...
vtkXMLUtilities::ReadElementFromStream
static vtkXMLDataElement * ReadElementFromStream(istream &, int encoding=VTK_ENCODING_NONE)
Read a vtkXMLDataElement from a stream, string or file.
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:40
vtkXMLUtilities::FactorElements
static void FactorElements(vtkXMLDataElement *tree)
Factor and unfactor a tree.
vtkXMLUtilities::FindSimilarElements
static int FindSimilarElements(vtkXMLDataElement *elem, vtkXMLDataElement *tree, vtkXMLDataElement ***results)
Find all elements in 'tree' that are similar to 'elem' (using the vtkXMLDataElement::IsEqualTo() pred...
vtkXMLDataElement
Represents an XML element and those nested inside.
Definition: vtkXMLDataElement.h:37
vtkObject.h
vtkXMLUtilities::ReadElementFromAttributeArray
static void ReadElementFromAttributeArray(vtkXMLDataElement *element, const char **atts, int encoding)
Sets attributes of an element from an array of encoded attributes.
vtkXMLUtilities::vtkXMLUtilities
vtkXMLUtilities()
Definition: vtkXMLUtilities.h:139
vtkXMLUtilities::~vtkXMLUtilities
~vtkXMLUtilities() override
Definition: vtkXMLUtilities.h:140
vtkXMLUtilities::UnFactorElementsInternal
static int UnFactorElementsInternal(vtkXMLDataElement *tree, vtkXMLDataElement *pool)
vtkXMLUtilities::ReadElementFromString
static vtkXMLDataElement * ReadElementFromString(const char *str, int encoding=VTK_ENCODING_NONE)
vtkXMLUtilities::UnFactorElements
static void UnFactorElements(vtkXMLDataElement *tree)
vtkXMLUtilities::CollateAttributes
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...
vtkXMLUtilities::ReadElementFromFile
static vtkXMLDataElement * ReadElementFromFile(const char *filename, int encoding=VTK_ENCODING_NONE)
vtkXMLUtilities::FactorElementsInternal
static int FactorElementsInternal(vtkXMLDataElement *tree, vtkXMLDataElement *root, vtkXMLDataElement *pool)