1 /*=========================================================================
3 Program: Visualization Toolkit
4 Module: $RCSfile: vtkXMLFileReadTester.h,v $
6 Date: $Date: 2002/10/16 18:23:06 $
7 Version: $Revision: 1.1 $
9 Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen
11 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
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.
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.
24 #ifndef __vtkXMLFileReadTester_h
25 #define __vtkXMLFileReadTester_h
27 #include "vtkXMLParser.h"
29 class VTK_IO_EXPORT vtkXMLFileReadTester: public vtkXMLParser
32 vtkTypeRevisionMacro(vtkXMLFileReadTester,vtkXMLParser);
33 void PrintSelf(ostream& os, vtkIndent indent);
34 static vtkXMLFileReadTester* New();
37 // Try to read the file given by FileName. Returns 1 if the file is
38 // a VTK XML file, and 0 otherwise.
42 // Get/Set the name of the file tested by TestReadFile().
43 vtkSetStringMacro(FileName);
44 vtkGetStringMacro(FileName);
47 // Get the data type of the XML file tested. If the file could not
48 // be read, returns NULL.
49 vtkGetStringMacro(FileDataType);
52 // Get the file version of the XML file tested. If the file could not
53 // be read, returns NULL.
54 vtkGetStringMacro(FileVersion);
57 vtkXMLFileReadTester();
58 ~vtkXMLFileReadTester();
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() {}
73 vtkSetStringMacro(FileDataType);
74 vtkSetStringMacro(FileVersion);
77 vtkXMLFileReadTester(const vtkXMLFileReadTester&); // Not implemented.
78 void operator=(const vtkXMLFileReadTester&); // Not implemented.