Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r68561 - branches/quickbook-filenames/tools/quickbook/src
From: dnljms_at_[hidden]
Date: 2011-01-30 06:26:57


Author: danieljames
Date: 2011-01-30 06:26:55 EST (Sun, 30 Jan 2011)
New Revision: 68561
URL: http://svn.boost.org/trac/boost/changeset/68561

Log:
Move error and warning functions into input_path.

I'll rename it after merging with trunk. I'm just collecting all the
input and output functions together.
Text files modified:
   branches/quickbook-filenames/tools/quickbook/src/doc_info_actions.cpp | 1
   branches/quickbook-filenames/tools/quickbook/src/input_path.cpp | 40 ++++++++++++++++++++++++++++++++++++++
   branches/quickbook-filenames/tools/quickbook/src/input_path.hpp | 9 ++++++++
   branches/quickbook-filenames/tools/quickbook/src/post_process.cpp | 2
   branches/quickbook-filenames/tools/quickbook/src/utils.cpp | 42 +--------------------------------------
   branches/quickbook-filenames/tools/quickbook/src/utils.hpp | 9 --------
   6 files changed, 53 insertions(+), 50 deletions(-)

Modified: branches/quickbook-filenames/tools/quickbook/src/doc_info_actions.cpp
==============================================================================
--- branches/quickbook-filenames/tools/quickbook/src/doc_info_actions.cpp (original)
+++ branches/quickbook-filenames/tools/quickbook/src/doc_info_actions.cpp 2011-01-30 06:26:55 EST (Sun, 30 Jan 2011)
@@ -13,6 +13,7 @@
 #include <boost/algorithm/string/join.hpp>
 #include "quickbook.hpp"
 #include "utils.hpp"
+#include "input_path.hpp"
 #include "actions_class.hpp"
 
 namespace quickbook

Modified: branches/quickbook-filenames/tools/quickbook/src/input_path.cpp
==============================================================================
--- branches/quickbook-filenames/tools/quickbook/src/input_path.cpp (original)
+++ branches/quickbook-filenames/tools/quickbook/src/input_path.cpp 2011-01-30 06:26:55 EST (Sun, 30 Jan 2011)
@@ -7,6 +7,7 @@
 =============================================================================*/
 
 #include <boost/program_options.hpp>
+#include <iostream>
 #include "input_path.hpp"
 #include "utils.hpp"
 
@@ -22,6 +23,10 @@
 #endif
 
 namespace quickbook {
+ extern bool ms_errors;
+}
+
+namespace quickbook {
 namespace detail {
 #if defined(_WIN32)
     namespace {
@@ -104,4 +109,39 @@
         return fs::path(result.get());
 #endif
     }
+
+ std::ostream& outerr()
+ {
+ return std::clog << "Error: ";
+ }
+
+ std::ostream& outerr(fs::path const& file, int line)
+ {
+ if (line >= 0)
+ {
+ if (ms_errors)
+ return std::clog << file.string() << "(" << line << "): error: ";
+ else
+ return std::clog << file.string() << ":" << line << ": error: ";
+ }
+ else
+ {
+ return std::clog << file.string() << ": error: ";
+ }
+ }
+
+ std::ostream& outwarn(fs::path const& file, int line)
+ {
+ if (line >= 0)
+ {
+ if (ms_errors)
+ return std::clog << file.string() << "(" << line << "): warning: ";
+ else
+ return std::clog << file.string() << ":" << line << ": warning: ";
+ }
+ else
+ {
+ return std::clog << file.string() << ": warning: ";
+ }
+ }
 }}

Modified: branches/quickbook-filenames/tools/quickbook/src/input_path.hpp
==============================================================================
--- branches/quickbook-filenames/tools/quickbook/src/input_path.hpp (original)
+++ branches/quickbook-filenames/tools/quickbook/src/input_path.hpp 2011-01-30 06:26:55 EST (Sun, 30 Jan 2011)
@@ -12,6 +12,7 @@
 #include <boost/filesystem/v3/path.hpp>
 #include <string>
 #include <stdexcept>
+#include <iostream>
 
 namespace quickbook
 {
@@ -48,6 +49,14 @@
     
         std::string path_to_generic(fs::path const&);
         fs::path generic_to_path(std::string const&);
+
+ // Preformats an error/warning message so that it can be parsed by
+ // common IDEs. Uses the ms_errors global to determine if VS format
+ // or GCC format. Returns the stream to continue ouput of the verbose
+ // error message.
+ std::ostream & outerr();
+ std::ostream & outerr(fs::path const& file, int line = -1);
+ std::ostream & outwarn(fs::path const& file, int line = -1);
     }
 }
 

Modified: branches/quickbook-filenames/tools/quickbook/src/post_process.cpp
==============================================================================
--- branches/quickbook-filenames/tools/quickbook/src/post_process.cpp (original)
+++ branches/quickbook-filenames/tools/quickbook/src/post_process.cpp 2011-01-30 06:26:55 EST (Sun, 30 Jan 2011)
@@ -7,7 +7,7 @@
     http://www.boost.org/LICENSE_1_0.txt)
 =============================================================================*/
 #include "post_process.hpp"
-#include "utils.hpp"
+#include "input_path.hpp"
 #include <boost/spirit/include/classic_core.hpp>
 #include <boost/bind.hpp>
 #include <set>

Modified: branches/quickbook-filenames/tools/quickbook/src/utils.cpp
==============================================================================
--- branches/quickbook-filenames/tools/quickbook/src/utils.cpp (original)
+++ branches/quickbook-filenames/tools/quickbook/src/utils.cpp 2011-01-30 06:26:55 EST (Sun, 30 Jan 2011)
@@ -8,6 +8,7 @@
     http://www.boost.org/LICENSE_1_0.txt)
 =============================================================================*/
 #include "utils.hpp"
+#include "input_path.hpp"
 #include <boost/spirit/include/classic_core.hpp>
 #include <boost/filesystem/v3/fstream.hpp>
 
@@ -15,13 +16,9 @@
 #include <cstring>
 #include <stdexcept>
 #include <fstream>
-#include <iostream>
+#include <ostream>
 #include <map>
 
-namespace quickbook {
- extern bool ms_errors;
-}
-
 namespace quickbook { namespace detail
 {
     void print_char(char ch, std::ostream& out)
@@ -137,41 +134,6 @@
         return uri;
     }
 
- std::ostream& outerr()
- {
- return std::clog << "Error: ";
- }
-
- std::ostream& outerr(fs::path const& file, int line)
- {
- if (line >= 0)
- {
- if (ms_errors)
- return std::clog << file.string() << "(" << line << "): error: ";
- else
- return std::clog << file.string() << ":" << line << ": error: ";
- }
- else
- {
- return std::clog << file.string() << ": error: ";
- }
- }
-
- std::ostream& outwarn(fs::path const& file, int line)
- {
- if (line >= 0)
- {
- if (ms_errors)
- return std::clog << file.string() << "(" << line << "): warning: ";
- else
- return std::clog << file.string() << ":" << line << ": warning: ";
- }
- else
- {
- return std::clog << file.string() << ": warning: ";
- }
- }
-
     // Read the first few bytes in a file to see it starts with a byte order
     // mark. If it doesn't, then write the characters we've already read in.
     // Although, given how UTF-8 works, if we've read anything in, the files

Modified: branches/quickbook-filenames/tools/quickbook/src/utils.hpp
==============================================================================
--- branches/quickbook-filenames/tools/quickbook/src/utils.hpp (original)
+++ branches/quickbook-filenames/tools/quickbook/src/utils.hpp 2011-01-30 06:26:55 EST (Sun, 30 Jan 2011)
@@ -11,7 +11,6 @@
 #define BOOST_SPIRIT_QUICKBOOK_UTILS_HPP
 
 #include <string>
-#include <iostream>
 #include <cctype>
 #include <boost/ref.hpp>
 #include <boost/assert.hpp>
@@ -61,14 +60,6 @@
 
     std::string escape_uri(std::string uri);
 
- // Preformats an error/warning message so that it can be parsed by
- // common IDEs. Uses the ms_errors global to determine if VS format
- // or GCC format. Returns the stream to continue ouput of the verbose
- // error message.
- std::ostream & outerr();
- std::ostream & outerr(fs::path const& file, int line = -1);
- std::ostream & outwarn(fs::path const& file, int line = -1);
-
     // load file into memory with extra trailing newlines to eliminate
     // the need to check for end of file in the grammar.
     int load(fs::path const& filename, std::string& storage);


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