11#ifndef ZYPP_CONTENTTYPE_H
12#define ZYPP_CONTENTTYPE_H
41 std::string::size_type pos =
type_r.find(
'/' );
42 if ( pos != std::string::npos )
61 const std::string &
type()
const
86 {
return _type.empty(); }
92 explicit operator bool ()
const
102 if (
val_r.find_first_of(
"/ \t\r\n" ) != std::string::npos )
103 throw std::invalid_argument(
"ContentType: illegal char in '" +
val_r +
"'" );
113 {
return str <<
obj.asString(); }
121 {
return !( lhs == rhs ); }
125 {
int cmp = lhs.
type().compare( rhs.
type() );
return cmp < 0 || ( cmp == 0 && lhs.
subtype() < rhs.
subtype() ); }
129 {
return lhs < rhs || lhs == rhs; }
133 {
return !( lhs <= rhs ); }
137 {
return !( lhs < rhs ); }
Reference counted access to a Tp object calling a custom Dispose function when the last AutoDispose h...
Mime type like 'type/subtype' classification of content.
bool operator>(const ContentType &lhs, const ContentType &rhs)
const std::string & subtype() const
Get subtype.
bool operator==(const ContentType &lhs, const ContentType &rhs)
ContentType(std::string type_r, std::string subtype_r)
Ctor taking type and subtype.
bool operator<=(const ContentType &lhs, const ContentType &rhs)
std::ostream & operator<<(std::ostream &str, const ContentType &obj)
Stream output.
bool emptySubtype() const
Whether subtype is empty.
void subtype(std::string subtype_r)
Set subtype.
const std::string & type() const
Get type.
ContentType()
Default ctor: empty.
ContentType(std::string type_r)
Ctor taking "type[/subtype]"
bool operator<(const ContentType &lhs, const ContentType &rhs)
bool empty() const
Whether type and subtype are empty.
bool operator>=(const ContentType &lhs, const ContentType &rhs)
void type(std::string type_r)
Set type.
bool operator!=(const ContentType &lhs, const ContentType &rhs)
bool emptyType() const
Whether type is empty.
std::string asString() const
String representation "type[/subtype]"
void testAndSet(std::string &var_r, std::string val_r)
String related utilities and Regular expression matching.
Easy-to use interface to the ZYPP dependency resolver.