]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/tools/inspect/license_check.cpp
1 // license_check implementation --------------------------------------------//
3 // Copyright Beman Dawes 2002-2003.
4 // Distributed under the Boost Software License, Version 1.0.
5 // (See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt)
8 #include "boost/regex.hpp"
9 #include "license_check.hpp"
13 boost::regex
license_regex(
14 //~ The next two lines change the regex so that it detects when the license
15 //~ doesn't follow the prefered statement. Disabled because it currently
16 //~ generates a large number of issues.
17 //~ "Distributed[\\s\\W]+"
18 //~ "under[\\s\\W]+the[\\s\\W]+"
19 "boost[\\s\\W]+software[\\s\\W]+license",
20 boost::regbase::normal
| boost::regbase::icase
);
22 } // unnamed namespace
28 license_check::license_check() : m_files_with_errors(0)
32 void license_check::inspect(
33 const string
& library_name
,
34 const path
& full_path
, // example: c:/foo/boost/filesystem/path.hpp
35 const string
& contents
) // contents of file to be inspected
37 if (contents
.find( "boostinspect:" "nolicense" ) != string::npos
) return;
39 if ( !boost::regex_search( contents
, license_regex
) )
41 ++m_files_with_errors
;
42 error( library_name
, full_path
, name() );
45 } // namespace inspect