31
// Use filesystem version 2 for compatibility with newer boost versions.
32
#ifndef BOOST_FILESYSTEM_VERSION
33
#define BOOST_FILESYSTEM_VERSION 2
35
31
#include <boost/filesystem.hpp>
36
32
#include <boost/shared_ptr.hpp>
33
#include <boost/function.hpp>
34
#include <boost/signals2/signal.hpp>
38
36
#include "../common/WProjectFileIO.h"
39
#include "WExportKernel.h"
42
40
* Class loading project files. This class opens an file and reads it line by line. It delegates the actual parsing to each of the known
43
41
* WProjectFileIO instances which then do their job.
45
class OWKERNEL_EXPORT WProjectFile: public WThreadedRunner,
46
public boost::enable_shared_from_this< WProjectFile >
43
class WProjectFile: public WThreadedRunner,
44
public boost::enable_shared_from_this< WProjectFile >
51
* Default constructor. It does NOT parse the file. Parsing is done by apply().
48
* Abbreviation for a shared pointer.
50
typedef boost::shared_ptr< WProjectFile > SPtr;
53
* Abbreviation for const shared pointer.
55
typedef boost::shared_ptr< const WProjectFile > ConstSPtr;
58
* A callback function type reporting bach a finished load job. The given string vector contains a list of errors if any.
60
typedef boost::function< void( boost::filesystem::path, std::vector< std::string > ) > ProjectLoadCallback;
63
* A callback function signal type reporting bach a finished load job. The given string vector contains a list of errors if any.
65
typedef boost::signals2::signal< void( boost::filesystem::path, std::vector< std::string > ) > ProjectLoadCallbackSignal;
68
* Default constructor. It does NOT parse the file. Parsing is done by using load.
70
* \param project the project file to load or save.
72
explicit WProjectFile( boost::filesystem::path project );
75
* Default constructor. It does NOT parse the file. Parsing is done by using load.
53
77
* \param project the project file to load.
78
* \param doneCallback gets called whenever the load thread finishes.
55
explicit WProjectFile( boost::filesystem::path project );
80
WProjectFile( boost::filesystem::path project, ProjectLoadCallback doneCallback );
117
141
std::vector< boost::shared_ptr< WProjectFileIO > > m_parsers;
144
* Do custom exception handling.
146
* \param e the exception
148
virtual void onThreadException( const WException& e );
151
* Signal used to callback someone that the loader was finished.
153
ProjectLoadCallbackSignal m_signalLoadDone;
156
* Connection managing the signal m_signalLoadDone. This is the one and only connection allowed and will be disconnected upon thread has
159
boost::signals2::connection m_signalLoadDoneConnection;
122
162
#endif // WPROJECTFILE_H