Commit 4f9a5ca3 authored by Andy Cedilnik's avatar Andy Cedilnik

Make Parse buffer virtual and add some comments

parent 4dd94070
......@@ -27,14 +27,14 @@
#define VTK_IOS_NOCREATE | ios::nocreate
#endif
vtkCxxRevisionMacro(vtkXMLParser, "1.6");
vtkCxxRevisionMacro(vtkXMLParser, "1.7");
vtkStandardNewMacro(vtkXMLParser);
//----------------------------------------------------------------------------
vtkXMLParser::vtkXMLParser()
{
this->Stream = 0;
this->Parser = 0;
this->Stream = 0;
this->Parser = 0;
this->LegacyHack = 0;
this->FileName = 0;
this->InputString = 0;
......@@ -76,12 +76,15 @@ int vtkXMLParser::Parse(const char* inputString)
//----------------------------------------------------------------------------
int vtkXMLParser::Parse()
{
// Select source of XML
ifstream ifs;
if ( !this->InputString && !this->Stream && this->FileName )
{
// If it is file, open it and set the appropriate stream
ifs.open(this->FileName, ios::in VTK_IOS_NOCREATE);
if ( !ifs )
{
vtkErrorMacro("Cannot open XML file: " << this->FileName);
return 0;
}
this->Stream = &ifs;
......@@ -113,6 +116,7 @@ int vtkXMLParser::Parse()
XML_ParserFree(this->Parser);
this->Parser = 0;
// If the source was a file, reset the stream
if ( this->Stream == &ifs )
{
this->Stream = 0;
......
......@@ -127,7 +127,7 @@ protected:
unsigned long GetXMLByteIndex();
// Send the given buffer to the XML parser.
int ParseBuffer(const char* buffer, unsigned int count);
virtual int ParseBuffer(const char* buffer, unsigned int count);
// Send the given c-style string to the XML parser.
int ParseBuffer(const char* buffer);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment