libzypp
11.13.5
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
libzypp
Welcome to libzypp
Code Pitfalls - Frequently made mistakes
Code Snippets
Environment Variables
Testing for provided features.
Notes on revisions
Extending ZYpp: Plugins and Hooks
Services
Solver - Vendor protection
Writing and tunning testcases
Libzypp and threads
Todo List
Deprecated List
Modules
Namespaces
Classes
Files
File List
zypp
base
Algorithm.h
Collector.h
Counter.h
Debug.h
DefaultIntegral.h
DtorReset.h
Easy.h
Errno.h
Exception.cc
Exception.h
ExternalDataSource.cc
ExternalDataSource.h
Fd.cc
Fd.h
Flags.h
Function.h
Functional.h
Gettext.cc
Gettext.h
GzStream.cc
GzStream.h
InputStream.cc
InputStream.h
InterProcessMutex.cc
InterProcessMutex.h
IOStream.cc
IOStream.h
Iterator.h
LogControl.cc
LogControl.h
Logger.h
LogTools.h
Measure.cc
Measure.h
NonCopyable.h
ProfilingFormater.cc
ProfilingFormater.h
ProvideNumericId.h
PtrTypes.h
Random.cc
Random.h
ReferenceCounted.cc
ReferenceCounted.h
Regex.cc
Regex.h
SafeBool.h
SerialNumber.cc
SerialNumber.h
Signal.h
String.cc
String.h
StrMatcher.cc
StrMatcher.h
Sysconfig.cc
Sysconfig.h
Tr1hash.h
Unit.cc
Unit.h
UserRequestException.cc
UserRequestException.h
WatchFile.h
media
misc
parser
pool
repo
sat
solver
target
thread
ui
url
ws
zypp_detail
APIConfig.h
Arch.cc
Arch.h
AutoDispose.h
Bit.h
ByteCount.cc
ByteCount.h
Callback.h
Capabilities.cc
Capabilities.h
Capability.cc
Capability.h
CapMatch.cc
CapMatch.h
Changelog.cc
Changelog.h
CheckSum.cc
CheckSum.h
CountryCode.cc
CountryCode.h
Date.cc
Date.h
Dep.cc
Dep.h
Digest.cc
Digest.h
DiskUsage.cc
DiskUsage.h
DiskUsageCounter.cc
DiskUsageCounter.h
DownloadMode.cc
DownloadMode.h
Edition.cc
Edition.h
ExternalProgram.cc
ExternalProgram.h
Fetcher.cc
Fetcher.h
FileChecker.cc
FileChecker.h
Filter.h
Glob.cc
Glob.h
HistoryLog.cc
HistoryLog.h
HistoryLogData.cc
HistoryLogData.h
IdString.cc
IdString.h
IdStringType.h
InstanceId.cc
InstanceId.h
KeyContext.h
KeyRing.cc
KeyRing.h
KVMap.h
LanguageCode.cc
LanguageCode.h
Locale.cc
Locale.h
Locks.cc
Locks.h
ManagedFile.h
MediaProducts.cc
MediaProducts.h
MediaSetAccess.cc
MediaSetAccess.h
Misc.h
OnMediaLocation.cc
OnMediaLocation.h
Package.cc
Package.h
PackageKeyword.h
Patch.cc
Patch.h
PathInfo.cc
PathInfo.h
Pathname.cc
Pathname.h
Pattern.cc
Pattern.h
PluginFrame.cc
PluginFrame.h
PluginFrameException.cc
PluginFrameException.h
PluginScript.cc
PluginScript.h
PluginScriptException.cc
PluginScriptException.h
PoolItem.cc
PoolItem.h
PoolItemBest.cc
PoolItemBest.h
PoolQuery.cc
PoolQuery.h
PoolQueryResult.cc
PoolQueryResult.h
PoolQueryUtil.tcc
ProblemSolution.cc
ProblemSolution.h
ProblemTypes.h
Product.cc
Product.h
ProgressData.cc
ProgressData.h
ProvideFilePolicy.cc
ProvideFilePolicy.h
PublicKey.cc
PublicKey.h
Range.cc
Range.h
Rel.cc
Rel.h
RelCompare.h
RepoInfo.cc
RepoInfo.h
RepoManager.cc
RepoManager.h
Repository.cc
Repository.h
RepoStatus.cc
RepoStatus.h
ResFilters.h
ResKind.cc
ResKind.h
ResObject.cc
ResObject.h
ResObjects.h
Resolvable.cc
Resolvable.h
Resolver.cc
Resolver.h
ResolverProblem.cc
ResolverProblem.h
ResPool.cc
ResPool.h
ResPoolProxy.cc
ResPoolProxy.h
ResStatus.cc
ResStatus.h
ResTraits.h
ServiceInfo.cc
ServiceInfo.h
Signature.cc
Signature.h
SrcPackage.cc
SrcPackage.h
SysContent.cc
SysContent.h
Target.cc
Target.h
TmpPath.cc
TmpPath.h
TriBool.h
Url.cc
Url.h
Vendor.h
VendorAttr.cc
VendorAttr.h
VendorSupportOptions.cc
VendorSupportOptions.h
ZConfig.cc
ZConfig.h
ZYpp.cc
ZYpp.h
ZYppCallbacks.h
ZYppCommit.h
ZYppCommitPolicy.cc
ZYppCommitPolicy.h
ZYppCommitResult.cc
ZYppCommitResult.h
ZYppFactory.cc
ZYppFactory.h
File Members
Flags.h
Go to the documentation of this file.
1
/*---------------------------------------------------------------------\
2
| ____ _ __ __ ___ |
3
| |__ / \ / / . \ . \ |
4
| / / \ V /| _/ _/ |
5
| / /__ | | | | | | |
6
| /_____||_| |_| |_| |
7
| |
8
\---------------------------------------------------------------------*/
12
#ifndef ZYPP_BASE_FLAGS_H
13
#define ZYPP_BASE_FLAGS_H
14
15
#include "
zypp/base/String.h
"
16
18
namespace
zypp
19
{
20
21
namespace
base
22
{
23
25
//
26
// CLASS NAME : Flags<Enum>
27
//
57
template
<
typename
Enum>
58
class
Flags
59
{
60
public
:
61
typedef
Enum
enum_type
;
62
63
public
:
64
Flags
() :
_val
( 0 ) {}
65
Flags
( Enum flag_r ) :
_val
( flag_r ) {}
66
explicit
Flags
(
unsigned
flag_r ) :
_val
( flag_r ) {}
67
68
Flags
&
operator&=
(
Flags
rhs ) {
_val
&= rhs.
_val
;
return
*
this
; }
69
Flags
&
operator&=
( Enum rhs ) {
_val
&= rhs;
return
*
this
; }
70
71
Flags
&
operator|=
(
Flags
rhs ) {
_val
|= rhs.
_val
;
return
*
this
; }
72
Flags
&
operator|=
( Enum rhs ) {
_val
|= rhs;
return
*
this
; }
73
74
Flags
&
operator^=
(
Flags
rhs ) {
_val
^= rhs.
_val
;
return
*
this
; }
75
Flags
&
operator^=
( Enum rhs ) {
_val
^= rhs;
return
*
this
; }
76
77
public
:
78
operator
unsigned()
const
{
return
_val
; }
79
80
Flags
operator&
(
Flags
rhs )
const
{
return
Flags
( *
this
) &= rhs; }
81
Flags
operator&
( Enum rhs )
const
{
return
Flags
( *
this
) &= rhs; }
82
83
Flags
operator|
(
Flags
rhs )
const
{
return
Flags
( *
this
) |= rhs; }
84
Flags
operator|
( Enum rhs )
const
{
return
Flags
( *
this
) |= rhs; }
85
86
Flags
operator^
(
Flags
rhs )
const
{
return
Flags
( *
this
) ^= rhs; }
87
Flags
operator^
( Enum rhs )
const
{
return
Flags
( *
this
) ^= rhs; }
88
89
Flags
operator~
()
const
{
return
Flags
( ~
_val
); }
90
91
public
:
92
Flags
&
setFlag
(
Flags
flag_r,
bool
newval_r ) {
return
( newval_r ?
setFlag
(flag_r) :
unsetFlag
(flag_r) ); }
93
Flags
&
setFlag
( Enum flag_r,
bool
newval_r ) {
return
( newval_r ?
setFlag
(flag_r) :
unsetFlag
(flag_r) ); }
94
95
Flags
&
setFlag
(
Flags
flag_r ) {
_val
|= flag_r;
return
*
this
; }
96
Flags
&
setFlag
( Enum flag_r ) {
_val
|= flag_r;
return
*
this
; }
97
98
Flags
&
unsetFlag
(
Flags
flag_r ) {
_val
&= ~flag_r;
return
*
this
; }
99
Flags
&
unsetFlag
( Enum flag_r ) {
_val
&= ~flag_r;
return
*
this
; }
100
101
bool
testFlag
(
Flags
flag_r )
const
{
return
(
_val
& flag_r ) == flag_r; }
102
bool
testFlag
( Enum flag_r )
const
{
return
(
_val
& flag_r ) == flag_r; }
103
104
private
:
105
unsigned
_val
;
106
};
108
109
template
<
typename
Enum>
110
inline
std::ostream & operator<<( std::ostream & str, const Flags<Enum> & obj )
111
{
return
str <<
str::hexstring
(obj); }
112
114
#define ZYPP_DECLARE_FLAGS(Name,Enum) typedef zypp::base::Flags<Enum> Name
115
117
#define ZYPP_DECLARE_OPERATORS_FOR_FLAGS(Name) \
118
inline Name operator&( Name::enum_type lhs, Name::enum_type rhs ) { return Name( lhs ) &= rhs; } \
119
inline Name operator&( Name::enum_type lhs, Name rhs ) { return rhs &= lhs; } \
120
inline Name operator|( Name::enum_type lhs, Name::enum_type rhs ) { return Name( lhs ) |= rhs; } \
121
inline Name operator|( Name::enum_type lhs, Name rhs ) { return rhs |= lhs; } \
122
inline Name operator^( Name::enum_type lhs, Name::enum_type rhs ) { return Name( lhs ) ^= rhs; } \
123
inline Name operator^( Name::enum_type lhs, Name rhs ) { return rhs ^= lhs; } \
124
inline Name operator~( Name::enum_type lhs ) { return ~Name( lhs ); }
125
127
#define ZYPP_DECLARE_FLAGS_AND_OPERATORS(Name,Enum) \
128
ZYPP_DECLARE_FLAGS(Name,Enum); \
129
ZYPP_DECLARE_OPERATORS_FOR_FLAGS(Name)
130
132
}
// namespace base
135
}
// namespace zypp
137
#endif // ZYPP_BASE_FLAGS_H
zypp
base
Flags.h
Generated by
1.8.1