summaryrefslogtreecommitdiff
path: root/boost/test/utils/runtime/file/config_file_iterator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/test/utils/runtime/file/config_file_iterator.cpp')
-rw-r--r--boost/test/utils/runtime/file/config_file_iterator.cpp152
1 files changed, 76 insertions, 76 deletions
diff --git a/boost/test/utils/runtime/file/config_file_iterator.cpp b/boost/test/utils/runtime/file/config_file_iterator.cpp
index a81a0c83e5..5d6cbdf7dc 100644
--- a/boost/test/utils/runtime/file/config_file_iterator.cpp
+++ b/boost/test/utils/runtime/file/config_file_iterator.cpp
@@ -1,4 +1,4 @@
-// (C) Copyright Gennadiy Rozental 2005-2008.
+// (C) Copyright Gennadiy Rozental 2005-2014.
// Use, modification, and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -24,9 +24,9 @@
// Boost
-#include <boost/utility.hpp>
#include <boost/scoped_array.hpp>
#include <boost/bind.hpp>
+#include <boost/noncopyable.hpp>
// Boost.Test
#include <boost/test/utils/basic_cstring/compare.hpp>
@@ -45,7 +45,7 @@
namespace boost {
-namespace BOOST_RT_PARAM_NAMESPACE {
+namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE {
namespace file {
@@ -71,7 +71,7 @@ struct symbol_to_value_map : std::map<cstring, ValueType> {
m_name_store.erase( it );
- erase( name );
+ this->erase( name );
}
private:
@@ -106,7 +106,7 @@ is_valid_identifier( cstring const& source )
return false;
while( ++it < source.end() ) {
- if( !std::isalnum( *it ) && *it != BOOST_RT_PARAM_LITERAL( '_' ) && *it != BOOST_RT_PARAM_LITERAL( '-' ) )
+ if( !std::isalnum( *it ) && *it != BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( '_' ) && *it != BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( '-' ) )
return false;
}
@@ -158,7 +158,7 @@ include_level::include_level( cstring file_name, cstring path_separators, includ
}
}
- BOOST_RT_PARAM_VALIDATE_LOGIC( m_stream.is_open(), BOOST_RT_PARAM_LITERAL( "can't open file " ) << file_name );
+ BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( m_stream.is_open(), BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "can't open file " ) << file_name );
}
//____________________________________________________________________________//
@@ -234,21 +234,21 @@ struct config_file_iterator::Impl : noncopyable {
//____________________________________________________________________________//
config_file_iterator::Impl::Impl()
-: m_path_separators( BOOST_RT_PARAM_LITERAL( "/\\" ) )
-, m_line_delimeter( BOOST_RT_PARAM_LITERAL( '\n' ) )
-, m_sl_comment_delimeter( BOOST_RT_PARAM_LITERAL( "#" ) )
-, m_command_delimeter( BOOST_RT_PARAM_LITERAL( "$" ) )
-, m_line_beak( BOOST_RT_PARAM_LITERAL( "\\" ) )
-, m_macro_ref_begin( BOOST_RT_PARAM_LITERAL( "$" ) )
-, m_macro_ref_end( BOOST_RT_PARAM_LITERAL( "$" ) )
-
-, m_include_kw( BOOST_RT_PARAM_LITERAL( "include" ) )
-, m_define_kw( BOOST_RT_PARAM_LITERAL( "define" ) )
-, m_undef_kw( BOOST_RT_PARAM_LITERAL( "undef" ) )
-, m_ifdef_kw( BOOST_RT_PARAM_LITERAL( "ifdef" ) )
-, m_ifndef_kw( BOOST_RT_PARAM_LITERAL( "ifndef" ) )
-, m_else_kw( BOOST_RT_PARAM_LITERAL( "else" ) )
-, m_endif_kw( BOOST_RT_PARAM_LITERAL( "endif" ) )
+: m_path_separators( BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "/\\" ) )
+, m_line_delimeter( BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( '\n' ) )
+, m_sl_comment_delimeter( BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "#" ) )
+, m_command_delimeter( BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "$" ) )
+, m_line_beak( BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "\\" ) )
+, m_macro_ref_begin( BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "$" ) )
+, m_macro_ref_end( BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "$" ) )
+
+, m_include_kw( BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "include" ) )
+, m_define_kw( BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "define" ) )
+, m_undef_kw( BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "undef" ) )
+, m_ifdef_kw( BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "ifdef" ) )
+, m_ifndef_kw( BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "ifndef" ) )
+, m_else_kw( BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "else" ) )
+, m_endif_kw( BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "endif" ) )
, m_buffer_size( 8192 )
@@ -338,9 +338,9 @@ config_file_iterator::Impl::get_next_line( cstring& line )
return true; // 110 //
}
- BOOST_RT_PARAM_VALIDATE_LOGIC( !broken_line, BOOST_RT_PARAM_LITERAL( "broken line is not completed" ) );
- BOOST_RT_PARAM_VALIDATE_LOGIC( m_conditional_states.size() == 0,
- BOOST_RT_PARAM_LITERAL( "matching endif command is missing" ) );
+ BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( !broken_line, BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "broken line is not completed" ) );
+ BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( m_conditional_states.size() == 0,
+ BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "matching endif command is missing" ) );
return false;
}
@@ -359,14 +359,14 @@ config_file_iterator::Impl::get_macro_value( cstring macro_name, bool ignore_mis
env::get( macro_name, macro_value );
#endif
- BOOST_RT_PARAM_VALIDATE_LOGIC( macro_value || ignore_missing || !m_detect_missing_macro,
- BOOST_RT_PARAM_LITERAL( "Unknown macro \"" ) << macro_name << BOOST_RT_PARAM_LITERAL( "\"" ) );
-
+ BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( macro_value || ignore_missing || !m_detect_missing_macro,
+ BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "Unknown macro \"" ) << macro_name << BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "\"" ) );
+
if( !macro_value ) {
if( !ignore_missing )
macro_value = cstring();
}
- else
+ else
m_symbols_table.add( macro_name, *macro_value );
return macro_value;
@@ -386,7 +386,7 @@ config_file_iterator::Impl::process_command_line( cstring line )
command_handler_map::const_iterator it = m_command_handler_map.find( *tit );
- BOOST_RT_PARAM_VALIDATE_LOGIC( it != m_command_handler_map.end(), BOOST_RT_PARAM_LITERAL( "Invalid command " ) << *tit );
+ BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( it != m_command_handler_map.end(), BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "Invalid command " ) << *tit );
++tit;
@@ -405,13 +405,13 @@ config_file_iterator::Impl::process_include( cstring line )
string_token_iterator tit( line, kept_delimeters = dt_none );
- BOOST_RT_PARAM_VALIDATE_LOGIC( tit != string_token_iterator(),
- BOOST_RT_PARAM_LITERAL( "include file name missing" ) );
+ BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( tit != string_token_iterator(),
+ BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "include file name missing" ) );
cstring include_file_name = *tit;
- BOOST_RT_PARAM_VALIDATE_LOGIC( ++tit == string_token_iterator(),
- BOOST_RT_PARAM_LITERAL( "unexpected tokens at the end of include command" ) );
+ BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( ++tit == string_token_iterator(),
+ BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "unexpected tokens at the end of include command" ) );
substitute_macros( include_file_name );
@@ -431,8 +431,8 @@ config_file_iterator::Impl::process_define( cstring line )
string_token_iterator tit( line, (kept_delimeters = dt_none, max_tokens = 2 ));
cstring macro_name = *tit;
- BOOST_RT_PARAM_VALIDATE_LOGIC( is_valid_identifier( macro_name ),
- BOOST_RT_PARAM_LITERAL( "invalid macro name" ) );
+ BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( is_valid_identifier( macro_name ),
+ BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "invalid macro name" ) );
cstring macro_value = *(++tit);
substitute_macros( macro_value );
@@ -449,8 +449,8 @@ config_file_iterator::Impl::process_undef( cstring line )
return;
cstring macro_name = line;
- BOOST_RT_PARAM_VALIDATE_LOGIC( is_valid_identifier( macro_name ),
- BOOST_RT_PARAM_LITERAL( "invalid macro name" ) );
+ BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( is_valid_identifier( macro_name ),
+ BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "invalid macro name" ) );
m_symbols_table.remove( macro_name );
}
@@ -465,8 +465,8 @@ config_file_iterator::Impl::process_ifdef( cstring line )
return;
cstring macro_name = line;
- BOOST_RT_PARAM_VALIDATE_LOGIC( is_valid_identifier( macro_name ),
- BOOST_RT_PARAM_LITERAL( "invalid macro name" ) );
+ BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( is_valid_identifier( macro_name ),
+ BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "invalid macro name" ) );
if( !get_macro_value( macro_name ) )
m_inactive_ifdef_level = m_conditional_states.size();
@@ -482,8 +482,8 @@ config_file_iterator::Impl::process_ifndef( cstring line )
return;
cstring macro_name = line;
- BOOST_RT_PARAM_VALIDATE_LOGIC( is_valid_identifier( macro_name ),
- BOOST_RT_PARAM_LITERAL( "invalid macro name" ) );
+ BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( is_valid_identifier( macro_name ),
+ BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "invalid macro name" ) );
if( get_macro_value( macro_name ) )
m_inactive_ifdef_level = m_conditional_states.size();
@@ -494,12 +494,12 @@ config_file_iterator::Impl::process_ifndef( cstring line )
void
config_file_iterator::Impl::process_else( cstring line )
{
- BOOST_RT_PARAM_VALIDATE_LOGIC( m_conditional_states.size() > 0 && m_conditional_states.back(),
- BOOST_RT_PARAM_LITERAL( "else without matching if" ) );
+ BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( m_conditional_states.size() > 0 && m_conditional_states.back(),
+ BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "else without matching if" ) );
m_inactive_ifdef_level = m_conditional_states.size() == m_inactive_ifdef_level ? 0 : m_conditional_states.size();
- BOOST_RT_PARAM_VALIDATE_LOGIC( line.is_empty(), BOOST_RT_PARAM_LITERAL( "unexpected tokens at the end of else command" ) );
+ BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( line.is_empty(), BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "unexpected tokens at the end of else command" ) );
}
//____________________________________________________________________________//
@@ -507,13 +507,13 @@ config_file_iterator::Impl::process_else( cstring line )
void
config_file_iterator::Impl::process_endif( cstring line )
{
- BOOST_RT_PARAM_VALIDATE_LOGIC( m_conditional_states.size() > 0, BOOST_RT_PARAM_LITERAL( "endif without matching if" ) );
+ BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( m_conditional_states.size() > 0, BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "endif without matching if" ) );
if( m_conditional_states.size() == m_inactive_ifdef_level )
m_inactive_ifdef_level = 0;
m_conditional_states.pop_back();
- BOOST_RT_PARAM_VALIDATE_LOGIC( line.is_empty(), BOOST_RT_PARAM_LITERAL( "unexpected tokens at the end of endif command" ) );
+ BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( line.is_empty(), BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "unexpected tokens at the end of endif command" ) );
}
//____________________________________________________________________________//
@@ -531,7 +531,7 @@ config_file_iterator::Impl::substitute_macros( cstring& where )
pos = where.find( m_macro_ref_end );
- BOOST_RT_PARAM_VALIDATE_LOGIC( pos != cstring::npos, BOOST_RT_PARAM_LITERAL( "incomplete macro reference" ) );
+ BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( pos != cstring::npos, BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "incomplete macro reference" ) );
cstring value = *get_macro_value( where.substr( 0, pos ), false );
m_post_subst_line.append( value.begin(), value.size() );
@@ -562,18 +562,18 @@ config_file_iterator::construct()
void
config_file_iterator::load( cstring file_name )
{
- m_pimpl->m_curr_level.reset( new include_level( file_name, m_pimpl->m_path_separators ) );
- m_pimpl->m_buffer.reset( new char[m_pimpl->m_buffer_size] );
-
- register_command_handler( m_pimpl->m_include_kw, bind( &Impl::process_include, m_pimpl.get(), _1 ) );
- register_command_handler( m_pimpl->m_define_kw, bind( &Impl::process_define, m_pimpl.get(), _1 ) );
- register_command_handler( m_pimpl->m_undef_kw, bind( &Impl::process_undef, m_pimpl.get(), _1 ) );
- register_command_handler( m_pimpl->m_ifdef_kw, bind( &Impl::process_ifdef, m_pimpl.get(), _1 ) );
- register_command_handler( m_pimpl->m_ifndef_kw, bind( &Impl::process_ifndef, m_pimpl.get(), _1 ) );
- register_command_handler( m_pimpl->m_else_kw, bind( &Impl::process_else, m_pimpl.get(), _1 ) );
- register_command_handler( m_pimpl->m_endif_kw, bind( &Impl::process_endif, m_pimpl.get(), _1 ) );
-
- init();
+ m_pimpl->m_curr_level.reset( new include_level( file_name, m_pimpl->m_path_separators ) );
+ m_pimpl->m_buffer.reset( new char[m_pimpl->m_buffer_size] );
+
+ register_command_handler( m_pimpl->m_include_kw, boost::bind( &Impl::process_include, m_pimpl.get(), _1 ) );
+ register_command_handler( m_pimpl->m_define_kw, boost::bind( &Impl::process_define, m_pimpl.get(), _1 ) );
+ register_command_handler( m_pimpl->m_undef_kw, boost::bind( &Impl::process_undef, m_pimpl.get(), _1 ) );
+ register_command_handler( m_pimpl->m_ifdef_kw, boost::bind( &Impl::process_ifdef, m_pimpl.get(), _1 ) );
+ register_command_handler( m_pimpl->m_ifndef_kw, boost::bind( &Impl::process_ifndef, m_pimpl.get(), _1 ) );
+ register_command_handler( m_pimpl->m_else_kw, boost::bind( &Impl::process_else, m_pimpl.get(), _1 ) );
+ register_command_handler( m_pimpl->m_endif_kw, boost::bind( &Impl::process_endif, m_pimpl.get(), _1 ) );
+
+ init();
}
//____________________________________________________________________________//
@@ -606,31 +606,31 @@ void
config_file_iterator::set_parameter( rtti::id_t id, cstring value )
{
BOOST_RTTI_SWITCH( id ) {
- BOOST_RTTI_CASE( cfg_detail::path_separators_t )
+ BOOST_RTTI_CASE( cfg_detail::path_separators_t )
assign_op( m_pimpl->m_path_separators , value, 0 );
- BOOST_RTTI_CASE( cfg_detail::sl_comment_delimeter_t )
+ BOOST_RTTI_CASE( cfg_detail::sl_comment_delimeter_t )
assign_op( m_pimpl->m_sl_comment_delimeter , value, 0 );
- BOOST_RTTI_CASE( cfg_detail::command_delimeter_t )
+ BOOST_RTTI_CASE( cfg_detail::command_delimeter_t )
assign_op( m_pimpl->m_command_delimeter , value, 0 );
- BOOST_RTTI_CASE( cfg_detail::line_beak_t )
+ BOOST_RTTI_CASE( cfg_detail::line_beak_t )
assign_op( m_pimpl->m_line_beak , value, 0 );
- BOOST_RTTI_CASE( cfg_detail::macro_ref_begin_t )
+ BOOST_RTTI_CASE( cfg_detail::macro_ref_begin_t )
assign_op( m_pimpl->m_macro_ref_begin , value, 0 );
- BOOST_RTTI_CASE( cfg_detail::macro_ref_end_t )
+ BOOST_RTTI_CASE( cfg_detail::macro_ref_end_t )
assign_op( m_pimpl->m_macro_ref_end , value, 0 );
- BOOST_RTTI_CASE( cfg_detail::include_kw_t )
+ BOOST_RTTI_CASE( cfg_detail::include_kw_t )
assign_op( m_pimpl->m_include_kw , value, 0 );
- BOOST_RTTI_CASE( cfg_detail::define_kw_t )
+ BOOST_RTTI_CASE( cfg_detail::define_kw_t )
assign_op( m_pimpl->m_define_kw , value, 0 );
- BOOST_RTTI_CASE( cfg_detail::undef_kw_t )
+ BOOST_RTTI_CASE( cfg_detail::undef_kw_t )
assign_op( m_pimpl->m_undef_kw , value, 0 );
- BOOST_RTTI_CASE( cfg_detail::ifdef_kw_t )
+ BOOST_RTTI_CASE( cfg_detail::ifdef_kw_t )
assign_op( m_pimpl->m_ifdef_kw , value, 0 );
- BOOST_RTTI_CASE( cfg_detail::ifndef_kw_t )
+ BOOST_RTTI_CASE( cfg_detail::ifndef_kw_t )
assign_op( m_pimpl->m_ifndef_kw , value, 0 );
- BOOST_RTTI_CASE( cfg_detail::else_kw_t )
+ BOOST_RTTI_CASE( cfg_detail::else_kw_t )
assign_op( m_pimpl->m_else_kw , value, 0 );
- BOOST_RTTI_CASE( cfg_detail::endif_kw_t )
+ BOOST_RTTI_CASE( cfg_detail::endif_kw_t )
assign_op( m_pimpl->m_endif_kw , value, 0 );
}
}
@@ -641,7 +641,7 @@ void
config_file_iterator::set_parameter( rtti::id_t id, bool value )
{
BOOST_RTTI_SWITCH( id ) {
- BOOST_RTTI_CASE( cfg_detail::trim_leading_spaces_t )
+ BOOST_RTTI_CASE( cfg_detail::trim_leading_spaces_t )
m_pimpl->m_trim_leading_spaces = value;
BOOST_RTTI_CASE( cfg_detail::trim_trailing_spaces_t )
m_pimpl->m_trim_trailing_spaces = value;
@@ -658,7 +658,7 @@ void
config_file_iterator::set_parameter( rtti::id_t id, char_type value )
{
BOOST_RTTI_SWITCH( id ) {
- BOOST_RTTI_CASE( cfg_detail::line_delimeter_t )
+ BOOST_RTTI_CASE( cfg_detail::line_delimeter_t )
m_pimpl->m_line_delimeter = value;
}
}
@@ -669,7 +669,7 @@ void
config_file_iterator::set_parameter( rtti::id_t id, std::size_t value )
{
BOOST_RTTI_SWITCH( id ) {
- BOOST_RTTI_CASE( cfg_detail::buffer_size_t )
+ BOOST_RTTI_CASE( cfg_detail::buffer_size_t )
m_pimpl->m_buffer_size = value;
}
}
@@ -678,7 +678,7 @@ config_file_iterator::set_parameter( rtti::id_t id, std::size_t value )
} // namespace file
-} // namespace BOOST_RT_PARAM_NAMESPACE
+} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE
} // namespace boost