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