31 #include <boost/regex.hpp>
34 #include "combiner/WModuleProjectFileCombiner.h"
35 #include "WRoiProjectFileIO.h"
36 #include "../graphicsEngine/WGEProjectFileIO.h"
37 #include "../common/exceptions/WFileNotFound.h"
38 #include "../common/exceptions/WFileOpenFailed.h"
39 #include "../common/WStringUtils.h"
41 #include "WProjectFile.h"
64 m_signalLoadDoneConnection( m_signalLoadDone.connect( doneCallback ) )
112 std::ofstream output(
m_project.string().c_str() );
113 if( !output.is_open() )
116 std::string(
"\" could not be opened for write access." ) );
120 for( std::vector< boost::shared_ptr< WProjectFileIO > >::const_iterator iter = writer.begin(); iter != writer.end(); ++iter )
122 ( *iter )->save( output );
140 std::vector< std::string > errors;
143 std::ifstream input(
m_project.string().c_str() );
144 if( !input.is_open() )
146 errors.push_back( std::string(
"The project file \"" ) +
m_project.string() + std::string(
"\" does not exist." ) );
157 static const boost::regex commentRe(
"^ *//.*$" );
163 boost::smatch matches;
165 while( std::getline( input, line ) )
171 for( std::vector< boost::shared_ptr< WProjectFileIO > >::const_iterator iter =
m_parsers.begin(); iter !=
m_parsers.end(); ++iter )
175 if( ( *iter )->parse( line, i ) )
182 catch(
const std::exception& e )
190 if( !match && !line.empty() && !boost::regex_match( line, matches, commentRe ) )
193 wlog::warn(
"Project Loader" ) <<
"Line " << i <<
": Malformed. Skipping.";
200 for( std::vector< boost::shared_ptr< WProjectFileIO > >::const_iterator iter =
m_parsers.begin(); iter !=
m_parsers.end(); ++iter )
206 std::copy( ( *iter )->getErrors().begin(), ( *iter )->getErrors().end(), std::back_inserter( errors ) );
208 catch(
const std::exception& e )
210 errors.push_back(
"Exception while applying settings: " + std::string( e.what() ) );