00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00023 #ifndef __vtkXMLUtilities_h
00024 #define __vtkXMLUtilities_h
00025
00026 #include "vtkObject.h"
00027
00028 class vtkXMLDataElement;
00029
00030 class VTK_IO_EXPORT vtkXMLUtilities : public vtkObject
00031 {
00032 public:
00033 static vtkXMLUtilities* New();
00034 vtkTypeRevisionMacro(vtkXMLUtilities, vtkObject);
00035
00037
00040 static void EncodeString(const char *input, int input_encoding,
00041 ostream &output, int output_encoding,
00042 int special_entities = 0);
00044
00046
00051 static void CollateAttributes(vtkXMLDataElement*,
00052 ostream&,
00053 const char *sep = 0);
00055
00056
00058
00065 static void FlattenElement(vtkXMLDataElement*,
00066 ostream&,
00067 vtkIndent *indent = 0,
00068 int indent_attributes = 1);
00070
00072
00075 static int WriteElementToFile(vtkXMLDataElement*,
00076 const char *filename,
00077 vtkIndent *indent = 0);
00078
00080
00082
00091 static vtkXMLDataElement* ReadElementFromStream(
00092 istream&, int encoding = VTK_ENCODING_NONE);
00093 static vtkXMLDataElement* ReadElementFromString(
00094 const char *str, int encoding = VTK_ENCODING_NONE);
00095 static vtkXMLDataElement* ReadElementFromFile(
00096 const char *filename, int encoding = VTK_ENCODING_NONE);
00097
00099
00101
00107 static int FindSimilarElements(vtkXMLDataElement *elem,
00108 vtkXMLDataElement *tree,
00109 vtkXMLDataElement ***results);
00110
00112
00114
00117 static void FactorElements(vtkXMLDataElement *tree);
00118 static void UnFactorElements(vtkXMLDataElement *tree);
00120
00121 protected:
00122 vtkXMLUtilities() {};
00123 ~vtkXMLUtilities() {};
00124
00125 static int FactorElementsInternal(vtkXMLDataElement *tree,
00126 vtkXMLDataElement *root,
00127 vtkXMLDataElement *pool);
00128 static int UnFactorElementsInternal(vtkXMLDataElement *tree,
00129 vtkXMLDataElement *pool);
00130
00131 private:
00132 vtkXMLUtilities(const vtkXMLUtilities&);
00133 void operator=(const vtkXMLUtilities&);
00134 };
00135
00136 #endif
00137
00138