libzypp
11.13.5
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
SafeBool.h
Go to the documentation of this file.
1
/*---------------------------------------------------------------------\
2
| ____ _ __ __ ___ |
3
| |__ / \ / / . \ . \ |
4
| / / \ V /| _/ _/ |
5
| / /__ | | | | | | |
6
| /_____||_| |_| |_| |
7
| |
8
\---------------------------------------------------------------------*/
12
#ifndef ZYPP_BASE_SAFEBOOL_H
13
#define ZYPP_BASE_SAFEBOOL_H
14
16
namespace
zypp
17
{
18
19
namespace
base
20
{
21
22
namespace
safebool_detail
23
{
24
class
SafeBoolBase
25
{
26
protected
:
27
typedef
void (
SafeBoolBase
::*
bool_type
)()
const
;
28
void
theTrueBoolType
()
const
{}
29
30
SafeBoolBase
() {}
31
SafeBoolBase
(
const
SafeBoolBase
& ) {}
32
~SafeBoolBase
() {}
33
SafeBoolBase
&
operator=
(
const
SafeBoolBase
& ) {
return
*
this
; }
34
};
35
}
36
38
//
39
// CLASS NAME : SafeBool
40
//
69
template
<
class
_Derived>
70
struct
SafeBool
:
private
safebool_detail::SafeBoolBase
71
{
72
using
safebool_detail::SafeBoolBase::bool_type
;
73
operator
bool_type
()
const
74
{
75
return
( (static_cast<const _Derived *>(
this
))->boolTest()
76
? &
safebool_detail::SafeBoolBase::theTrueBoolType
77
: 0 );
78
}
79
protected
:
80
~SafeBool
() {}
81
};
83
85
}
// namespace base
88
}
// namespace zypp
90
#endif // ZYPP_BASE_SAFEBOOL_H
zypp
base
SafeBool.h
Generated by
1.8.1