1 // inspector header --------------------------------------------------------//
3 // Copyright Beman Dawes 2002.
4 // Copyright Rene Rivera 2004.
5 // Copyright Gennaro Prota 2006.
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)
11 #ifndef BOOST_INSPECTOR_HPP
12 #define BOOST_INSPECTOR_HPP
18 #include "boost/filesystem/path.hpp"
21 using boost::filesystem::path;
27 typedef std::set< string > string_set;
29 const char * line_break();
31 path search_root_path();
39 virtual ~inspector() {}
41 virtual const char * name() const = 0; // example: "tab-check"
42 virtual const char * desc() const = 0; // example: "verify no tabs"
46 const string & /*library_name*/, // "filesystem"
47 const path & /*full_path*/ ) {} // "c:/foo/boost/filesystem/path.hpp"
49 // called only for registered leaf() signatures:
51 const string & library_name, // "filesystem"
52 const path & full_path, // "c:/foo/boost/filesystem/path.hpp"
53 const string & contents ) // contents of file
57 // called after all paths visited, but still in time to call error():
58 virtual void close() {}
60 // callback used by constructor to register leaf() signature.
61 // Signature can be a full file name (Jamfile) or partial (.cpp)
62 void register_signature( const string & signature );
63 const string_set & signatures() const { return m_signatures; }
65 // report error callback (from inspect(), close() ):
67 const string & library_name,
68 const path & full_path,
70 int line_number =0 ); // 0 if not available or not applicable
73 string_set m_signatures;
76 // for inspection of source code of one form or other
77 class source_inspector : public inspector
80 // registers the basic set of known source signatures
84 // for inspection of hypertext, specifically html
85 class hypertext_inspector : public inspector
88 // registers the set of known html source signatures
89 hypertext_inspector();
92 inline string relative_to( const path & src_arg, const path & base_arg )
94 path base( base_arg );
96 string::size_type pos( base.string().size() );
97 path src( src_arg.string().substr(pos) );
99 return src.string().substr(1);
102 string impute_library( const path & full_dir_path );
107 #endif // BOOST_INSPECTOR_HPP