Main Page | Directories | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

vtkXMLUtilities.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkXMLUtilities.h,v $
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00033 #ifndef __vtkXMLUtilities_h
00034 #define __vtkXMLUtilities_h
00035 
00036 #include "vtkObject.h"
00037 
00038 class vtkXMLDataElement;
00039 
00040 class VTK_IO_EXPORT vtkXMLUtilities : public vtkObject
00041 {
00042 public:
00043   static vtkXMLUtilities* New();
00044   vtkTypeRevisionMacro(vtkXMLUtilities, vtkObject);
00045 
00047 
00050   static void EncodeString(const char *input, int input_encoding, 
00051                            ostream &output, int output_encoding,
00052                            int special_entities = 0);
00054 
00056 
00061   static void CollateAttributes(vtkXMLDataElement*, 
00062                                 ostream&, 
00063                                 const char *sep = 0);
00065 
00066   //BTX
00068 
00075   static void FlattenElement(vtkXMLDataElement*, 
00076                              ostream&, 
00077                              vtkIndent *indent = 0,
00078                              int indent_attributes = 1);
00080 
00082 
00085   static int WriteElementToFile(vtkXMLDataElement*, 
00086                                 const char *filename, 
00087                                 vtkIndent *indent = 0);
00088   //ETX
00090 
00092 
00101   static vtkXMLDataElement* ReadElementFromStream(
00102     istream&, int encoding = VTK_ENCODING_NONE);
00103   static vtkXMLDataElement* ReadElementFromString(
00104     const char *str, int encoding = VTK_ENCODING_NONE);
00105   static vtkXMLDataElement* ReadElementFromFile(
00106     const char *filename, int encoding = VTK_ENCODING_NONE);
00107   //ETX
00109 
00111 
00117   static int FindSimilarElements(vtkXMLDataElement *elem, 
00118                                  vtkXMLDataElement *tree, 
00119                                  vtkXMLDataElement ***results);
00120   //ETX
00122 
00124 
00127   static void FactorElements(vtkXMLDataElement *tree);
00128   static void UnFactorElements(vtkXMLDataElement *tree);
00130 
00131 protected:  
00132   vtkXMLUtilities() {};
00133   ~vtkXMLUtilities() {};
00134   
00135   static int FactorElementsInternal(vtkXMLDataElement *tree, 
00136                                     vtkXMLDataElement *root, 
00137                                     vtkXMLDataElement *pool);
00138   static int UnFactorElementsInternal(vtkXMLDataElement *tree, 
00139                                       vtkXMLDataElement *pool);
00140 
00141 private:
00142   vtkXMLUtilities(const vtkXMLUtilities&); // Not implemented
00143   void operator=(const vtkXMLUtilities&); // Not implemented    
00144 };
00145 
00146 #endif
00147 
00148