3 * Copyright (c) 2003 Dr John Maddock
4 * Use, modification and distribution is subject to the
5 * Boost Software License, Version 1.0. (See accompanying file
6 * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
16 #include <boost/filesystem/path.hpp>
18 namespace fs
= boost::filesystem
;
25 int compare_paths(const fs::path
& a
, const fs::path
& b
);
26 inline bool equal_paths(const fs::path
& a
, const fs::path
& b
)
27 { return compare_paths(a
, b
) == 0; }
31 bool operator()(const fs::path
& a
, const fs::path
& b
)const
32 { return compare_paths(a
, b
) < 0; }
37 std::set
<fs::path
, path_less
> files
;
38 std::set
<std::string
> authors
;
41 class bcp_implementation
42 : public bcp_application
46 ~bcp_implementation();
49 // the following are the overridden virtuals from the base class:
51 void enable_list_mode();
52 void enable_summary_list_mode();
53 void enable_cvs_mode();
54 void enable_svn_mode();
55 void enable_unix_lines();
56 void enable_scan_mode();
57 void enable_license_mode();
58 void enable_bsl_convert_mode();
59 void enable_bsl_summary_mode();
60 void set_boost_path(const char* p
);
61 void set_destination(const char* p
);
62 void add_module(const char* p
);
66 // internal helper functions:
67 void scan_cvs_path(const fs::path
& p
);
68 void scan_svn_path(const fs::path
& p
);
69 void add_path(const fs::path
& p
);
70 void add_directory(const fs::path
& p
);
71 void add_file(const fs::path
& p
);
72 void copy_path(const fs::path
& p
);
73 void add_file_dependencies(const fs::path
& p
, bool scanfile
);
74 bool is_source_file(const fs::path
& p
);
75 bool is_html_file(const fs::path
& p
);
76 bool is_binary_file(const fs::path
& p
);
77 void add_dependent_lib(const std::string
& libname
, const fs::path
& p
);
78 void create_path(const fs::path
& p
);
80 void scan_license(const fs::path
& p
, const fileview
& v
);
81 void output_license_info();
83 std::list
<std::string
> m_module_list
; // the modules to process
84 bool m_list_mode
; // list files only
85 bool m_list_summary_mode
; // list file summary only
86 bool m_license_mode
; // generate license information for files listed
87 bool m_cvs_mode
; // check cvs for files
88 bool m_svn_mode
; // check svn for files
89 bool m_unix_lines
; // fix line endings
90 bool m_scan_mode
; // scan non-boost files.
91 bool m_bsl_convert_mode
; // try to convert to the BSL
92 bool m_bsl_summary_mode
; // summarise BSL issues only
93 fs::path m_boost_path
; // the path to the boost root
94 fs::path m_dest_path
; // the path to copy to
95 std::map
<fs::path
, bool, path_less
> m_cvs_paths
; // valid files under cvs control
96 std::set
<fs::path
, path_less
> m_copy_paths
; // list of files to copy
97 std::map
<int, license_data
> m_license_data
; // licenses in use
98 std::set
<fs::path
, path_less
> m_unknown_licenses
; // files with no known license
99 std::set
<fs::path
, path_less
> m_unknown_authors
; // files with no known copyright/author
100 std::set
<fs::path
, path_less
> m_can_migrate_to_bsl
; // files that can migrate to the BSL
101 std::set
<fs::path
, path_less
> m_cannot_migrate_to_bsl
; // files that cannot migrate to the BSL
102 std::set
<std::string
> m_bsl_authors
; // authors giving blanket permission to use the BSL
103 std::set
<std::string
> m_authors_for_bsl_migration
; // authors we need for BSL migration
104 std::map
<fs::path
, std::pair
<std::string
, std::string
>, path_less
> m_converted_to_bsl
;
105 std::map
<std::string
, std::set
<fs::path
, path_less
> > m_author_data
; // all the authors
106 std::map
<fs::path
, fs::path
, path_less
> m_dependencies
; // dependency information