libzypp 17.37.17
zypp::CpeId::Value Class Reference

WFN attribute value. More...

#include <zypp/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

using Type = base::EnumClass<ETypeDef>
 'enum class Type'

Public Member Functions

 Value ()
 Default ctor: ANY.
 Value (const std::string &value_r)
 Ctor from string (WFN format; "*" represents ANY; "" represents NA)
 Value (const char *value_r)
 Ctor from char* (WFN format; nullptr or "*" represent ANY; "" represents NA)
 Value (const std::string &encoded_r, FsFormatType)
 Ctor from string (FS format, "*" represents ANY; "-" represents NA)
 Value (const std::string &encoded_r, UriFormatType)
 Ctor from string (URI format, "" represents ANY; "-" represents NA)
Type type () const
 Return the Type of this Value.
bool isANY () const
 Whether value is ANY.
bool isNA () const
 Whether value is NA.
bool isLogical () const
 Whether it's a logical value (ANY|NA).
bool isLogical (Type type_r) const
bool isString () const
 Whether it's an attribute value string (not logical value).
bool isString (Type type_r) const
bool isWildcardfree () const
 An attribute value string without wildcards ([*?
bool isWildcarded () const
 An attribute value string with wildcards ([*?
std::string asString () const
 Default string representation [asWfn].
std::string asWfn () const
 String representation as in Well-Formed-Name (ANY:"*", NA:"").
std::string asFs () const
 String representation as in Formated-String (ANY:"*", NA:"-")
std::string asUri () const
 String representation as in URI (ANY:"", NA:"-")

Static Public Attributes

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

Private Member Functions

SetCompare setRelationMixinCompare (const Value &trg) const
 CPE name matching hook for SetRelationMixin.
bool containsWildcard () const
 HAs unquoted [*?

Private Attributes

RWCOW_pointer< std::string > _value

Friends

SetCompare base::SetRelationMixin (const Value &) const

(Note that these are not member symbols.)

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

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 159 of file CpeId.h.

Member Typedef Documentation

◆ Type

using zypp::CpeId::Value::Type = base::EnumClass<ETypeDef>

'enum class Type'

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 216 of file CpeId.h.

Constructor & Destructor Documentation

◆ Value() [1/5]

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

Default ctor: ANY.

Definition at line 181 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 449 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 192 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 509 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 574 of file CpeId.cc.

Member Function Documentation

◆ type()

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

Return the Type of this Value.

Definition at line 219 of file CpeId.h.

◆ isANY()

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

Whether value is ANY.

)

Definition at line 227 of file CpeId.h.

◆ isNA()

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

Whether value is NA.

)

Definition at line 231 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 235 of file CpeId.h.

◆ isLogical() [2/2]

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

Definition at line 238 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 242 of file CpeId.h.

◆ isString() [2/2]

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

Definition at line 245 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 249 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 253 of file CpeId.h.

◆ asString()

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

Default string representation [asWfn].

Definition at line 258 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 651 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:*:*:*:*:*:*
unsigned short a

Definition at line 664 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 710 of file CpeId.cc.

◆ setRelationMixinCompare()

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

CPE name matching hook for SetRelationMixin.

Definition at line 979 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 912 of file CpeId.cc.

◆ 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 1051 of file CpeId.cc.

Member Data Documentation

◆ ANY

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

Logical value matching ANY value.

Definition at line 163 of file CpeId.h.

◆ NA

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

Logical value indicating “not applicable/not used".

Definition at line 166 of file CpeId.h.

◆ fsFormat

CpeId::Value::FsFormatType zypp::CpeId::Value::fsFormat = FsFormatType()
staticconstexpr

Indicator argument for ctor arg in FS format.

Definition at line 172 of file CpeId.h.

◆ uriFormat

CpeId::Value::UriFormatType zypp::CpeId::Value::uriFormat = UriFormatType()
staticconstexpr

Indicator argument for ctor arg in URI format.

Definition at line 177 of file CpeId.h.

◆ _value

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

Definition at line 293 of file CpeId.h.


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