libzypp  17.1.1
zypp::CpeId::Value Class Reference

WFN attribute value. More...

#include <CpeId.h>

Inheritance diagram for zypp::CpeId::Value:

Classes

struct  ETypeDef
 Classification of Value types mostly for match (use like 'enum class Type') More...
 
struct  FsFormatType
 Indicator type for ctor arg in FS format. More...
 
struct  UriFormatType
 Indicator type for ctor arg in URI format. More...
 

Public Types

typedef base::EnumClass< ETypeDefType
 'enum class Type' More...
 

Public Member Functions

 Value ()
 Default ctor: ANY. More...
 
 Value (const std::string &value_r)
 Ctor from string (WFN format; "*" represents ANY; "" represents NA) More...
 
 Value (const char *value_r)
 Ctor from char* (WFN format; nullptr or "*" represent ANY; "" represents NA) More...
 
 Value (const std::string &encoded_r, FsFormatType)
 Ctor from string (FS format, "*" represents ANY; "-" represents NA) More...
 
 Value (const std::string &encoded_r, UriFormatType)
 Ctor from string (URI format, "" represents ANY; "-" represents NA) More...
 
Type type () const
 Return the Type of this Value. More...
 
bool isANY () const
 Whether value is ANY. More...
 
bool isNA () const
 Whether value is NA. More...
 
bool isLogical () const
 Whether it's a logical value (ANY|NA). More...
 
bool isLogical (Type type_r) const
 
bool isString () const
 Whether it's an attribute value string (not logical value). More...
 
bool isString (Type type_r) const
 
bool isWildcardfree () const
 An attribute value string without wildcards ([*?] at begin and/or end) More...
 
bool isWildcarded () const
 An attribute value string with wildcards ([*?] at begin and/or end) More...
 
std::string asString () const
 Default string representation [asWfn]. More...
 
std::string asWfn () const
 String representation as in Well-Formed-Name (ANY:"*", NA:""). More...
 
std::string asFs () const
 String representation as in Formated-String (ANY:"*", NA:"-") More...
 
std::string asUri () const
 String representation as in URI (ANY:"", NA:"-") More...
 
- Public Member Functions inherited from zypp::base::SetRelationMixin< Value >
SetCompare compare (const Value &trg) const
 Compare sets. More...
 
SetCompare compare (const SetRelationMixin< Value > &trg) const
 
bool compare (const Value &trg, SetCompare cmp) const
 Compare sets and match against SetCompare. More...
 
bool compare (const SetRelationMixin< Value > &trg, SetCompare cmp) const
 
bool compare (const Value &trg, SetRelation rel) const
 Compare sets and match against SetRelation. More...
 
bool compare (const SetRelationMixin< Value > &trg, SetRelation rel) const
 

Static Public Attributes

static const Value ANY
 Logical value matching ANY value. More...
 
static const Value NA
 Logical value indicating “not applicable/not used". More...
 
static constexpr FsFormatType fsFormat = FsFormatType()
 Indicator argument for ctor arg in FS format. More...
 
static constexpr UriFormatType uriFormat = UriFormatType()
 Indicator argument for ctor arg in URI format. More...
 

Private Member Functions

SetCompare setRelationMixinCompare (const Value &trg) const
 CPE name matching hook for SetRelationMixin. More...
 
bool containsWildcard () const
 HAs unquoted [*?] at begin and/or end of value. More...
 

Private Attributes

RWCOW_pointer< std::string > _value
 

Friends

SetCompare base::SetRelationMixin (const Value &) const
 

Related Functions

(Note that these are not member functions.)

std::ostream & operator<< (std::ostream &str, const CpeId::Value &obj)
 

Additional Inherited Members

- Protected Member Functions inherited from zypp::base::SetRelationMixin< Value >
 SetRelationMixin ()
 
 DEFAULT_COPYABLE (SetRelationMixin)
 
 DEFAULT_MOVABLE (SetRelationMixin)
 
 ~SetRelationMixin ()
 

Detailed Description

WFN attribute value.

Valid WFN string values are not empty, contain alphanumeric chars, underscore, no whitespace, printable non-alphanumeric characters must be quoted by a backslash.

Unescaped asterisk and question mark are special characters and may occur at the beginning and or end of the string. The asterisk must not be used more than once in asequense. The question mark may be used more than once in a sequence.

A single asterisk must not be used as attribute value, nor a single quoted hyphen.

A single question mark may be used as value.

See also
http://cpe.mitre.org/ for more information on the Common Platform Enumeration.

Definition at line 158 of file CpeId.h.

Member Typedef Documentation

◆ Type

typedef base::EnumClass<ETypeDef> zypp::CpeId::Value::Type

'enum class Type'

Definition at line 215 of file CpeId.h.

Constructor & Destructor Documentation

◆ Value() [1/5]

zypp::CpeId::Value::Value ( )
inline

Default ctor: ANY.

Definition at line 180 of file CpeId.h.

◆ Value() [2/5]

zypp::CpeId::Value::Value ( const std::string &  value_r)
explicit

Ctor from string (WFN format; "*" represents ANY; "" represents NA)

Exceptions
std::invalid_argumentif string is malformed (
See also
isValidWfn).

Definition at line 445 of file CpeId.cc.

◆ Value() [3/5]

zypp::CpeId::Value::Value ( const char *  value_r)
inlineexplicit

Ctor from char* (WFN format; nullptr or "*" represent ANY; "" represents NA)

Exceptions
std::invalid_argumentif string is malformed (
See also
isValidWfn).

Definition at line 191 of file CpeId.h.

◆ Value() [4/5]

zypp::CpeId::Value::Value ( const std::string &  encoded_r,
FsFormatType   
)

Ctor from string (FS format, "*" represents ANY; "-" represents NA)

Exceptions
std::invalid_argumentif string is malformed.

Definition at line 505 of file CpeId.cc.

◆ Value() [5/5]

zypp::CpeId::Value::Value ( const std::string &  encoded_r,
UriFormatType   
)

Ctor from string (URI format, "" represents ANY; "-" represents NA)

Exceptions
std::invalid_argumentif string is malformed.

Definition at line 570 of file CpeId.cc.

Member Function Documentation

◆ type()

Type zypp::CpeId::Value::type ( ) const
inline

Return the Type of this Value.

Definition at line 218 of file CpeId.h.

◆ isANY()

bool zypp::CpeId::Value::isANY ( ) const
inline

Whether value is ANY.

)

Definition at line 226 of file CpeId.h.

◆ isNA()

bool zypp::CpeId::Value::isNA ( ) const
inline

Whether value is NA.

)

Definition at line 230 of file CpeId.h.

◆ isLogical() [1/2]

bool zypp::CpeId::Value::isLogical ( ) const
inline

Whether it's a logical value (ANY|NA).

Definition at line 234 of file CpeId.h.

◆ isLogical() [2/2]

bool zypp::CpeId::Value::isLogical ( Type  type_r) const
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 237 of file CpeId.h.

◆ isString() [1/2]

bool zypp::CpeId::Value::isString ( ) const
inline

Whether it's an attribute value string (not logical value).

Definition at line 241 of file CpeId.h.

◆ isString() [2/2]

bool zypp::CpeId::Value::isString ( Type  type_r) const
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 244 of file CpeId.h.

◆ isWildcardfree()

bool zypp::CpeId::Value::isWildcardfree ( ) const
inline

An attribute value string without wildcards ([*?] at begin and/or end)

Definition at line 248 of file CpeId.h.

◆ isWildcarded()

bool zypp::CpeId::Value::isWildcarded ( ) const
inline

An attribute value string with wildcards ([*?] at begin and/or end)

Definition at line 252 of file CpeId.h.

◆ asString()

std::string zypp::CpeId::Value::asString ( ) const
inline

Default string representation [asWfn].

Definition at line 257 of file CpeId.h.

◆ asWfn()

std::string zypp::CpeId::Value::asWfn ( ) const

String representation as in Well-Formed-Name (ANY:"*", NA:"").

wfn:[part="a",vendor="opensuse",product="libzypp", version="14\.16\.0",update="beta"]

Definition at line 647 of file CpeId.cc.

◆ asFs()

std::string zypp::CpeId::Value::asFs ( ) const

String representation as in Formated-String (ANY:"*", NA:"-")

cpe:2.3:a:opensuse:libzypp:14.16.0:beta:*:*:*:*:*:*

Definition at line 660 of file CpeId.cc.

◆ asUri()

std::string zypp::CpeId::Value::asUri ( ) const

String representation as in URI (ANY:"", NA:"-")

cpe:/a:opensuse:libzypp:14.16.0:beta

Definition at line 706 of file CpeId.cc.

◆ setRelationMixinCompare()

SetCompare zypp::CpeId::Value::setRelationMixinCompare ( const Value trg) const
private

CPE name matching hook for SetRelationMixin.

Definition at line 975 of file CpeId.cc.

◆ containsWildcard()

bool zypp::CpeId::Value::containsWildcard ( ) const
private

HAs unquoted [*?] at begin and/or end of value.

Note
isString() must be asserted!

Definition at line 908 of file CpeId.cc.

Friends And Related Function Documentation

◆ base::SetRelationMixin

SetCompare base::SetRelationMixin ( const Value ) const
friend

◆ operator<<()

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

Stream output

Definition at line 1047 of file CpeId.cc.

Member Data Documentation

◆ ANY

const CpeId::Value zypp::CpeId::Value::ANY
static

Logical value matching ANY value.

Definition at line 162 of file CpeId.h.

◆ NA

const CpeId::Value zypp::CpeId::Value::NA
static

Logical value indicating “not applicable/not used".

Definition at line 165 of file CpeId.h.

◆ fsFormat

constexpr FsFormatType zypp::CpeId::Value::fsFormat = FsFormatType()
static

Indicator argument for ctor arg in FS format.

Definition at line 171 of file CpeId.h.

◆ uriFormat

constexpr UriFormatType zypp::CpeId::Value::uriFormat = UriFormatType()
static

Indicator argument for ctor arg in URI format.

Definition at line 176 of file CpeId.h.

◆ _value

RWCOW_pointer<std::string> zypp::CpeId::Value::_value
private

Definition at line 292 of file CpeId.h.


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