29 #include <boost/regex.hpp>
32 #include "combiner/WModuleProjectFileCombiner.h"
33 #include "WRoiProjectFileIO.h"
34 #include "../graphicsEngine/WGEProjectFileIO.h"
35 #include "../common/exceptions/WFileNotFound.h"
36 #include "../common/exceptions/WFileOpenFailed.h"
38 #include "WProjectFile.h"
89 wlog::info(
"Project File" ) <<
"Saving project file \"" <<
m_project.file_string() <<
"\".";
92 std::ofstream output(
m_project.file_string().c_str() );
93 if( !output.is_open() )
96 std::string(
"\" could not be opened for write access." ) );
100 for( std::vector< boost::shared_ptr< WProjectFileIO > >::const_iterator iter = writer.begin(); iter != writer.end(); ++iter )
102 ( *iter )->save( output );
119 wlog::info(
"Project File" ) <<
"Loading project file \"" <<
m_project.file_string() <<
"\".";
122 std::ifstream input(
m_project.file_string().c_str() );
123 if( !input.is_open() )
126 std::string(
"\" does not exist." ) );
130 static const boost::regex commentRe(
"^ *//.*$" );
136 boost::smatch matches;
138 while( std::getline( input, line ) )
144 for( std::vector< boost::shared_ptr< WProjectFileIO > >::const_iterator iter =
m_parsers.begin(); iter !=
m_parsers.end(); ++iter )
148 if( ( *iter )->parse( line, i ) )
155 catch(
const std::exception& e )
157 wlog::error(
"Project Loader" ) <<
"Line " << i <<
": Parsing caused an exception. Line Malformed? Skipping.";
162 if( !match && !line.empty() && !boost::regex_match( line, matches, commentRe ) )
165 wlog::warn(
"Project Loader" ) <<
"Line " << i <<
": Malformed. Skipping.";
172 for( std::vector< boost::shared_ptr< WProjectFileIO > >::const_iterator iter =
m_parsers.begin(); iter !=
m_parsers.end(); ++iter )
177 catch(
const std::exception& e )