FOSSology  4.4.0
Open Source License Compliance by Open Source Software
copyrightState.cc
1 /*
2  SPDX-FileCopyrightText: © 2014-2015 Siemens AG
3  Author: Johannes Najjar, Daniele Fognini
4 
5  SPDX-License-Identifier: GPL-2.0-only
6 */
7 
8 #include "copyrightState.hpp"
9 #include "identity.hpp"
10 
16  cliOptions(cliOptions),
17  scanners(cliOptions.extractScanners())
18 {
19 }
20 
26 {
27  if (sc)
28  scanners.push_back(unptr::shared_ptr<scanner>(sc));
29 }
30 
35 const std::list<unptr::shared_ptr<scanner>>& CopyrightState::getScanners() const
36 {
37  return scanners;
38 }
39 
47 CliOptions::CliOptions(int verbosity, unsigned int type, bool json, bool ignoreFilesWithMimeType) :
48  verbosity(verbosity),
49  optType(type),
50  json(json),
51  ignoreFilesWithMimeType(ignoreFilesWithMimeType),
52  cliScanners()
53 {
54 }
55 
60  verbosity(0),
61  optType(ALL_TYPES),
62  ignoreFilesWithMimeType(false),
63  cliScanners()
64 {
65 }
66 
71 unsigned int CliOptions::getOptType() const
72 {
73  return optType;
74 }
75 
81 {
82  return cliOptions;
83 }
84 
89 std::list<unptr::shared_ptr<scanner>> CliOptions::extractScanners()
90 {
91  return std::move(cliScanners);
92 }
93 
99 {
100  return verbosity >= 1;
101 }
102 
108 {
109  cliScanners.push_back(unptr::shared_ptr<scanner>(sc));
110 }
111 
117 {
118  return json;
119 }
120 
126 {
128 }
Store the options sent through the CLI.
bool isVerbosityDebug() const
Check if verbosity is set.
bool doJsonOutput() const
Check if JSON output is required.
unsigned int optType
std::list< unptr::shared_ptr< scanner > > extractScanners()
Get scanner s set by CliOptions.
unsigned int getOptType() const
Get the opt type set by CliOptions.
bool doignoreFilesWithMimeType() const
Check to ignore files with particular mimetype.
std::list< unptr::shared_ptr< scanner > > cliScanners
CliOptions()
Default constructor for CliOptions.
void addScanner(scanner *regexDesc)
Add scanner to CliOptions.
bool ignoreFilesWithMimeType
const CliOptions & getCliOptions() const
Get the CliOptions set by user.
void addScanner(scanner *scanner)
Add scanner to state.
const std::list< unptr::shared_ptr< scanner > > & getScanners() const
Get available scanner s.
std::list< unptr::shared_ptr< scanner > > scanners
CopyrightState(CliOptions &&cliOptions)
Constructor to initialize state.
const CliOptions cliOptions
Abstract class to provide interface to scanners.
Definition: scanners.hpp:52