OSDN Git Service

FIRST REPOSITORY
[eos/hostdependOTHERS.git] / I386LINUX / util / I386LINUX / include / vtk / vtkXMLFileReadTester.h
1 /*=========================================================================
2
3   Program:   Visualization Toolkit
4   Module:    $RCSfile: vtkXMLFileReadTester.h,v $
5   Language:  C++
6   Date:      $Date: 2002/10/16 18:23:06 $
7   Version:   $Revision: 1.1 $
8
9   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 
10   All rights reserved.
11   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
12
13      This software is distributed WITHOUT ANY WARRANTY; without even 
14      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
15      PURPOSE.  See the above copyright notice for more information.
16
17 =========================================================================*/
18 // .NAME vtkXMLFileReadTester - Utility class for vtkXMLReader and subclasses.
19 // .SECTION Description
20 // vtkXMLFileReadTester reads the smallest part of a file necessary to
21 // determine whether it is a VTK XML file.  If so, it extracts the
22 // file type and version number.
23
24 #ifndef __vtkXMLFileReadTester_h
25 #define __vtkXMLFileReadTester_h
26
27 #include "vtkXMLParser.h"
28
29 class VTK_IO_EXPORT vtkXMLFileReadTester: public vtkXMLParser
30 {
31 public:
32   vtkTypeRevisionMacro(vtkXMLFileReadTester,vtkXMLParser);
33   void PrintSelf(ostream& os, vtkIndent indent);  
34   static vtkXMLFileReadTester* New();
35   
36   // Description:
37   // Try to read the file given by FileName.  Returns 1 if the file is
38   // a VTK XML file, and 0 otherwise.
39   int TestReadFile();
40   
41   // Description:
42   // Get/Set the name of the file tested by TestReadFile().
43   vtkSetStringMacro(FileName);
44   vtkGetStringMacro(FileName);
45   
46   // Description:
47   // Get the data type of the XML file tested.  If the file could not
48   // be read, returns NULL.
49   vtkGetStringMacro(FileDataType);
50   
51   // Description:
52   // Get the file version of the XML file tested.  If the file could not
53   // be read, returns NULL.
54   vtkGetStringMacro(FileVersion);
55   
56 protected:
57   vtkXMLFileReadTester();
58   ~vtkXMLFileReadTester();
59   
60   void StartElement(const char* name, const char** atts);
61   int ParsingComplete();
62   void ReportStrayAttribute(const char*, const char*, const char*) {}
63   void ReportMissingAttribute(const char*, const char*) {}
64   void ReportBadAttribute(const char*, const char*, const char*) {}
65   void ReportUnknownElement(const char*) {}
66   void ReportXmlParseError() {}
67   
68   char* FileName;
69   char* FileDataType;
70   char* FileVersion;
71   int Done;
72   
73   vtkSetStringMacro(FileDataType);
74   vtkSetStringMacro(FileVersion);
75   
76 private:
77   vtkXMLFileReadTester(const vtkXMLFileReadTester&);  // Not implemented.
78   void operator=(const vtkXMLFileReadTester&);  // Not implemented.
79 };
80
81 #endif