Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

DrawFile Class Reference

A class to read Drawing descriptions from a file. More...

#include <DrawFile.h>

Inheritance diagram for DrawFile:

XMLDrawFile List of all members.

Static Public Methods

Drawingread_file (std::string filename)
 Read a drawing file from a file.

bool write_file (std::string filename, Drawing *d)
 Write the contents of a drawing to a file.


Protected Methods

 DrawFile (std::string filename)
virtual ~DrawFile ()
virtual Drawingread_drawing ()=0

Protected Attributes

std::string filename

Detailed Description

A class to read Drawing descriptions from a file.


Constructor & Destructor Documentation

DrawFile::DrawFile std::string    filename [protected]
 

00039   : filename(fn)
00040 { }

virtual DrawFile::~DrawFile   [inline, protected, virtual]
 

00029 {}


Member Function Documentation

virtual Drawing* DrawFile::read_drawing   [protected, pure virtual]
 

Implemented in XMLDrawFile.

Drawing * DrawFile::read_file std::string    filename [static]
 

Read a drawing file from a file.

The filename is opened for reading. If errors are encountered, error messages are printed to stderr.

Returns :
null if errors, otherwise the drawing object.

00043 {
00044   ifstream input(filename.c_str());
00045 
00046   if (!input) {
00047     cerr << "Cannot open " << filename << " for reading." << endl;
00048     return 0;
00049   }
00050 
00051   XMLDrawFile df(filename,input,cerr);
00052   // assume XML syntax
00053 
00054   return df.read_drawing();
00055 }

bool DrawFile::write_file std::string    filename,
Drawing   d
[static]
 

Write the contents of a drawing to a file.

The filename is opened for writing and the drawing written.

Returns :
true if successful, false if unable to write.

00189                                                      {
00190   cerr << "Saving drawing is unimplemented!" << endl;
00191   return false; // unimplemented
00192 }


Member Data Documentation

std::string DrawFile::filename [protected]
 


The documentation for this class was generated from the following files:
Generated on Fri Nov 8 10:52:29 2002 for Draw by doxygen1.2.17