libzypp
17.14.0
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
FileChecker.h
Go to the documentation of this file.
1
/*---------------------------------------------------------------------\
2
| ____ _ __ __ ___ |
3
| |__ / \ / / . \ . \ |
4
| / / \ V /| _/ _/ |
5
| / /__ | | | | | | |
6
| /_____||_| |_| |_| |
7
| |
8
\---------------------------------------------------------------------*/
12
#ifndef ZYPP_FILECHECKER_H
13
#define ZYPP_FILECHECKER_H
14
15
#include <iosfwd>
16
#include <list>
17
#include "
zypp/base/DefaultIntegral.h
"
18
#include "
zypp/base/Exception.h
"
19
#include "
zypp/base/Function.h
"
20
#include "
zypp/PathInfo.h
"
21
#include "
zypp/CheckSum.h
"
22
#include "
zypp/KeyContext.h
"
23
25
namespace
zypp
26
{
27
28
class
PublicKey
;
29
37
typedef
function<void ( const Pathname &file )>
FileChecker
;
38
39
class
FileCheckException
:
public
Exception
40
{
41
public
:
42
FileCheckException
(
const
std::string &
msg
)
43
:
Exception
(msg)
44
{}
45
};
46
47
class
CheckSumCheckException
:
public
FileCheckException
48
{
49
public
:
50
CheckSumCheckException
(
const
std::string &
msg
)
51
:
FileCheckException
(msg)
52
{}
53
};
54
55
class
SignatureCheckException
:
public
FileCheckException
56
{
57
public
:
58
SignatureCheckException
(
const
std::string &
msg
)
59
:
FileCheckException
(msg)
60
{}
61
};
62
70
class
ChecksumFileChecker
71
{
72
public
:
73
typedef
CheckSumCheckException
ExceptionType
;
78
ChecksumFileChecker
(
const
CheckSum
&
checksum
);
85
void
operator()
(
const
Pathname &file )
const
;
86
private
:
87
CheckSum
_checksum
;
88
};
89
93
class
SignatureFileChecker
94
{
95
public
:
96
typedef
SignatureCheckException
ExceptionType
;
97
98
public
:
103
SignatureFileChecker
(
const
Pathname &signature );
104
111
SignatureFileChecker
();
112
120
void
setKeyContext
(
const
KeyContext
& keycontext);
121
123
const
KeyContext
&
keyContext
()
const
124
{
return
_context
; }
125
130
bool
fileAccepted
()
const
131
{
return
_fileAccepted
; }
132
137
bool
fileValidated
()
const
138
{
return
_fileValidated
; }
139
143
void
addPublicKey
(
const
PublicKey
& publickey,
const
KeyContext
& keycontext =
KeyContext
());
145
void
addPublicKey
(
const
Pathname & publickey,
const
KeyContext
& keycontext =
KeyContext
());
146
159
void
operator()
(
const
Pathname &file )
const
;
160
161
protected
:
162
Pathname
_signature
;
163
KeyContext
_context
;
164
mutable
DefaultIntegral<bool,false>
_fileAccepted
;
165
mutable
DefaultIntegral<bool,false>
_fileValidated
;
166
};
167
172
class
NullFileChecker
173
{
174
public
:
175
void
operator()
(
const
Pathname &file )
const
;
176
};
177
192
class
CompositeFileChecker
193
{
194
public
:
195
void
add
(
const
FileChecker
&checker );
199
void
operator()
(
const
Pathname &file )
const
;
200
201
int
checkersSize
()
const
{
return
_checkers
.size(); }
202
private
:
203
std::list<FileChecker>
_checkers
;
204
};
205
207
std::ostream &
operator<<
( std::ostream & str,
const
FileChecker
& obj );
208
210
}
// namespace zypp
212
#endif // ZYPP_FILECHECKER_H
zypp
FileChecker.h
Generated by
1.8.2