25 #ifndef WPROJECTFILEIO_H
26 #define WPROJECTFILEIO_H
33 #include <boost/shared_ptr.hpp>
36 #include "WProperties.h"
54 typedef boost::shared_ptr< WProjectFileIO >
SPtr;
59 typedef boost::shared_ptr< const WProjectFileIO >
ConstSPtr;
80 virtual bool parse( std::string line,
unsigned int lineNumber ) = 0;
94 virtual void save( std::ostream& output ) = 0;
108 const std::vector< std::string >&
getErrors()
const;
122 const std::vector< std::string >&
getWarnings()
const;
165 void addError( std::string description );
185 void printProperties( std::ostream& output, boost::shared_ptr< WProperties > props, std::string indent,
186 std::string prefix,
unsigned int index, std::string indexPrefix =
"" );
225 #endif // WPROJECTFILEIO_H
virtual void done()
Called whenever the end of the project file has been reached.
void setProject(WProjectFile *project)
Set the project using this parser.
WProjectFileIO()
Default constructor.
void setApplyOrder(ApplyOrder order)
Set the order of calls to "done".
std::vector< std::string > m_warnings
List of warnings if any.
virtual void save(std::ostream &output)=0
Saves the state to the specified stream.
virtual ~WProjectFileIO()
Destructor.
const std::vector< std::string > & getErrors() const
Get error list.
void addWarning(std::string description)
Add an warning.
boost::shared_ptr< const WProjectFileIO > ConstSPtr
Abbreviation for const shared pointer.
Class loading project files.
ApplyOrder m_applyOrder
The order in which the "done" functions are called.
const std::vector< std::string > & getWarnings() const
Get warnings list.
void addError(std::string description)
Add an error.
boost::shared_ptr< WProjectFileIO > SPtr
Abbreviation for a shared pointer.
virtual bool parse(std::string line, unsigned int lineNumber)=0
This method parses the specified line and interprets it.
WProjectFile * m_project
The project using this parser.
bool hadErrors() const
Checks whether there where errors during load or save.
std::vector< std::string > m_errors
List of errors if any.
A base class for all parts of OpenWalnut which can be serialized to a project file.
void printProperties(std::ostream &output, boost::shared_ptr< WProperties > props, std::string indent, std::string prefix, unsigned int index, std::string indexPrefix="")
Recursively prints the properties and nested properties.
bool hadWarnings() const
Checks whether there where warnings during load or save.
ApplyOrder
When to apply this parser.
virtual SPtr clone(WProjectFile *project) const =0
Create a clone of the IO.
ApplyOrder getApplyOrder() const
Return the apply order of this IO.
WProjectFile * getProject() const
The project using this parser.