| [29] | 1 | //  link_check header  -------------------------------------------------------// | 
|---|
 | 2 |  | 
|---|
 | 3 | //  Copyright Beman Dawes 2002 | 
|---|
 | 4 | //  Copyright Rene Rivera 2004. | 
|---|
 | 5 | //  Distributed under the Boost Software License, Version 1.0. | 
|---|
 | 6 | //  (See accompanying file LICENSE_1_0.txt or copy at | 
|---|
 | 7 | //  http://www.boost.org/LICENSE_1_0.txt) | 
|---|
 | 8 |  | 
|---|
 | 9 | #ifndef BOOST_LINK_CHECK_HPP | 
|---|
 | 10 | #define BOOST_LINK_CHECK_HPP | 
|---|
 | 11 |  | 
|---|
 | 12 | #include <map> | 
|---|
 | 13 |  | 
|---|
 | 14 | #include "inspector.hpp" | 
|---|
 | 15 |  | 
|---|
 | 16 | namespace boost | 
|---|
 | 17 | { | 
|---|
 | 18 |   namespace inspect | 
|---|
 | 19 |   { | 
|---|
 | 20 |     const int m_linked_to = 1; | 
|---|
 | 21 |     const int m_present = 2; | 
|---|
 | 22 |  | 
|---|
 | 23 |     class link_check : public hypertext_inspector | 
|---|
 | 24 |     { | 
|---|
 | 25 |       long m_broken_errors; | 
|---|
 | 26 |       long m_unlinked_errors; | 
|---|
 | 27 |       long m_invalid_errors; | 
|---|
 | 28 |       long m_bookmark_errors; | 
|---|
 | 29 |  | 
|---|
 | 30 |       typedef std::map< string, int > m_path_map; | 
|---|
 | 31 |       m_path_map m_paths; // first() is relative initial_path() | 
|---|
 | 32 |  | 
|---|
 | 33 |       void do_url( const string & url, | 
|---|
 | 34 |         const string & library_name, const path & full_source_path ); | 
|---|
 | 35 |     public: | 
|---|
 | 36 |  | 
|---|
 | 37 |       link_check(); | 
|---|
 | 38 |       virtual const char * name() const { return "*A*"; } | 
|---|
 | 39 |       virtual const char * desc() const { return "invalid bookmarks, invalid urls, broken links, unlinked files"; } | 
|---|
 | 40 |  | 
|---|
 | 41 |       virtual void inspect( | 
|---|
 | 42 |         const std::string & library_name, | 
|---|
 | 43 |         const path & full_path ); | 
|---|
 | 44 |  | 
|---|
 | 45 |       virtual void inspect( | 
|---|
 | 46 |         const std::string & library_name, | 
|---|
 | 47 |         const path & full_path, | 
|---|
 | 48 |         const std::string & contents ); | 
|---|
 | 49 |  | 
|---|
 | 50 |       virtual void close(); | 
|---|
 | 51 |  | 
|---|
 | 52 |       virtual ~link_check() | 
|---|
 | 53 |         { | 
|---|
 | 54 |           std::cout << "  " << m_bookmark_errors << " bookmarks with invalid characters\n"; | 
|---|
 | 55 |           std::cout << "  " << m_invalid_errors << " invalid urls\n"; | 
|---|
 | 56 |           std::cout << "  " << m_broken_errors << " broken links\n"; | 
|---|
 | 57 |           std::cout << "  " << m_unlinked_errors << " unlinked files\n"; | 
|---|
 | 58 |         } | 
|---|
 | 59 |     }; | 
|---|
 | 60 |   } | 
|---|
 | 61 | } | 
|---|
 | 62 |  | 
|---|
 | 63 | #endif // BOOST_LINK_CHECK_HPP | 
|---|