diff --git a/src/native_text.cpp b/src/native_text.cpp index b5d9d0e..6597d6f 100644 --- a/src/native_text.cpp +++ b/src/native_text.cpp @@ -25,12 +25,15 @@ #include #endif -namespace quickbook { - extern bool ms_errors; -} - namespace quickbook { namespace detail { + namespace { + bool ms_errors = false; + } + + void set_ms_errors(bool x) { + ms_errors = x; + } // This is used for converting paths to UTF-8 on cygin. // Might be better not to use a windows @@ -113,7 +116,7 @@ namespace detail { // https://en.wikipedia.org/wiki/File_URI_scheme std::string file_path_to_url(fs::path const& x) { - // TODO: Maybe should throw an exception if this doesn't understand the path. + // TODO: Maybe some kind of error if this doesn't understand the path. // TODO: Might need a special cygwin implementation. // TODO: What if x.has_root_name() && !x.has_root_directory()? // TODO: What does Boost.Filesystem do for '//localhost/c:/path'? diff --git a/src/native_text.hpp b/src/native_text.hpp index f38f311..7d8f56a 100644 --- a/src/native_text.hpp +++ b/src/native_text.hpp @@ -132,9 +132,10 @@ namespace quickbook ostream& out(); // Preformats an error/warning message so that it can be parsed by - // common IDEs. Uses the ms_errors global to determine if VS format + // common IDEs. Set 'ms_errors' to determine if VS format // or GCC format. Returns the stream to continue ouput of the verbose // error message. + void set_ms_errors(bool); ostream& outerr(); ostream& outerr(fs::path const& file, int line = -1); ostream& outwarn(fs::path const& file, int line = -1); diff --git a/src/quickbook.cpp b/src/quickbook.cpp index 8c028be..3447a46 100644 --- a/src/quickbook.cpp +++ b/src/quickbook.cpp @@ -51,7 +51,6 @@ namespace quickbook tm* current_gm_time; // the current UTC time bool debug_mode; // for quickbook developers only bool self_linked_headers; - bool ms_errors = false; // output errors/warnings as if for VS std::vector include_path; std::vector preset_defines; fs::path image_location; @@ -378,8 +377,7 @@ main(int argc, char* argv[]) return 0; } - if (vm.count("ms-errors")) - quickbook::ms_errors = true; + quickbook::detail::set_ms_errors(vm.count("ms-errors")); if (vm.count("no-pretty-print")) parse_document_options.pretty_print = false;