OpenWalnut  1.2.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
WProjectFileIO.h
1 //---------------------------------------------------------------------------
2 //
3 // Project: OpenWalnut ( http://www.openwalnut.org )
4 //
5 // Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
6 // For more information see http://www.openwalnut.org/copying
7 //
8 // This file is part of OpenWalnut.
9 //
10 // OpenWalnut is free software: you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // OpenWalnut is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public License
21 // along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
22 //
23 //---------------------------------------------------------------------------
24 
25 #ifndef WPROJECTFILEIO_H
26 #define WPROJECTFILEIO_H
27 
28 #include <ostream>
29 #include <string>
30 
31 #include "WExportCommon.h"
32 /**
33  * A base class for all parts of OpenWalnut which can be serialized to a project file. It is used by WProjectFile to actually parse the file line
34  * by line. Derive from this class if you write your own parser and use it to fill your internal data structures.
35  */
36 class OWCOMMON_EXPORT WProjectFileIO // NOLINT
37 {
38 public:
39 
40  /**
41  * Default constructor.
42  */
44 
45  /**
46  * Destructor.
47  */
48  virtual ~WProjectFileIO();
49 
50  /**
51  * This method parses the specified line and interprets it. It gets called line by line by WProjectFile.
52  *
53  * \param line the current line as string
54  * \param lineNumber the current line number. Useful for error/warning/debugging output.
55  *
56  * \return true if the line could be parsed.
57  */
58  virtual bool parse( std::string line, unsigned int lineNumber ) = 0;
59 
60  /**
61  * Called whenever the end of the project file has been reached. This is useful if your specific parser class wants to do some post
62  * processing after parsing line by line.
63  */
64  virtual void done();
65 
66  /**
67  * Saves the state to the specified stream.
68  *
69  * \param output the stream to print the state to.
70  */
71  virtual void save( std::ostream& output ) = 0; // NOLINT
72 
73 protected:
74 
75 private:
76 };
77 
78 #endif // WPROJECTFILEIO_H
79