Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r86644 - trunk/tools/quickbook/src
From: dnljms_at_[hidden]
Date: 2013-11-12 04:15:41


Author: danieljames
Date: 2013-11-12 04:15:40 EST (Tue, 12 Nov 2013)
New Revision: 86644
URL: http://svn.boost.org/trac/boost/changeset/86644

Log:
Rename structs and variables for include paths.

Text files modified:
   trunk/tools/quickbook/src/actions.cpp | 32 ++++++++++++++++----------------
   trunk/tools/quickbook/src/include_paths.cpp | 22 +++++++++++-----------
   trunk/tools/quickbook/src/include_paths.hpp | 18 +++++++++++-------
   trunk/tools/quickbook/src/state.cpp | 8 ++++----
   trunk/tools/quickbook/src/state.hpp | 7 ++++---
   trunk/tools/quickbook/src/state_save.hpp | 2 +-
   6 files changed, 47 insertions(+), 42 deletions(-)

Modified: trunk/tools/quickbook/src/actions.cpp
==============================================================================
--- trunk/tools/quickbook/src/actions.cpp Tue Nov 12 04:15:17 2013 (r86643)
+++ trunk/tools/quickbook/src/actions.cpp 2013-11-12 04:15:40 EST (Tue, 12 Nov 2013) (r86644)
@@ -1801,7 +1801,7 @@
     }
 
     void load_quickbook(quickbook::state& state,
- include_search_return const& paths,
+ quickbook_path const& path,
             value::tag_type load_type,
             value const& include_doc_id = value())
     {
@@ -1824,8 +1824,8 @@
                 qbk_version_n >= 106u ? state_save::scope_callables :
                 state_save::scope_macros);
 
- state.current_file = load(paths.filename); // Throws load_error
- state.filename_relative = paths.filename_relative;
+ state.current_file = load(path.file_path); // Throws load_error
+ state.abstract_file_path = path.abstract_file_path;
             state.imported = (load_type == block_tags::import);
 
             // update the __FILENAME__ macro
@@ -1843,7 +1843,7 @@
     }
 
     void load_source_file(quickbook::state& state,
- include_search_return const& paths,
+ quickbook_path const& path,
             value::tag_type load_type,
             string_iterator first,
             value const& include_doc_id = value())
@@ -1851,11 +1851,11 @@
         assert(load_type == block_tags::include ||
             load_type == block_tags::import);
 
- std::string ext = paths.filename.extension().generic_string();
+ std::string ext = path.file_path.extension().generic_string();
         std::vector<template_symbol> storage;
         // Throws load_error
         state.error_count +=
- load_snippets(paths.filename, storage, ext, load_type);
+ load_snippets(path.file_path, storage, ext, load_type);
 
         if (load_type == block_tags::include)
         {
@@ -1903,39 +1903,39 @@
         path_parameter parameter = check_path(values.consume(), state);
         values.finish();
 
- std::set<include_search_return> search =
+ std::set<quickbook_path> search =
             include_search(parameter, state, first);
- std::set<include_search_return>::iterator i = search.begin();
- std::set<include_search_return>::iterator e = search.end();
+ std::set<quickbook_path>::iterator i = search.begin();
+ std::set<quickbook_path>::iterator e = search.end();
         for (; i != e; ++i)
         {
- include_search_return const & paths = *i;
+ quickbook_path const & path = *i;
             try {
                 if (qbk_version_n >= 106)
                 {
                     if (state.imported && include.get_tag() == block_tags::include)
                         return;
 
- std::string ext = paths.filename.extension().generic_string();
+ std::string ext = path.file_path.extension().generic_string();
 
                     if (ext == ".qbk" || ext == ".quickbook")
                     {
- load_quickbook(state, paths, include.get_tag(), include_doc_id);
+ load_quickbook(state, path, include.get_tag(), include_doc_id);
                     }
                     else
                     {
- load_source_file(state, paths, include.get_tag(), first, include_doc_id);
+ load_source_file(state, path, include.get_tag(), first, include_doc_id);
                     }
                 }
                 else
                 {
                     if (include.get_tag() == block_tags::include)
                     {
- load_quickbook(state, paths, include.get_tag(), include_doc_id);
+ load_quickbook(state, path, include.get_tag(), include_doc_id);
                     }
                     else
                     {
- load_source_file(state, paths, include.get_tag(), first, include_doc_id);
+ load_source_file(state, path, include.get_tag(), first, include_doc_id);
                     }
                 }
             }
@@ -1944,7 +1944,7 @@
 
                 detail::outerr(state.current_file, first)
                     << "Loading file "
- << paths.filename
+ << path.file_path
                     << ": "
                     << e.what()
                     << std::endl;

Modified: trunk/tools/quickbook/src/include_paths.cpp
==============================================================================
--- trunk/tools/quickbook/src/include_paths.cpp Tue Nov 12 04:15:17 2013 (r86643)
+++ trunk/tools/quickbook/src/include_paths.cpp 2013-11-12 04:15:40 EST (Tue, 12 Nov 2013) (r86644)
@@ -61,11 +61,11 @@
     // Search include path
     //
 
- std::set<include_search_return> include_search(
+ std::set<quickbook_path> include_search(
             path_parameter const& parameter,
             quickbook::state& state, string_iterator pos)
     {
- std::set<include_search_return> result;
+ std::set<quickbook_path> result;
 
         fs::path path = detail::generic_to_path(parameter.value);
 
@@ -78,9 +78,9 @@
             // See if it can be found locally first.
             if (state.dependencies.add_dependency(local_path))
             {
- result.insert(include_search_return(
+ result.insert(quickbook_path(
                     local_path,
- state.filename_relative.parent_path() / path));
+ state.abstract_file_path.parent_path() / path));
                 return result;
             }
 
@@ -90,7 +90,7 @@
 
                 if (state.dependencies.add_dependency(full))
                 {
- result.insert(include_search_return(full, path));
+ result.insert(quickbook_path(full, path));
                     return result;
                 }
             }
@@ -98,7 +98,7 @@
         else
         {
             if (state.dependencies.add_dependency(path)) {
- result.insert(include_search_return(path, path));
+ result.insert(quickbook_path(path, path));
                 return result;
             }
         }
@@ -113,13 +113,13 @@
     }
 
     //
- // include_search_return
+ // quickbook_path
     //
 
- bool include_search_return::operator<(include_search_return const& other) const
+ bool quickbook_path::operator<(quickbook_path const& other) const
     {
- if (filename_relative < other.filename_relative) return true;
- else if (other.filename_relative < filename_relative) return false;
- else return filename < other.filename;
+ if (abstract_file_path < other.abstract_file_path) return true;
+ else if (other.abstract_file_path < abstract_file_path) return false;
+ else return file_path < other.file_path;
     }
 }

Modified: trunk/tools/quickbook/src/include_paths.hpp
==============================================================================
--- trunk/tools/quickbook/src/include_paths.hpp Tue Nov 12 04:15:17 2013 (r86643)
+++ trunk/tools/quickbook/src/include_paths.hpp 2013-11-12 04:15:40 EST (Tue, 12 Nov 2013) (r86644)
@@ -36,18 +36,22 @@
 
     path_parameter check_path(value const& path, quickbook::state& state);
 
- struct include_search_return
+ struct quickbook_path
     {
- include_search_return(fs::path const& x, fs::path const& y)
- : filename(x), filename_relative(y) {}
+ quickbook_path(fs::path const& x, fs::path const& y)
+ : file_path(x), abstract_file_path(y) {}
 
- fs::path filename;
- fs::path filename_relative;
+ // The actual location of the file.
+ fs::path file_path;
 
- bool operator<(include_search_return const& other) const;
+ // A machine independent representation of the file's
+ // path - not unique per-file
+ fs::path abstract_file_path;
+
+ bool operator<(quickbook_path const& other) const;
     };
 
- std::set<include_search_return> include_search(path_parameter const&,
+ std::set<quickbook_path> include_search(path_parameter const&,
             quickbook::state& state, string_iterator pos);
 }
 

Modified: trunk/tools/quickbook/src/state.cpp
==============================================================================
--- trunk/tools/quickbook/src/state.cpp Tue Nov 12 04:15:17 2013 (r86643)
+++ trunk/tools/quickbook/src/state.cpp 2013-11-12 04:15:40 EST (Tue, 12 Nov 2013) (r86644)
@@ -50,7 +50,7 @@
         , source_mode_next()
         , source_mode_next_pos()
         , current_file(0)
- , filename_relative(filein_.filename())
+ , abstract_file_path(filein_.filename())
 
         , template_depth(0)
         , min_section_level(1)
@@ -81,7 +81,7 @@
 
     void state::update_filename_macro() {
         *boost::spirit::classic::find(macro, "__FILENAME__")
- = detail::encode_string(detail::path_to_generic(filename_relative));
+ = detail::encode_string(detail::path_to_generic(abstract_file_path));
     }
     
     void state::push_output() {
@@ -103,7 +103,7 @@
         , qbk_version(qbk_version_n)
         , imported(state.imported)
         , current_file(state.current_file)
- , filename_relative(state.filename_relative)
+ , abstract_file_path(state.abstract_file_path)
         , xinclude_base(state.xinclude_base)
         , source_mode(state.source_mode)
         , macro()
@@ -124,7 +124,7 @@
         boost::swap(qbk_version_n, qbk_version);
         boost::swap(state.imported, imported);
         boost::swap(state.current_file, current_file);
- boost::swap(state.filename_relative, filename_relative);
+ boost::swap(state.abstract_file_path, abstract_file_path);
         boost::swap(state.xinclude_base, xinclude_base);
         boost::swap(state.source_mode, source_mode);
         if (scope & scope_output) {

Modified: trunk/tools/quickbook/src/state.hpp
==============================================================================
--- trunk/tools/quickbook/src/state.hpp Tue Nov 12 04:15:17 2013 (r86643)
+++ trunk/tools/quickbook/src/state.hpp 2013-11-12 04:15:40 EST (Tue, 12 Nov 2013) (r86644)
@@ -61,9 +61,10 @@
         source_mode_type source_mode_next;
         value source_mode_next_pos;
         file_ptr current_file;
- fs::path filename_relative; // for the __FILENAME__ macro.
- // (relative to the original file
- // or include path).
+
+ // A machine independent representation of the current file's
+ // path - not unique per-file.
+ fs::path abstract_file_path;
 
     // state saved for templates.
         int template_depth;

Modified: trunk/tools/quickbook/src/state_save.hpp
==============================================================================
--- trunk/tools/quickbook/src/state_save.hpp Tue Nov 12 04:15:17 2013 (r86643)
+++ trunk/tools/quickbook/src/state_save.hpp 2013-11-12 04:15:40 EST (Tue, 12 Nov 2013) (r86644)
@@ -38,7 +38,7 @@
         bool imported;
         std::string doc_type;
         file_ptr current_file;
- fs::path filename_relative;
+ fs::path abstract_file_path;
         fs::path xinclude_base;
         source_mode_type source_mode;
         string_symbols macro;


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