FOSSology  4.4.0
Open Source License Compliance by Open Source Software
OjoState.cc
1 /*
2  SPDX-FileCopyrightText: © 2019, 2021 Siemens AG
3 
4  SPDX-License-Identifier: GPL-2.0-only
5 */
6 
7 #include "OjoState.hpp"
8 
14 OjoState::OjoState(const int agentId, const OjoCliOptions &cliOptions) :
15  agentId(agentId), cliOptions(cliOptions)
16 {
17 }
18 
23 void OjoState::setAgentId(const int agentId)
24 {
25  this->agentId = agentId;
26 }
27 
33 {
34  return agentId;
35 }
36 
42 {
43  return ojoAgent;
44 }
45 
52 OjoCliOptions::OjoCliOptions(int verbosity, bool json, bool ignoreFilesWithMimeType) :
53  verbosity(verbosity), json(json), ignoreFilesWithMimeType(ignoreFilesWithMimeType),
54  userId(-1), groupId(-1)
55 {
56 }
57 
62  verbosity(0), json(false), ignoreFilesWithMimeType(false), userId(-1),
63  groupId(-1)
64 {
65 }
66 
72 {
73  return cliOptions;
74 }
75 
81 {
82  return verbosity >= 1;
83 }
84 
90 {
91  return json;
92 }
93 
99 {
101 }
102 
107 void OjoCliOptions::setUserId(const int userId)
108 {
109  this->userId = userId;
110 }
111 
116 void OjoCliOptions::setGroupId(const int groupId)
117 {
118  this->groupId = groupId;
119 }
120 
126 {
127  return userId;
128 }
129 
135 {
136  return groupId;
137 }
Store the options sent through the CLI.
Definition: OjoState.hpp:24
bool doJsonOutput() const
Check if JSON output is required.
Definition: OjoState.cc:89
int getGroupId() const
Get the group running the agent.
Definition: OjoState.cc:134
void setGroupId(const int)
Set the group id.
Definition: OjoState.cc:116
bool ignoreFilesWithMimeType
Definition: OjoState.hpp:28
int getUserId() const
Get the user running the agent.
Definition: OjoState.cc:125
bool doignoreFilesWithMimeType() const
Check ignore files with particular mimetype is required.
Definition: OjoState.cc:98
OjoCliOptions()
Default constructor for OjoCliOptions.
Definition: OjoState.cc:61
bool isVerbosityDebug() const
Check if verbosity is set.
Definition: OjoState.cc:80
void setUserId(const int)
Set the user id.
Definition: OjoState.cc:107
OjoState(const int agentId, const OjoCliOptions &cliOptions)
Definition: OjoState.cc:14
const OjoAgent ojoAgent
Definition: OjoState.hpp:63
const OjoAgent & getOjoAgent() const
Definition: OjoState.cc:41
int getAgentId() const
Definition: OjoState.cc:32
const OjoCliOptions & getCliOptions() const
Get the OjoCliOptions set by user.
Definition: OjoState.cc:71
void setAgentId(const int agentId)
Definition: OjoState.cc:23
const OjoCliOptions cliOptions
Definition: OjoState.hpp:62
int agentId
Definition: OjoState.hpp:61