FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
copyrightState.hpp
1 /*
2  * Copyright (C) 2014, Siemens AG
3  * Author: Johannes Najjar, Daniele Fognini
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2
7  * as published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12  * See the GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software Foundation,
16  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  */
18 
19 #ifndef copyrightState_h
20 #define copyrightState_h
21 
22 #include "regscan.hpp"
23 #include "copyscan.hpp"
24 
26 #include "database.hpp"
27 #include <list>
28 #include "uniquePtr.hpp"
29 
35 {
36 private:
37  int verbosity;
38  unsigned int optType;
39  bool json;
41  std::list<unptr::shared_ptr<scanner>> cliScanners;
43 public:
44  bool isVerbosityDebug() const;
45 
46  unsigned int getOptType() const;
47 
48  bool doJsonOutput() const;
49  bool doignoreFilesWithMimeType() const;
50 
51  void addScanner(scanner* regexDesc);
52  std::list<unptr::shared_ptr<scanner>> extractScanners();
53 
54  CliOptions(int verbosity, unsigned int type, bool json, bool ignoreFilesWithMimeType);
55  CliOptions();
56 };
57 
63 {
64 public:
65  CopyrightState(CliOptions&& cliOptions);
66 
67  int getAgentId() const;
68 
69  /* give ownership of the scanner pointer to this CopyrightState */
70  void addScanner(scanner* scanner);
71 
72  const std::list<unptr::shared_ptr<scanner>>& getScanners() const;
73 
74  const CliOptions& getCliOptions() const;
75 
76 private:
78  std::list<unptr::shared_ptr<scanner>> scanners;
79 };
80 
81 #endif
82 
CliOptions()
Default constructor for CliOptions.
std::list< unptr::shared_ptr< scanner > > extractScanners()
Get scanner s set by CliOptions.
bool doignoreFilesWithMimeType() const
Check to ignore files with particular mimetype.
bool doJsonOutput() const
Check if JSON output is required.
DB wrapper for agents.
std::list< unptr::shared_ptr< scanner > > scanners
const CliOptions cliOptions
Abstract class to provide interface to scanners.
Definition: scanners.hpp:62
unsigned int optType
void addScanner(scanner *regexDesc)
Add scanner to CliOptions.
Defined which unique to be used by creating new unptr namespace.
Holds information about state of one agent.
bool isVerbosityDebug() const
Check if verbosity is set.
std::list< unptr::shared_ptr< scanner > > cliScanners
bool ignoreFilesWithMimeType
Store the options sent through the CLI.
unsigned int getOptType() const
Get the opt type set by CliOptions.