Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/tools/inspect/inspector.hpp @ 29

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

updated boost from 1_33_1 to 1_34_1

File size: 2.7 KB
Line 
1//  inspector header  --------------------------------------------------------//
2
3//  Copyright Beman Dawes 2002.
4//  Copyright Rene Rivera 2004.
5//  Copyright Gennaro Prota 2006.
6//
7//  Distributed under the Boost Software License, Version 1.0.
8//  (See accompanying file LICENSE_1_0.txt or copy at
9//  http://www.boost.org/LICENSE_1_0.txt)
10
11#ifndef BOOST_INSPECTOR_HPP
12#define BOOST_INSPECTOR_HPP
13
14#include <set>
15#include <iostream>
16#include <ostream>
17#include <string>
18#include "boost/filesystem/path.hpp"
19
20using std::string;
21using boost::filesystem::path;
22
23namespace boost
24{
25  namespace inspect
26  {
27    typedef std::set< string > string_set;
28
29    class inspector
30    {
31    protected:
32        inspector() {}
33
34    public:
35      virtual ~inspector() {}
36
37      virtual const char * name() const = 0; // example: "tab-check"
38      virtual const char * desc() const = 0; // example: "verify no tabs"
39
40      // always called:
41      virtual void inspect(
42        const string & /*library_name*/, // "filesystem"
43        const path & /*full_path*/ ) {}  // "c:/foo/boost/filesystem/path.hpp"
44
45      // called only for registered leaf() signatures:
46      virtual void inspect(
47        const string & library_name, // "filesystem"
48        const path & full_path,      // "c:/foo/boost/filesystem/path.hpp"
49        const string & contents )    // contents of file
50      = 0
51      ;
52
53      // called after all paths visited, but still in time to call error():
54      virtual void close() {}
55
56      // callback used by constructor to register leaf() signature.
57      // Signature can be a full file name (Jamfile) or partial (.cpp)
58      void register_signature( const string & signature );
59      const string_set & signatures() const { return m_signatures; }
60
61      // report error callback (from inspect(), close() ):
62      void error(
63        const string & library_name,
64        const path & full_path,
65        const string & msg );
66
67    private:
68      string_set m_signatures;
69    };
70
71    // for inspection of source code of one form or other
72    class source_inspector : public inspector
73    {
74    public:
75      // registers the basic set of known source signatures
76      source_inspector();
77    };
78
79    // for inspection of hypertext, specifically html
80    class hypertext_inspector : public inspector
81    {
82    public:
83      // registers the set of known html source signatures
84      hypertext_inspector();
85    };
86
87    inline string relative_to( const path & src_arg, const path & base_arg )
88    {
89      path base( base_arg );
90      base.normalize();
91      string::size_type pos( base.string().size() );
92      path src( src_arg.string().substr(pos) );
93      src.normalize();
94      return src.string().substr(1);
95    }
96
97    string impute_library( const path & full_dir_path );
98
99  }
100}
101
102#endif // BOOST_INSPECTOR_HPP
103
Note: See TracBrowser for help on using the repository browser.