From e81ddccc7daf4c5dc436a82bf3b2cb59fbbbddfe Mon Sep 17 00:00:00 2001 From: Daniel James Date: Wed, 27 Jan 2010 21:59:09 +0000 Subject: [PATCH] Avoid 'using namespace' as it confuses me. [SVN r59287] --- block.hpp | 2 +- detail/actions.cpp | 5 ++--- detail/actions.hpp | 19 +++++++++++-------- detail/actions_class.hpp | 2 +- detail/post_process.cpp | 4 +--- detail/quickbook.cpp | 13 ++++++------- doc_info.hpp | 2 +- grammars.hpp | 2 +- phrase.hpp | 2 +- syntax_highlight.hpp | 3 ++- 10 files changed, 27 insertions(+), 27 deletions(-) diff --git a/block.hpp b/block.hpp index 24c0adb..8179a01 100644 --- a/block.hpp +++ b/block.hpp @@ -24,7 +24,7 @@ namespace quickbook { - using namespace boost::spirit; + namespace qi = boost::spirit::qi; namespace ph = boost::phoenix; template diff --git a/detail/actions.cpp b/detail/actions.cpp index 720b442..f268d32 100644 --- a/detail/actions.cpp +++ b/detail/actions.cpp @@ -1224,9 +1224,8 @@ namespace quickbook if (err != 0) return err; // return early on error - typedef classic::position_iterator iterator_type; - iterator_type first(code.begin(), code.end(), file); - iterator_type last(code.end(), code.end()); + iterator first(code.begin(), code.end(), file); + iterator last(code.end(), code.end()); size_t fname_len = file.size(); bool is_python = fname_len >= 3 diff --git a/detail/actions.hpp b/detail/actions.hpp index 7435ed0..5734404 100644 --- a/detail/actions.hpp +++ b/detail/actions.hpp @@ -32,13 +32,16 @@ namespace quickbook { - using namespace boost::spirit; + namespace qi = boost::spirit::qi; namespace fs = boost::filesystem; + using boost::spirit::unused_type; - // TODO: This is defined in two places. - typedef qi::symbols string_symbols; + // TODO: This is defined in two places. + typedef qi::symbols string_symbols; - typedef classic::position_iterator iterator; + typedef boost::spirit::classic::position_iterator< + std::string::const_iterator> iterator; + typedef boost::spirit::classic::file_position file_position; typedef boost::iterator_range iterator_range; typedef qi::symbols string_symbols; typedef std::map attribute_map; @@ -584,8 +587,8 @@ namespace quickbook table_action(quickbook::actions& actions) : actions(actions) {} - template - struct result { typedef void type; }; + template + struct result { typedef void type; }; void operator()(boost::optional const&, std::string const&) const; @@ -648,8 +651,8 @@ namespace quickbook , section_level(section_level) , qualified_section_id(qualified_section_id) {} - template - struct result { typedef void type; }; + template + struct result { typedef void type; }; void operator()(boost::optional const&, iterator_range) const; diff --git a/detail/actions_class.hpp b/detail/actions_class.hpp index e727dd2..6883b11 100644 --- a/detail/actions_class.hpp +++ b/detail/actions_class.hpp @@ -15,7 +15,7 @@ namespace quickbook { - using namespace boost::spirit; + namespace qi = boost::spirit::qi; namespace fs = boost::filesystem; struct actions diff --git a/detail/post_process.cpp b/detail/post_process.cpp index 147b7a7..8132b8f 100644 --- a/detail/post_process.cpp +++ b/detail/post_process.cpp @@ -20,10 +20,8 @@ namespace quickbook { - using namespace boost::spirit; + namespace qi = boost::spirit::qi; namespace ph = boost::phoenix; - using namespace ph::arg_names; - using ph::bind; typedef std::string::const_iterator iter_type; struct printer diff --git a/detail/quickbook.cpp b/detail/quickbook.cpp index 106bf27..0fff7dc 100644 --- a/detail/quickbook.cpp +++ b/detail/quickbook.cpp @@ -31,7 +31,7 @@ namespace quickbook { - using namespace boost::spirit; + namespace qi = boost::spirit::qi; namespace fs = boost::filesystem; tm* current_time; // the current time tm* current_gm_time; // the current UTC time @@ -58,10 +58,9 @@ namespace quickbook return err; } - typedef classic::position_iterator iterator_type; - iterator_type first(storage.begin(), storage.end(), filein_); - iterator_type last(storage.end(), storage.end()); - iterator_type start = first; + iterator first(storage.begin(), storage.end(), filein_); + iterator last(storage.end(), storage.end()); + iterator start = first; doc_info_grammar l(actor); bool success = parse(first, last, l); @@ -80,14 +79,14 @@ namespace quickbook } } else { - classic::file_position const pos = first.get_position(); + file_position const pos = first.get_position(); detail::outerr(pos.file,pos.line) << "Doc Info error near column " << pos.column << ".\n"; } if (!success || first != last) { - classic::file_position const pos = first.get_position(); + file_position const pos = first.get_position(); detail::outerr(pos.file,pos.line) << "Syntax Error near column " << pos.column << ".\n"; ++actor.error_count; diff --git a/doc_info.hpp b/doc_info.hpp index 2674844..0b963c4 100644 --- a/doc_info.hpp +++ b/doc_info.hpp @@ -23,7 +23,7 @@ namespace quickbook { - using namespace boost::spirit; + namespace qi = boost::spirit::qi; namespace ph = boost::phoenix; template diff --git a/grammars.hpp b/grammars.hpp index 1247285..0939db2 100644 --- a/grammars.hpp +++ b/grammars.hpp @@ -16,7 +16,7 @@ namespace quickbook { - using namespace boost::spirit; + namespace qi = boost::spirit::qi; template struct phrase_grammar : qi::grammar diff --git a/phrase.hpp b/phrase.hpp index b50b65d..de91cc2 100644 --- a/phrase.hpp +++ b/phrase.hpp @@ -28,7 +28,7 @@ namespace quickbook { - using namespace boost::spirit; + namespace qi = boost::spirit::qi; namespace ph = boost::phoenix; template diff --git a/syntax_highlight.hpp b/syntax_highlight.hpp index 7b9ff6f..6c5730e 100644 --- a/syntax_highlight.hpp +++ b/syntax_highlight.hpp @@ -18,7 +18,8 @@ namespace quickbook { - using namespace boost::spirit; + namespace qi = boost::spirit::qi; + using boost::spirit::unused_type; template struct parse_escaped_impl