libzypp  14.32.0
zypp::ContentType Class Reference

Mime type like 'type/subtype' classification of content. More...

#include <ContentType.h>

Public Member Functions

 ContentType ()
 Default ctor: empty. More...
 
 ContentType (const std::string &type_r)
 Ctor taking "type[/subtype]" More...
 
 ContentType (const std::string &type_r, const std::string &subtype_r)
 Ctor taking type and subtype. More...
 
const std::string & type () const
 Get type. More...
 
void type (const std::string &type_r)
 Set type. More...
 
const std::string & subtype () const
 Get subtype. More...
 
void subtype (const std::string &subtype_r)
 Set subtype. More...
 
bool empty () const
 Whether type and subtype are empty. More...
 
bool emptyType () const
 Whether type is empty. More...
 
bool emptySubtype () const
 Whether subtype is empty. More...
 
 operator bool () const
 Validate object in a boolean context: !empty. More...
 
std::string asString () const
 String representation "type[/subtype]" More...
 

Private Member Functions

void testAndSet (std::string &var_r, const std::string &val_r)
 

Private Attributes

std::string _type
 
std::string _subtype
 

Related Functions

(Note that these are not member functions.)

std::ostream & operator<< (std::ostream &str, const ContentType &obj)
 
bool operator== (const ContentType &lhs, const ContentType &rhs)
 
bool operator!= (const ContentType &lhs, const ContentType &rhs)
 
bool operator< (const ContentType &lhs, const ContentType &rhs)
 
bool operator<= (const ContentType &lhs, const ContentType &rhs)
 
bool operator> (const ContentType &lhs, const ContentType &rhs)
 
bool operator>= (const ContentType &lhs, const ContentType &rhs)
 

Detailed Description

Mime type like 'type/subtype' classification of content.

Used e.g. in callback::UserData to describe the kind of user data passed as void* to a callback. Neither type nor subtype may contain a '/'.

Definition at line 29 of file ContentType.h.

Constructor & Destructor Documentation

zypp::ContentType::ContentType ( )
inline

Default ctor: empty.

Definition at line 33 of file ContentType.h.

zypp::ContentType::ContentType ( const std::string &  type_r)
inlineexplicit

Ctor taking "type[/subtype]"

Exceptions
std::invalid_argumentif string is malformed

Definition at line 39 of file ContentType.h.

zypp::ContentType::ContentType ( const std::string &  type_r,
const std::string &  subtype_r 
)
inline

Ctor taking type and subtype.

Exceptions
std::invalid_argumentif string is malformed

Definition at line 56 of file ContentType.h.

Member Function Documentation

const std::string& zypp::ContentType::type ( ) const
inline

Get type.

Definition at line 64 of file ContentType.h.

void zypp::ContentType::type ( const std::string &  type_r)
inline

Set type.

Exceptions
std::invalid_argumentif string is malformed

Definition at line 70 of file ContentType.h.

const std::string& zypp::ContentType::subtype ( ) const
inline

Get subtype.

Definition at line 74 of file ContentType.h.

void zypp::ContentType::subtype ( const std::string &  subtype_r)
inline

Set subtype.

Exceptions
std::invalid_argumentif string is malformed

Definition at line 80 of file ContentType.h.

bool zypp::ContentType::empty ( ) const
inline

Whether type and subtype are empty.

Definition at line 85 of file ContentType.h.

bool zypp::ContentType::emptyType ( ) const
inline

Whether type is empty.

Definition at line 88 of file ContentType.h.

bool zypp::ContentType::emptySubtype ( ) const
inline

Whether subtype is empty.

Definition at line 91 of file ContentType.h.

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

Validate object in a boolean context: !empty.

Definition at line 95 of file ContentType.h.

std::string zypp::ContentType::asString ( ) const
inline

String representation "type[/subtype]"

Definition at line 99 of file ContentType.h.

void zypp::ContentType::testAndSet ( std::string &  var_r,
const std::string &  val_r 
)
inlineprivate

Definition at line 103 of file ContentType.h.

Friends And Related Function Documentation

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

Stream output

Definition at line 115 of file ContentType.h.

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

Definition at line 119 of file ContentType.h.

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

Definition at line 123 of file ContentType.h.

bool operator< ( const ContentType lhs,
const ContentType rhs 
)
related

Definition at line 127 of file ContentType.h.

bool operator<= ( const ContentType lhs,
const ContentType rhs 
)
related

Definition at line 131 of file ContentType.h.

bool operator> ( const ContentType lhs,
const ContentType rhs 
)
related

Definition at line 135 of file ContentType.h.

bool operator>= ( const ContentType lhs,
const ContentType rhs 
)
related

Definition at line 139 of file ContentType.h.

Member Data Documentation

std::string zypp::ContentType::_type
private

Definition at line 110 of file ContentType.h.

std::string zypp::ContentType::_subtype
private

Definition at line 111 of file ContentType.h.


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