libzypp 17.37.17
Easy.h File Reference
#include <cstdio>
#include <zypp/base/TypeTraits.h>
Include dependency graph for Easy.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  zypp
 Easy-to use interface to the ZYPP dependency resolver.

Macros

#define for_(IT, BEG, END)
 Convenient for-loops using iterator.
#define arrayBegin(A)
 Simple C-array iterator.
#define arraySize(A)
#define arrayEnd(A)
#define defConstStr(FNC, STR)
#define NON_COPYABLE(CLASS)
 Delete copy ctor and copy assign.
#define DEFAULT_COPYABLE(CLASS)
 Default copy ctor and copy assign.
#define NON_MOVABLE(CLASS)
 Delete move ctor and move assign.
#define DEFAULT_MOVABLE(CLASS)
 Default move ctor and move assign.
#define NON_COPYABLE_BUT_MOVE(CLASS)
 Delete copy ctor and copy assign but enable default move.
#define NON_MOVABLE_BUT_COPY(CLASS)
 Default move ctor and move assign but enable default copy.

Typedefs

template<typename TBase, typename TDerived>
using disable_use_as_copy_ctor = std::enable_if_t<!std::is_base_of_v<TBase,std::remove_reference_t<TDerived>>>
 Prevent an universal ctor to be chosen as copy ctor.

Macro Definition Documentation

◆ for_

#define for_ ( IT,
BEG,
END )
Value:
for ( auto IT = BEG, _for_end = END; IT != _for_end; ++IT )

Convenient for-loops using iterator.

std::set<std::string>; _store;
for_( it, _store.begin(), _store.end() )
{
cout << *it << endl;
}
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Definition Easy.h:27

Definition at line 27 of file Easy.h.

◆ arrayBegin

#define arrayBegin ( A)
Value:
(&A[0])

Simple C-array iterator.

const char * defstrings[] = { "", "a", "default", "two words" };
for_( it, arrayBegin(defstrings), arrayEnd(defstrings) )
cout << *it << endl;
#define arrayBegin(A)
Simple C-array iterator.
Definition Easy.h:36
#define arrayEnd(A)
Definition Easy.h:38

Definition at line 36 of file Easy.h.

◆ arraySize

#define arraySize ( A)
Value:
(sizeof(A)/sizeof(*A))

Definition at line 37 of file Easy.h.

◆ arrayEnd

#define arrayEnd ( A)
Value:
(&A[0] + arraySize(A))
#define arraySize(A)
Definition Easy.h:37

Definition at line 38 of file Easy.h.

◆ defConstStr

#define defConstStr ( FNC,
STR )
Value:
inline const std::string & FNC { static const std::string val( STR ); return val; }
defConstStr( strANY(), "ANY" );
std::str str = strANY();
String related utilities and Regular expression matching.
#define defConstStr(FNC, STR)
Definition Easy.h:46

Definition at line 46 of file Easy.h.

◆ NON_COPYABLE

#define NON_COPYABLE ( CLASS)
Value:
CLASS( const CLASS & ) = delete; \
CLASS & operator=( const CLASS & ) = delete

Delete copy ctor and copy assign.

Definition at line 49 of file Easy.h.

◆ DEFAULT_COPYABLE

#define DEFAULT_COPYABLE ( CLASS)
Value:
CLASS( const CLASS & ) = default; \
CLASS & operator=( const CLASS & ) = default

Default copy ctor and copy assign.

Definition at line 54 of file Easy.h.

◆ NON_MOVABLE

#define NON_MOVABLE ( CLASS)
Value:
CLASS( CLASS && ) = delete; \
CLASS & operator=( CLASS && ) = delete

Delete move ctor and move assign.

Definition at line 59 of file Easy.h.

◆ DEFAULT_MOVABLE

#define DEFAULT_MOVABLE ( CLASS)
Value:
CLASS( CLASS && ) = default; \
CLASS & operator=( CLASS && ) = default

Default move ctor and move assign.

Definition at line 64 of file Easy.h.

◆ NON_COPYABLE_BUT_MOVE

#define NON_COPYABLE_BUT_MOVE ( CLASS)
Value:
NON_COPYABLE(CLASS); \
DEFAULT_MOVABLE(CLASS)
#define NON_COPYABLE(CLASS)
Delete copy ctor and copy assign.
Definition Easy.h:49

Delete copy ctor and copy assign but enable default move.

Definition at line 69 of file Easy.h.

◆ NON_MOVABLE_BUT_COPY

#define NON_MOVABLE_BUT_COPY ( CLASS)
Value:
NON_MOVABLE(CLASS); \
DEFAULT_COPYABLE(CLASS)
#define NON_MOVABLE(CLASS)
Delete move ctor and move assign.
Definition Easy.h:59

Default move ctor and move assign but enable default copy.

Definition at line 74 of file Easy.h.

Typedef Documentation

◆ disable_use_as_copy_ctor

template<typename TBase, typename TDerived>
using disable_use_as_copy_ctor = std::enable_if_t<!std::is_base_of_v<TBase,std::remove_reference_t<TDerived>>>

Prevent an universal ctor to be chosen as copy ctor.

struct FeedStrings
{
template<typename TARG, typename X = disable_use_as_copy_ctor<FeedStrings,TARG>>
FeedStrings( TARG && arg_r )
: _value { std::forward<TARG>( arg_r ) }
{}
// Same with variadic template. Could be chosen as copy_ctor.
template<typename ... Us>
FeedStrings( Us &&... us )
: ...
private:
std::string _value;
Definition Arch.h:364

Definition at line 98 of file Easy.h.