| Line |   | 
|---|
| 1 | //  license_check implementation  --------------------------------------------// | 
|---|
| 2 |  | 
|---|
| 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) | 
|---|
| 7 |  | 
|---|
| 8 | #include <boost/regex.hpp> | 
|---|
| 9 | #include "license_check.hpp" | 
|---|
| 10 |  | 
|---|
| 11 | namespace | 
|---|
| 12 | { | 
|---|
| 13 |   boost::regex license_regex( | 
|---|
| 14 |     "boost(\\s+|\\s+#\\s*|\\s+//\\s*)software(\\s+|\\s+#\\s*|\\s+//\\s*)license", | 
|---|
| 15 |     boost::regbase::normal | boost::regbase::icase); | 
|---|
| 16 |  | 
|---|
| 17 | } // unnamed namespace | 
|---|
| 18 |  | 
|---|
| 19 | namespace boost | 
|---|
| 20 | { | 
|---|
| 21 |   namespace inspect | 
|---|
| 22 |   { | 
|---|
| 23 |    license_check::license_check() : m_files_with_errors(0) | 
|---|
| 24 |    { | 
|---|
| 25 |    } | 
|---|
| 26 |       | 
|---|
| 27 |    void license_check::inspect( | 
|---|
| 28 |       const string & library_name, | 
|---|
| 29 |       const path & full_path,   // example: c:/foo/boost/filesystem/path.hpp | 
|---|
| 30 |       const string & contents )     // contents of file to be inspected | 
|---|
| 31 |     { | 
|---|
| 32 |       if ( !boost::regex_search( contents, license_regex ) ) | 
|---|
| 33 |       { | 
|---|
| 34 |         ++m_files_with_errors; | 
|---|
| 35 |         error( library_name, full_path, desc() ); | 
|---|
| 36 |       } | 
|---|
| 37 |     } | 
|---|
| 38 |   } // namespace inspect | 
|---|
| 39 | } // namespace boost | 
|---|
| 40 |  | 
|---|
| 41 |  | 
|---|
       
      
      Note: See 
TracBrowser
        for help on using the repository browser.