Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r67161 - in sandbox/configurator/boost/configurator: . detail
From: for.dshevchenko_at_[hidden]
Date: 2010-12-11 03:20:41


Author: dshevchenko
Date: 2010-12-11 03:20:36 EST (Sat, 11 Dec 2010)
New Revision: 67161
URL: http://svn.boost.org/trac/boost/changeset/67161

Log:
1.0pre cleaning code for portability.

Text files modified:
   sandbox/configurator/boost/configurator/configurator.hpp | 14 ++++++----
   sandbox/configurator/boost/configurator/detail/comments_remover.hpp | 10 +++---
   sandbox/configurator/boost/configurator/detail/incorrect_options_checker.hpp | 8 +++++
   sandbox/configurator/boost/configurator/detail/misc.hpp | 7 +++-
   sandbox/configurator/boost/configurator/detail/necessary_options_checker.hpp | 2
   sandbox/configurator/boost/configurator/detail/options_repetition_handler.hpp | 4 ++
   sandbox/configurator/boost/configurator/detail/pure_options_obtainer.hpp | 18 ++++++++++---
   sandbox/configurator/boost/configurator/detail/pure_strings_obtainer.hpp | 4 ++
   sandbox/configurator/boost/configurator/detail/semantics_checker.hpp | 22 ++++++++++------
   sandbox/configurator/boost/configurator/detail/type_name.hpp | 2 +
   sandbox/configurator/boost/configurator/detail/types.hpp | 1
   sandbox/configurator/boost/configurator/detail/validators.hpp | 42 ++++++++++++++++----------------
   sandbox/configurator/boost/configurator/option.hpp | 52 +++------------------------------------
   13 files changed, 88 insertions(+), 98 deletions(-)

Modified: sandbox/configurator/boost/configurator/configurator.hpp
==============================================================================
--- sandbox/configurator/boost/configurator/configurator.hpp (original)
+++ sandbox/configurator/boost/configurator/configurator.hpp 2010-12-11 03:20:36 EST (Sat, 11 Dec 2010)
@@ -9,8 +9,10 @@
 #ifndef BOOST_CONFIGURATOR_HPP
 #define BOOST_CONFIGURATOR_HPP
 
-#include <boost/configurator/detail/macro.hpp>
+#include <boost/configurator/macro.hpp>
 #include <boost/configurator/detail/validators.hpp>
+#include <boost/configurator/detail/type_name.hpp>
+#include <boost/configurator/detail/pure_option.hpp>
 #include <boost/configurator/detail/comments_remover.hpp>
 #include <boost/configurator/detail/pure_strings_obtainer.hpp>
 #include <boost/configurator/detail/pure_options_obtainer.hpp>
@@ -206,7 +208,7 @@
         detail::str_storage obtained_strings = obtain_pure_strings( path_to_configuration_file );
         check_actual_data_existence_in( obtained_strings );
         remove_comments_from( obtained_strings );
- pure_options factual_obtained_options = options_obtainer( obtained_strings );
+ detail::pure_options factual_obtained_options = options_obtainer( obtained_strings );
         prepare_names_depending_on_case_sensitivity( factual_obtained_options );
         check_incorrect_options( factual_obtained_options );
         check_necessary_options( factual_obtained_options );
@@ -256,20 +258,20 @@
         return registered_options.end() != it;
     }
     
- void prepare_names_depending_on_case_sensitivity( pure_options& factual_obtained_options ) {
+ void prepare_names_depending_on_case_sensitivity( detail::pure_options& factual_obtained_options ) {
         if ( !settings_of_configurator.case_sensitivity ) {
             BOOST_FOREACH ( option& option, registered_options ) {
                 boost::to_lower( option.location );
             }
 
- BOOST_FOREACH ( pure_option& option, factual_obtained_options ) {
+ BOOST_FOREACH ( detail::pure_option& option, factual_obtained_options ) {
                 boost::to_lower( option.location );
             }
         } else {}
     }
 
- void store_obtained_values( const pure_options& factual_obtained_options ) {
- BOOST_FOREACH ( const pure_option& option, factual_obtained_options ) {
+ void store_obtained_values( const detail::pure_options& factual_obtained_options ) {
+ BOOST_FOREACH ( const detail::pure_option& option, factual_obtained_options ) {
             option_it it = std::find( registered_options.begin()
                                       , registered_options.end()
                                       , option.location );

Modified: sandbox/configurator/boost/configurator/detail/comments_remover.hpp
==============================================================================
--- sandbox/configurator/boost/configurator/detail/comments_remover.hpp (original)
+++ sandbox/configurator/boost/configurator/detail/comments_remover.hpp 2010-12-11 03:20:36 EST (Sat, 11 Dec 2010)
@@ -11,8 +11,10 @@
 
 #include <boost/configurator/detail/misc.hpp>
 #include <boost/foreach.hpp>
-#include <boost/mem_fn.hpp>
-#include <boost/assign.hpp>
+#include <boost/bind.hpp>
+#include <boost/algorithm/string.hpp>
+
+#include <algorithm>
 
 namespace boost {
 
@@ -24,8 +26,6 @@
 /// \brief Details of realization.
 namespace detail {
 
-using namespace boost::assign;
-
 /// \class comments_remover
 /// \brief Comments remover.
 ///
@@ -56,7 +56,7 @@
                        , obtained_strings.end()
                        , boost::bind( &comments_remover::remove_one_line_comment
                                       , this
- , _1 ) );
+ , ::_1 ) );
         trim_all( obtained_strings );
     }
     

Modified: sandbox/configurator/boost/configurator/detail/incorrect_options_checker.hpp
==============================================================================
--- sandbox/configurator/boost/configurator/detail/incorrect_options_checker.hpp (original)
+++ sandbox/configurator/boost/configurator/detail/incorrect_options_checker.hpp 2010-12-11 03:20:36 EST (Sat, 11 Dec 2010)
@@ -9,7 +9,11 @@
 #ifndef BOOST_CONFIGURATOR_INCORRECT_OPTIONS_CHECKER_HPP
 #define BOOST_CONFIGURATOR_INCORRECT_OPTIONS_CHECKER_HPP
 
-#include <boost/configurator/detail/option.hpp>
+#include <boost/configurator/option.hpp>
+#include <boost/algorithm/string.hpp>
+#include <boost/assign.hpp>
+
+#include <algorithm>
 
 namespace boost {
 
@@ -21,6 +25,8 @@
 /// \brief Details of realization.
 namespace detail {
 
+using namespace boost::assign;
+
 /// \class incorrect_options_checker
 /// \brief Incorrect options checker.
 ///

Modified: sandbox/configurator/boost/configurator/detail/misc.hpp
==============================================================================
--- sandbox/configurator/boost/configurator/detail/misc.hpp (original)
+++ sandbox/configurator/boost/configurator/detail/misc.hpp 2010-12-11 03:20:36 EST (Sat, 11 Dec 2010)
@@ -10,11 +10,14 @@
 #define BOOST_CONFIGURATOR_MISC_HPP
 
 #include <boost/configurator/detail/types.hpp>
-#include <boost/configurator/detail/type_name.hpp>
-#include <boost/lexical_cast.hpp>
+#include <boost/mem_fn.hpp>
+#include <boost/foreach.hpp>
 #include <boost/algorithm/string.hpp>
 #include <boost/filesystem/operations.hpp>
 
+#include <string>
+#include <algorithm>
+#include <stdexcept>
 #include <iostream>
 
 namespace boost {

Modified: sandbox/configurator/boost/configurator/detail/necessary_options_checker.hpp
==============================================================================
--- sandbox/configurator/boost/configurator/detail/necessary_options_checker.hpp (original)
+++ sandbox/configurator/boost/configurator/detail/necessary_options_checker.hpp 2010-12-11 03:20:36 EST (Sat, 11 Dec 2010)
@@ -9,7 +9,7 @@
 #ifndef BOOST_CONFIGURATOR_NECESSARY_OPTIONS_CHECKER_HPP
 #define BOOST_CONFIGURATOR_NECESSARY_OPTIONS_CHECKER_HPP
 
-#include <boost/configurator/detail/option.hpp>
+#include <boost/configurator/option.hpp>
 
 namespace boost {
 

Modified: sandbox/configurator/boost/configurator/detail/options_repetition_handler.hpp
==============================================================================
--- sandbox/configurator/boost/configurator/detail/options_repetition_handler.hpp (original)
+++ sandbox/configurator/boost/configurator/detail/options_repetition_handler.hpp 2010-12-11 03:20:36 EST (Sat, 11 Dec 2010)
@@ -9,9 +9,11 @@
 #ifndef BOOST_CONFIGURATOR_OPTIONS_REPETITION_HANDLER_HPP
 #define BOOST_CONFIGURATOR_OPTIONS_REPETITION_HANDLER_HPP
 
-#include <boost/configurator/detail/misc.hpp>
+#include <boost/configurator/detail/types.hpp>
 #include <boost/filesystem/fstream.hpp>
 
+#include <algorithm>
+
 namespace boost {
 
 /// \namespace cf

Modified: sandbox/configurator/boost/configurator/detail/pure_options_obtainer.hpp
==============================================================================
--- sandbox/configurator/boost/configurator/detail/pure_options_obtainer.hpp (original)
+++ sandbox/configurator/boost/configurator/detail/pure_options_obtainer.hpp 2010-12-11 03:20:36 EST (Sat, 11 Dec 2010)
@@ -9,13 +9,21 @@
 #ifndef BOOST_CONFIGURATOR_PURE_OPTIONS_OBTAINER_HPP
 #define BOOST_CONFIGURATOR_PURE_OPTIONS_OBTAINER_HPP
 
+#include <boost/configurator/detail/types.hpp>
 #include <boost/configurator/detail/misc.hpp>
 #include <boost/configurator/detail/pure_option.hpp>
+#include <boost/configurator/option.hpp>
+#include <boost/function.hpp>
+#include <boost/assign.hpp>
+#include <boost/foreach.hpp>
+#include <boost/algorithm/string.hpp>
 #include <boost/spirit/include/phoenix_core.hpp>
 #include <boost/spirit/include/phoenix_operator.hpp>
 #include <boost/spirit/include/phoenix_stl.hpp>
 
-#include <iostream>
+#include <string>
+#include <vector>
+#include <algorithm>
 
 namespace boost {
 
@@ -54,10 +62,10 @@
             , close_section_tag_begin_sign( "</" )
             , close_section_tag_end_sign( ">" ) {
         using namespace boost::assign;
- handlers += boost::bind( &pure_options_obtainer::handle_section_opening, this, _1, _2 )
- , boost::bind( &pure_options_obtainer::handle_section_closing, this, _1, _2 )
- , boost::bind( &pure_options_obtainer::handle_option, this, _1, _2 )
- , boost::bind( &pure_options_obtainer::meaningless_string, this, _1, _2 )
+ handlers += boost::bind( &pure_options_obtainer::handle_section_opening, this, ::_1, ::_2 )
+ , boost::bind( &pure_options_obtainer::handle_section_closing, this, ::_1, ::_2 )
+ , boost::bind( &pure_options_obtainer::handle_option, this, ::_1, ::_2 )
+ , boost::bind( &pure_options_obtainer::meaningless_string, this, ::_1, ::_2 )
                     ;
     }
 private:

Modified: sandbox/configurator/boost/configurator/detail/pure_strings_obtainer.hpp
==============================================================================
--- sandbox/configurator/boost/configurator/detail/pure_strings_obtainer.hpp (original)
+++ sandbox/configurator/boost/configurator/detail/pure_strings_obtainer.hpp 2010-12-11 03:20:36 EST (Sat, 11 Dec 2010)
@@ -9,8 +9,10 @@
 #ifndef BOOST_CONFIGURATOR_PURE_STRINGS_OBTAINER_HPP
 #define BOOST_CONFIGURATOR_PURE_STRINGS_OBTAINER_HPP
 
-#include <boost/configurator/detail/misc.hpp>
 #include <boost/filesystem/fstream.hpp>
+#include <boost/algorithm/string.hpp>
+
+#include <string>
 
 namespace boost {
 

Modified: sandbox/configurator/boost/configurator/detail/semantics_checker.hpp
==============================================================================
--- sandbox/configurator/boost/configurator/detail/semantics_checker.hpp (original)
+++ sandbox/configurator/boost/configurator/detail/semantics_checker.hpp 2010-12-11 03:20:36 EST (Sat, 11 Dec 2010)
@@ -9,13 +9,18 @@
 #ifndef BOOST_CONFIGURATOR_SEMANTICS_CHECKER_HPP
 #define BOOST_CONFIGURATOR_SEMANTICS_CHECKER_HPP
 
-#include <boost/configurator/detail/option.hpp>
+#include <boost/configurator/option.hpp>
+
+#include <string>
+
 #ifdef WITH_SEMANTIC_CHECK
 #include <boost/configurator/detail/validators.hpp>
 #include <boost/function.hpp>
+#include <boost/assign.hpp>
 #include <boost/bind.hpp>
 
 #include <map>
+#include <algorithm>
 #endif
 
 namespace boost {
@@ -57,6 +62,7 @@
             #endif
     {
         #ifdef WITH_SEMANTIC_CHECK
+ using namespace boost::assign;
         insert( semantic_checkers )( path, check_path_existence )
                                    ( optional_path, check_optional_path_existence )
                                    ( ipv4, check_ipv4_validity )
@@ -65,16 +71,16 @@
                                    ( email, check_email_validity )
                                    ( size, boost::bind( &size_validator::check
                                                                  , &check_size_validity
- , _1
- , _2 ) )
+ , ::_1
+ , ::_2 ) )
                                    ( time_period, boost::bind( &time_period_validator::check
                                                                  , &check_time_period_validity
- , _1
- , _2 ) )
+ , ::_1
+ , ::_2 ) )
                                    ( exp_record, boost::bind( &exp_record_validator::check
                                                                  , &check_exp_record_validity
- , _1
- , _2 ) )
+ , ::_1
+ , ::_2 ) )
                                    ;
         #endif
     }
@@ -92,7 +98,7 @@
         #ifdef WITH_SEMANTIC_CHECK
         std::for_each( registered_options.begin()
                        , registered_options.end()
- , boost::bind( &semantics_checker::check, this, _1 ) );
+ , boost::bind( &semantics_checker::check, this, ::_1 ) );
         #endif
     }
 #ifdef WITH_SEMANTIC_CHECK

Modified: sandbox/configurator/boost/configurator/detail/type_name.hpp
==============================================================================
--- sandbox/configurator/boost/configurator/detail/type_name.hpp (original)
+++ sandbox/configurator/boost/configurator/detail/type_name.hpp 2010-12-11 03:20:36 EST (Sat, 11 Dec 2010)
@@ -9,6 +9,8 @@
 #ifndef BOOST_CONFIGURATOR_TYPE_NAME_HPP
 #define BOOST_CONFIGURATOR_TYPE_NAME_HPP
 
+#include <boost/assign.hpp>
+
 #include <map>
 #include <string>
 

Modified: sandbox/configurator/boost/configurator/detail/types.hpp
==============================================================================
--- sandbox/configurator/boost/configurator/detail/types.hpp (original)
+++ sandbox/configurator/boost/configurator/detail/types.hpp 2010-12-11 03:20:36 EST (Sat, 11 Dec 2010)
@@ -9,6 +9,7 @@
 #ifndef BOOST_CONFIGURATOR_TYPES_HPP
 #define BOOST_CONFIGURATOR_TYPES_HPP
 
+#include <string>
 #include <vector>
 #include <set>
 #include <sstream>

Modified: sandbox/configurator/boost/configurator/detail/validators.hpp
==============================================================================
--- sandbox/configurator/boost/configurator/detail/validators.hpp (original)
+++ sandbox/configurator/boost/configurator/detail/validators.hpp 2010-12-11 03:20:36 EST (Sat, 11 Dec 2010)
@@ -9,8 +9,8 @@
 #ifndef BOOST_CONFIGURATOR_VALIDATORS_HPP
 #define BOOST_CONFIGURATOR_VALIDATORS_HPP
 
+#include <boost/configurator/option.hpp>
 #include <boost/configurator/detail/misc.hpp>
-#include <boost/configurator/detail/option.hpp>
 
 #ifdef WITH_SEMANTIC_CHECK
 #include <boost/asio/ip/address_v4.hpp>
@@ -229,16 +229,16 @@
     {
         #ifdef WITH_SEMANTIC_CHECK
         typedef size_validator sv;
- handlers = list_of( std::make_pair( boost::bind( &sv::size_in_bytes_pure, this, _1 )
- , boost::bind( &sv::store_in_bytes_pure, this, _1, _2 ) ) )
- ( std::make_pair( boost::bind( &sv::size_in_bytes, this, _1 )
- , boost::bind( &sv::store_in_bytes, this, _1, _2 ) ) )
- ( std::make_pair( boost::bind( &sv::size_in_kbytes, this, _1 )
- , boost::bind( &sv::store_in_kbytes, this, _1, _2 ) ) )
- ( std::make_pair( boost::bind( &sv::size_in_mbytes, this, _1 )
- , boost::bind( &sv::store_in_mbytes, this, _1, _2 ) ) )
- ( std::make_pair( boost::bind( &sv::size_in_gbytes, this, _1 )
- , boost::bind( &sv::store_in_gbytes, this, _1, _2 ) ) )
+ handlers = list_of( std::make_pair( boost::bind( &sv::size_in_bytes_pure, this, ::_1 )
+ , boost::bind( &sv::store_in_bytes_pure, this, ::_1, ::_2 ) ) )
+ ( std::make_pair( boost::bind( &sv::size_in_bytes, this, ::_1 )
+ , boost::bind( &sv::store_in_bytes, this, ::_1, ::_2 ) ) )
+ ( std::make_pair( boost::bind( &sv::size_in_kbytes, this, ::_1 )
+ , boost::bind( &sv::store_in_kbytes, this, ::_1, ::_2 ) ) )
+ ( std::make_pair( boost::bind( &sv::size_in_mbytes, this, ::_1 )
+ , boost::bind( &sv::store_in_mbytes, this, ::_1, ::_2 ) ) )
+ ( std::make_pair( boost::bind( &sv::size_in_gbytes, this, ::_1 )
+ , boost::bind( &sv::store_in_gbytes, this, ::_1, ::_2 ) ) )
         ;
         #endif
     }
@@ -327,16 +327,16 @@
     {
         #ifdef WITH_SEMANTIC_CHECK
         typedef time_period_validator tpv;
- handlers = list_of( std::make_pair( boost::bind( &tpv::period_in_seconds_pure, this, _1 )
- , boost::bind( &tpv::store_in_seconds_pure, this, _1, _2 ) ) )
- ( std::make_pair( boost::bind( &tpv::period_in_seconds, this, _1 )
- , boost::bind( &tpv::store_in_seconds, this, _1, _2 ) ) )
- ( std::make_pair( boost::bind( &tpv::period_in_minutes, this, _1 )
- , boost::bind( &tpv::store_in_minutes, this, _1, _2 ) ) )
- ( std::make_pair( boost::bind( &tpv::period_in_hours, this, _1 )
- , boost::bind( &tpv::store_in_hours, this, _1, _2 ) ) )
- ( std::make_pair( boost::bind( &tpv::period_in_days, this, _1 )
- , boost::bind( &tpv::store_in_days, this, _1, _2 ) ) )
+ handlers = list_of( std::make_pair( boost::bind( &tpv::period_in_seconds_pure, this, ::_1 )
+ , boost::bind( &tpv::store_in_seconds_pure, this, ::_1, ::_2 ) ) )
+ ( std::make_pair( boost::bind( &tpv::period_in_seconds, this, ::_1 )
+ , boost::bind( &tpv::store_in_seconds, this, ::_1, ::_2 ) ) )
+ ( std::make_pair( boost::bind( &tpv::period_in_minutes, this, ::_1 )
+ , boost::bind( &tpv::store_in_minutes, this, ::_1, ::_2 ) ) )
+ ( std::make_pair( boost::bind( &tpv::period_in_hours, this, ::_1 )
+ , boost::bind( &tpv::store_in_hours, this, ::_1, ::_2 ) ) )
+ ( std::make_pair( boost::bind( &tpv::period_in_days, this, ::_1 )
+ , boost::bind( &tpv::store_in_days, this, ::_1, ::_2 ) ) )
                           ;
         #endif
     }

Modified: sandbox/configurator/boost/configurator/option.hpp
==============================================================================
--- sandbox/configurator/boost/configurator/option.hpp (original)
+++ sandbox/configurator/boost/configurator/option.hpp 2010-12-11 03:20:36 EST (Sat, 11 Dec 2010)
@@ -1,5 +1,5 @@
-// detail/option.hpp
-// ~~~~~~~~~~~~~~~~~
+// option.hpp
+// ~~~~~~~~~~
 //
 // Copyright (C) 2010 Denis Shevchenko (for @ dshevchenko.biz)
 //
@@ -18,11 +18,7 @@
 /// \brief Main namespace of library.
 namespace cf {
 
-/// \namespace cf::detail
-/// \brief Details of realization.
-namespace detail {
-
-
+///
 struct option {
     option() {}
     explicit option( const std::string& _type_id, const std::string& _type_name ) :
@@ -48,7 +44,7 @@
 public:
     option& set_location( const std::string& _location ) {
         location.assign( _location.begin(), _location.end() );
- string_it end_it = boost::find_last( location, "::" ).begin();
+ detail::string_it end_it = boost::find_last( location, "::" ).begin();
         section.assign( location.begin(), end_it );
         return *this;
     }
@@ -116,7 +112,7 @@
 private:
     void check_semantic_correctness( const value_semantic& semantic ) const {
         if ( semantic < no_semantic || semantic > exp_record ) {
- o_stream what_happened;
+ detail::o_stream what_happened;
             what_happened << "Invalid semantic value '" << semantic
                           << "' for option '" << type_name
                           << "', use supported semantic only (see documentation)!"
@@ -136,50 +132,12 @@
     bool empty() const { return value.empty(); }
 };
 
-/// \struct pure_option
-/// \brief
-///
-/// Presents pure option obtained from configuration file.
-struct pure_option {
- pure_option() {}
- pure_option( const std::string& _location, const std::string& _value ) :
- location( _location.begin(), _location.end() )
- , value( _value.begin(), _value.end() ) {}
-public:
- std::string location;
- std::string value;
-public:
- bool empty() const {
- return value.empty();
- }
-
- bool operator==( const std::string& _location ) const {
- return _location == location;
- }
-
- bool operator==( const pure_option& another ) const {
- return another.location == location;
- }
-};
-
-inline bool operator<( const pure_option& left, const pure_option& right ) {
- return left.location < right.location;
-}
-
-} // namespace detail
-
-typedef detail::option option;
-
 typedef boost::ptr_vector< option > options;
 typedef options::iterator registered_option_it;
 typedef options::const_iterator registered_option_const_it;
 typedef registered_option_it option_it;
 typedef registered_option_const_it option_const_it;
 
-typedef detail::pure_option pure_option;
-typedef std::vector< pure_option > pure_options;
-typedef pure_options::iterator pure_option_it;
-
 } // namespace cf
 } // namespace boost
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk