|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r67272 - in sandbox/configurator: boost/configurator boost/configurator/detail libs/configurator/doc
From: for.dshevchenko_at_[hidden]
Date: 2010-12-16 03:00:34
Author: dshevchenko
Date: 2010-12-16 03:00:28 EST (Thu, 16 Dec 2010)
New Revision: 67272
URL: http://svn.boost.org/trac/boost/changeset/67272
Log:
Edging
Text files modified:
sandbox/configurator/boost/configurator/configurator.hpp | 6 +++++-
sandbox/configurator/boost/configurator/configurator_settings.hpp | 30 ++++++++++++++++++++++++++----
sandbox/configurator/boost/configurator/detail/pure_options_obtainer.hpp | 23 ++++++++++++++---------
sandbox/configurator/libs/configurator/doc/config_file_customizing.html | 9 +--------
4 files changed, 46 insertions(+), 22 deletions(-)
Modified: sandbox/configurator/boost/configurator/configurator.hpp
==============================================================================
--- sandbox/configurator/boost/configurator/configurator.hpp (original)
+++ sandbox/configurator/boost/configurator/configurator.hpp 2010-12-16 03:00:28 EST (Thu, 16 Dec 2010)
@@ -51,7 +51,11 @@
, options_obtainer( settings_of_configurator.option_name_value_separator
, sections_separator
, registered_options
- , settings_of_configurator.case_sensitivity )
+ , settings_of_configurator.case_sensitivity
+ , settings_of_configurator.open_section_edging_begin
+ , settings_of_configurator.open_section_edging_end
+ , settings_of_configurator.close_section_edging_begin
+ , settings_of_configurator.close_section_edging_end )
, check_incorrect_options( registered_options, sections_separator )
, check_necessary_options( registered_options, sections_separator )
, check_options_values_semantics( registered_options, sections_separator )
Modified: sandbox/configurator/boost/configurator/configurator_settings.hpp
==============================================================================
--- sandbox/configurator/boost/configurator/configurator_settings.hpp (original)
+++ sandbox/configurator/boost/configurator/configurator_settings.hpp 2010-12-16 03:00:28 EST (Thu, 16 Dec 2010)
@@ -28,13 +28,21 @@
, one_line_comment_sign( "//" )
, multi_line_comment_begin_sign( "/*" )
, multi_line_comment_end_sign( "*/" )
- , case_sensitivity( false ) {}
+ , case_sensitivity( false )
+ , open_section_edging_begin( "<" )
+ , open_section_edging_end( ">" )
+ , close_section_edging_begin( "</" )
+ , close_section_edging_end( ">" ) {}
public:
char option_name_value_separator;
std::string one_line_comment_sign;
std::string multi_line_comment_begin_sign;
std::string multi_line_comment_end_sign;
bool case_sensitivity;
+ std::string open_section_edging_begin;
+ std::string open_section_edging_end;
+ std::string close_section_edging_begin;
+ std::string close_section_edging_end;
public:
configurator_settings& set_one_line_comment_sign( const std::string& sign ) {
one_line_comment_sign = sign;
@@ -48,19 +56,19 @@
multi_line_comment_end_sign = end;
return *this;
}
-
+private:
void check_multi_line_comment_signs_validity( const std::string& begin
, const std::string& end ) const {
if ( begin == end ) {
detail::notify( "Incorrect multi-line comments signs, it cannot be equal!" );
} else {}
}
-
+public:
configurator_settings& set_case_sensitivity_for_names() {
case_sensitivity = true;
return *this;
}
-
+public:
configurator_settings& set_name_value_separator( char separator ) {
option_name_value_separator = separator;
check_separator_validity();
@@ -82,6 +90,20 @@
//
return *this;
}
+public:
+ configurator_settings& set_open_section_edging( const std::string& begin
+ , const std::string& end ) {
+ open_section_edging_begin = begin;
+ open_section_edging_end = end;
+ return *this;
+ }
+
+ configurator_settings& set_close_section_edging( const std::string& begin
+ , const std::string& end ) {
+ close_section_edging_begin = begin;
+ close_section_edging_end = end;
+ return *this;
+ }
};
} // 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-16 03:00:28 EST (Thu, 16 Dec 2010)
@@ -49,15 +49,19 @@
pure_options_obtainer( const char& _option_name_value_separator
, const std::string& _sections_separator
, const options& _registered_options
- , const bool& _case_sensitivity_for_names ) :
+ , const bool& _case_sensitivity_for_names
+ , const std::string& _open_section_tag_begin_sign
+ , const std::string& _open_section_tag_end_sign
+ , const std::string& _close_section_tag_begin_sign
+ , const std::string& _close_section_tag_end_sign) :
option_name_value_separator( _option_name_value_separator )
, sections_separator( _sections_separator )
, registered_options( _registered_options )
, case_sensitivity_for_names( _case_sensitivity_for_names )
- , open_section_tag_begin_sign( "<" )
- , open_section_tag_end_sign( ">" )
- , close_section_tag_begin_sign( "</" )
- , close_section_tag_end_sign( ">" ) {
+ , open_section_tag_begin_sign( _open_section_tag_begin_sign )
+ , open_section_tag_end_sign( _open_section_tag_end_sign )
+ , close_section_tag_begin_sign( _close_section_tag_begin_sign )
+ , close_section_tag_end_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 )
@@ -71,10 +75,11 @@
const options& registered_options;
const bool& case_sensitivity_for_names;
private:
- std::string open_section_tag_begin_sign;
- std::string open_section_tag_end_sign;
- std::string close_section_tag_begin_sign;
- std::string close_section_tag_end_sign;
+ const std::string& open_section_tag_begin_sign;
+ const std::string& open_section_tag_end_sign;
+ const std::string& close_section_tag_begin_sign;
+ const std::string& close_section_tag_end_sign;
+private:
std::string current_section_path;
private:
string_handlers handlers;
Modified: sandbox/configurator/libs/configurator/doc/config_file_customizing.html
==============================================================================
--- sandbox/configurator/libs/configurator/doc/config_file_customizing.html (original)
+++ sandbox/configurator/libs/configurator/doc/config_file_customizing.html 2010-12-16 03:00:28 EST (Thu, 16 Dec 2010)
@@ -169,18 +169,11 @@
</pre>
Changes may be more significant:
<pre class="cpp">
-int main( int argc, char* argv[] ) {
- try {
+ // ...
boost::cf::configurator conf;
conf.settings().set_open_section_edging( "", "{" );
conf.settings().set_close_section_edging( "}", "" );
// ...
- } catch ( const std::exception& exc ) {
- std::cerr << exc.what() << std::endl;
- }
-
- return 0;
-}
</pre>
In this case we can write:
<pre class="config">
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