libzypp 17.31.23
zypp::Match Class Reference

String matching option flags as used e.g. More...

#include <base/StrMatcher.h>

Public Types

enum  Mode {
  NOTHING , STRING , STRINGSTART , STRINGEND ,
  SUBSTRING , GLOB , REGEX , OTHER
}
 Mode flags (mutual exclusive). More...
 

Public Member Functions

Low level integer representation.
int get () const
 Return the integer representation.
 
int modeval () const
 Return the modes integer representation.
 
int flagval () const
 Return the flags integer representation.
 

Static Public Attributes

\ref Option flags

Most flags are actually sat::LookupAttr specific, as they tell how to retrieve the attribute values from solv-files.

The plain StrMatcher will ignore those flags and use the ones related to string matching only.

static const Match NOCASE
 If set, match case insensitive.
 

Static Private Attributes

static const int _modemask = SEARCH_STRINGMASK
 
static const int _flagmask = ~_modemask
 

Related Functions

(Note that these are not member functions.)

bool operator== (const Match &lhs, const Match &rhs)
 
bool operator!= (const Match &lhs, const Match &rhs)
 
Match operator| (const Match &lhs, const Match &rhs)
 
Match operator- (const Match &lhs, const Match &rhs)
 
std::ostream & operator<< (std::ostream &str, const Match &obj)
 Stream output.
 

\ref sat::LookupAttr option flags

These flags are actually sat::LookupAttr specific, as they tell how to retrieve the attribute values from solv-files.

The plain StrMatcher will ignore these flags and use the ones related to string matching only.

static const Match NO_STORAGE_SOLVABLE
 LookupAttr: internal.
 
static const Match SUB
 LookupAttr: internal.
 
static const Match ARRAYSENTINEL
 LookupAttr: internal.
 
static const Match DISABLED_REPOS
 LookupAttr: internal.
 
static const Match COMPLETE_FILELIST
 LookupAttr: internal.
 
static const Match SKIP_KIND
 LookupAttr: skip any kind: prefix when looking at a Solvable name.
 
static const Match FILES
 LookupAttr: match full path when matching in filelists, otherwise just the basenames.
 
static const Match CHECKSUMS
 LookupAttr: also look for matches in checksums.
 
 Match ()
 Default ctor 0 or NOTHING.
 
 Match (Mode val_r)
 Ctor from Mode value.
 
 Match (int val_r)
 Just in case one needs it.
 
 operator bool () const
 Evaluate in a boolean context ( != 0 ).
 
bool test (const Match &rhs) const
 Test whether all of the rhs bits are set (same mode if rhs has one).
 
bool testAnyOf (const Match &rhs) const
 Whether at least one of the rhs bits is set (or the same mode).
 
void set (const Match &rhs)
 Set all of the rhs bits (setting a new mode if rhs has one).
 
void unset (const Match &rhs)
 Unset all of the rhs bits (unsets mode if the same as rhs).
 
void turn (const Match &rhs, bool onoff)
 Depending on the value of onoff, set or unset flags.
 
Matchoperator|= (const Match &rhs)
 Add flags.
 
Matchoperator-= (const Match &rhs)
 Remove flags.
 
Mode mode () const
 Return the mode part.
 
Match flags () const
 Return the flags part.
 

Mode flag manip/query convenience.

int _val
 
bool isMode (Mode rhs) const
 Whether this has mode rhs.
 
bool isModeString () const
 Whether this has mode STRING.
 
bool isModeStringstart () const
 Whether this has mode STRINGSTART.
 
bool isModeStringend () const
 Whether this has mode STRINGEND.
 
bool isModeSubstring () const
 Whether this has mode SUBSTRING.
 
bool isModeGlob () const
 Whether this has mode GLOB.
 
bool isModeRegex () const
 Whether this has mode REGEX.
 
void setMode (Mode rhs)
 Set the mode part to rhs .
 
void setModeString ()
 Set the mode STRING.
 
void setModeStringstart ()
 Set the mode STRINGSTART.
 
void setModeStringend ()
 Set the mode STRINGEND.
 
void setModeSubstring ()
 Set the mode SUBSTRING.
 
void setModeGlob ()
 Set the mode GLOB.
 
void setModeRegex ()
 Set the mode REGEX.
 
std::string asString () const
 String representation.
 
static int modeval (Mode mode_r)
 Numeric value for enum (short for Match(m).get()).
 

Detailed Description

String matching option flags as used e.g.

by StrMatcher.

String matching option flags as used e.g.
Definition: StrMatcher.h:33
@ GLOB
Glob.
Definition: StrMatcher.h:47
static const Match NOCASE
If set, match case insensitive.
Definition: StrMatcher.h:59
Mode mode() const
Return the mode part.
Definition: StrMatcher.cc:52

Definition at line 32 of file StrMatcher.h.

Member Enumeration Documentation

◆ Mode

Mode flags (mutual exclusive).

Enumerator
NOTHING 

Match nothing.

STRING 

Excat matching.

STRINGSTART 

Match at string start.

STRINGEND 

Match at string end.

SUBSTRING 

Match substring.

GLOB 

Glob.

REGEX 

Regular Expression.

OTHER 

Something else.

Definition at line 40 of file StrMatcher.h.

Constructor & Destructor Documentation

◆ Match() [1/3]

zypp::Match::Match ( )
inline

Default ctor 0 or NOTHING.

Definition at line 81 of file StrMatcher.h.

◆ Match() [2/3]

zypp::Match::Match ( Mode  val_r)
inline

Ctor from Mode value.

Definition at line 86 of file StrMatcher.h.

◆ Match() [3/3]

zypp::Match::Match ( int  val_r)
inlineexplicit

Just in case one needs it.

Definition at line 91 of file StrMatcher.h.

Member Function Documentation

◆ operator bool()

zypp::Match::operator bool ( ) const
inlineexplicit

Evaluate in a boolean context ( != 0 ).

Definition at line 96 of file StrMatcher.h.

◆ test()

bool zypp::Match::test ( const Match rhs) const
inline

Test whether all of the rhs bits are set (same mode if rhs has one).

Definition at line 101 of file StrMatcher.h.

◆ testAnyOf()

bool zypp::Match::testAnyOf ( const Match rhs) const
inline

Whether at least one of the rhs bits is set (or the same mode).

Definition at line 105 of file StrMatcher.h.

◆ set()

void zypp::Match::set ( const Match rhs)
inline

Set all of the rhs bits (setting a new mode if rhs has one).

Definition at line 109 of file StrMatcher.h.

◆ unset()

void zypp::Match::unset ( const Match rhs)
inline

Unset all of the rhs bits (unsets mode if the same as rhs).

Definition at line 118 of file StrMatcher.h.

◆ turn()

void zypp::Match::turn ( const Match rhs,
bool  onoff 
)
inline

Depending on the value of onoff, set or unset flags.

Definition at line 127 of file StrMatcher.h.

◆ operator|=()

Match & zypp::Match::operator|= ( const Match rhs)
inline

Add flags.

Definition at line 131 of file StrMatcher.h.

◆ operator-=()

Match & zypp::Match::operator-= ( const Match rhs)
inline

Remove flags.

Definition at line 135 of file StrMatcher.h.

◆ mode()

Match::Mode zypp::Match::mode ( ) const

Return the mode part.

Definition at line 52 of file StrMatcher.cc.

◆ flags()

Match zypp::Match::flags ( ) const
inline

Return the flags part.

Definition at line 143 of file StrMatcher.h.

◆ get()

int zypp::Match::get ( ) const
inline

Return the integer representation.

Definition at line 150 of file StrMatcher.h.

◆ modeval() [1/2]

int zypp::Match::modeval ( ) const
inline

Return the modes integer representation.

Definition at line 152 of file StrMatcher.h.

◆ flagval()

int zypp::Match::flagval ( ) const
inline

Return the flags integer representation.

Definition at line 154 of file StrMatcher.h.

◆ isMode()

bool zypp::Match::isMode ( Mode  rhs) const
inline

Whether this has mode rhs.

Definition at line 161 of file StrMatcher.h.

◆ isModeString()

bool zypp::Match::isModeString ( ) const
inline

Whether this has mode STRING.

Definition at line 164 of file StrMatcher.h.

◆ isModeStringstart()

bool zypp::Match::isModeStringstart ( ) const
inline

Whether this has mode STRINGSTART.

Definition at line 167 of file StrMatcher.h.

◆ isModeStringend()

bool zypp::Match::isModeStringend ( ) const
inline

Whether this has mode STRINGEND.

Definition at line 170 of file StrMatcher.h.

◆ isModeSubstring()

bool zypp::Match::isModeSubstring ( ) const
inline

Whether this has mode SUBSTRING.

Definition at line 173 of file StrMatcher.h.

◆ isModeGlob()

bool zypp::Match::isModeGlob ( ) const
inline

Whether this has mode GLOB.

Definition at line 176 of file StrMatcher.h.

◆ isModeRegex()

bool zypp::Match::isModeRegex ( ) const
inline

Whether this has mode REGEX.

Definition at line 179 of file StrMatcher.h.

◆ setMode()

void zypp::Match::setMode ( Mode  rhs)
inline

Set the mode part to rhs .

Definition at line 183 of file StrMatcher.h.

◆ setModeString()

void zypp::Match::setModeString ( )
inline

Set the mode STRING.

Definition at line 186 of file StrMatcher.h.

◆ setModeStringstart()

void zypp::Match::setModeStringstart ( )
inline

Set the mode STRINGSTART.

Definition at line 189 of file StrMatcher.h.

◆ setModeStringend()

void zypp::Match::setModeStringend ( )
inline

Set the mode STRINGEND.

Definition at line 192 of file StrMatcher.h.

◆ setModeSubstring()

void zypp::Match::setModeSubstring ( )
inline

Set the mode SUBSTRING.

Definition at line 195 of file StrMatcher.h.

◆ setModeGlob()

void zypp::Match::setModeGlob ( )
inline

Set the mode GLOB.

Definition at line 198 of file StrMatcher.h.

◆ setModeRegex()

void zypp::Match::setModeRegex ( )
inline

Set the mode REGEX.

Definition at line 201 of file StrMatcher.h.

◆ asString()

std::string zypp::Match::asString ( ) const

String representation.

Definition at line 83 of file StrMatcher.cc.

◆ modeval() [2/2]

int zypp::Match::modeval ( Mode  mode_r)
staticprivate

Numeric value for enum (short for Match(m).get()).

Definition at line 67 of file StrMatcher.cc.

Friends And Related Function Documentation

◆ operator==()

bool operator== ( const Match lhs,
const Match rhs 
)
related

Definition at line 217 of file StrMatcher.h.

◆ operator!=()

bool operator!= ( const Match lhs,
const Match rhs 
)
related

Definition at line 220 of file StrMatcher.h.

◆ operator|()

Match operator| ( const Match lhs,
const Match rhs 
)
related

Definition at line 224 of file StrMatcher.h.

◆ operator-()

Match operator- ( const Match lhs,
const Match rhs 
)
related

Definition at line 231 of file StrMatcher.h.

◆ operator<<()

std::ostream & operator<< ( std::ostream &  str,
const Match obj 
)
related

Stream output.

Definition at line 104 of file StrMatcher.cc.

Member Data Documentation

◆ _modemask

const int zypp::Match::_modemask = SEARCH_STRINGMASK
staticprivate

Definition at line 35 of file StrMatcher.h.

◆ _flagmask

const int zypp::Match::_flagmask = ~_modemask
staticprivate

Definition at line 36 of file StrMatcher.h.

◆ NOCASE

const Match zypp::Match::NOCASE
static

If set, match case insensitive.

Definition at line 59 of file StrMatcher.h.

◆ NO_STORAGE_SOLVABLE

const Match zypp::Match::NO_STORAGE_SOLVABLE
static

LookupAttr: internal.

Definition at line 69 of file StrMatcher.h.

◆ SUB

const Match zypp::Match::SUB
static

LookupAttr: internal.

Definition at line 70 of file StrMatcher.h.

◆ ARRAYSENTINEL

const Match zypp::Match::ARRAYSENTINEL
static

LookupAttr: internal.

Definition at line 71 of file StrMatcher.h.

◆ DISABLED_REPOS

const Match zypp::Match::DISABLED_REPOS
static

LookupAttr: internal.

Definition at line 72 of file StrMatcher.h.

◆ COMPLETE_FILELIST

const Match zypp::Match::COMPLETE_FILELIST
static

LookupAttr: internal.

Definition at line 73 of file StrMatcher.h.

◆ SKIP_KIND

const Match zypp::Match::SKIP_KIND
static

LookupAttr: skip any kind: prefix when looking at a Solvable name.

Definition at line 74 of file StrMatcher.h.

◆ FILES

const Match zypp::Match::FILES
static

LookupAttr: match full path when matching in filelists, otherwise just the basenames.

Definition at line 75 of file StrMatcher.h.

◆ CHECKSUMS

const Match zypp::Match::CHECKSUMS
static

LookupAttr: also look for matches in checksums.

Definition at line 76 of file StrMatcher.h.

◆ _val

int zypp::Match::_val
private

Definition at line 213 of file StrMatcher.h.


The documentation for this class was generated from the following files: