Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/tools/quickbook/detail/utils.hpp @ 50

Last change on this file since 50 was 29, checked in by landauf, 17 years ago

updated boost from 1_33_1 to 1_34_1

File size: 2.3 KB
Line 
1/*=============================================================================
2    Copyright (c) 2002 2004 Joel de Guzman
3    Copyright (c) 2004 Eric Niebler
4    http://spirit.sourceforge.net/
5
6    Use, modification and distribution is subject to the Boost Software
7    License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
8    http://www.boost.org/LICENSE_1_0.txt)
9=============================================================================*/
10#if !defined(BOOST_SPIRIT_QUICKBOOK_UTILS_HPP)
11#define BOOST_SPIRIT_QUICKBOOK_UTILS_HPP
12
13#include <string>
14#include <iostream>
15#include <cctype>
16#include <boost/ref.hpp>
17#include <boost/assert.hpp>
18
19namespace quickbook { namespace detail
20{
21    void
22    print_char(char ch, std::ostream& out);
23
24    void
25    print_string(std::basic_string<char> const& str, std::ostream& out);
26
27    void
28    print_space(char ch, std::ostream& out);
29
30    void
31    convert_nbsp(std::basic_string<char>& str);
32
33    char
34    filter_identifier_char(char ch);
35
36    template <typename Iterator>
37    inline std::string
38    make_identifier(Iterator const& first, Iterator const& last)
39    {
40        std::string out_name;
41        for (Iterator i = first; i != last; ++i)
42            out_name += filter_identifier_char(*i);
43        return out_name;
44    }
45
46    template <typename T>
47    struct var_wrapper
48        : public ::boost::reference_wrapper<T>
49    {
50        typedef ::boost::reference_wrapper<T> parent;
51
52        explicit inline var_wrapper(T& t) : parent(t) {}
53
54        inline T& operator()() const { return parent::get(); }
55    };
56
57    template <typename T>
58    inline var_wrapper<T>
59    var(T& t)
60    {
61        return var_wrapper<T>(t);
62    }
63
64    // un-indent a code segment
65    void unindent(std::string& program);
66
67    // remove the extension from a filename
68    std::string
69    remove_extension(std::string const& filename);
70   
71    std::string escape_uri(std::string uri);
72   
73    // Preformats an error/warning message so that it can be parsed by
74    // common IDEs. Uses the ms_errors global to determine if VS format
75    // or GCC format. Returns the stream to continue ouput of the verbose
76    // error message.
77    std::ostream & outerr(const std::string & file, int line);
78    std::ostream & outwarn(const std::string & file, int line);
79}}
80
81#endif // BOOST_SPIRIT_QUICKBOOK_UTILS_HPP
82
Note: See TracBrowser for help on using the repository browser.