Skip to content

Commit

Permalink
include SpecChecker in Specification set
Browse files Browse the repository at this point in the history
issue #28
  • Loading branch information
Valentin Noel committed Nov 28, 2013
1 parent 604e6db commit f008246
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions libraries/SpecReader/src/SpecReader/Specification.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "Specification.hpp"
#include "SpecChecker.hpp"

#include <Common/common.hpp>
#include <Common/log.hpp>
Expand Down Expand Up @@ -28,7 +29,7 @@ void Specification::setFromString( const std::string& string )
}
catch( const std::runtime_error& ex )
{
LOG_ERROR( "[specification] set: "<< ex.what() );
LOG_ERROR( "[specification] set from string: "<< ex.what() );
throw;
}
}
Expand All @@ -37,16 +38,12 @@ bool Specification::setFromFile( const std::string& filepath )
{
try
{
std::ifstream file( filepath );
bool ret = false;
if( file.good() )
{
std::string content( ( std::istreambuf_iterator<char>( file ) ),
std::istreambuf_iterator<char>() );
setFromString( content );
file.close();
ret = true;
}
bool ret = true;
SpecChecker( &_specDoc, filepath ).check();

if( _specDoc.HasParseError() )
ret = false;

return ret;
}
catch( const std::exception& ex )
Expand Down

0 comments on commit f008246

Please sign in to comment.