11 #ifndef ZYPP_CONTENTTYPE_H
12 #define ZYPP_CONTENTTYPE_H
42 if ( pos != std::string::npos )
61 const std::string &
type()
const
67 void type( std::string type_r )
68 {
_type = std::move(type_r); }
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 +
"'" );
104 var_r = std::move(val_r);
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 ); }
142 #endif // ZYPP_CONTENTTYPE_H
bool operator!=(const ContentType &lhs, const ContentType &rhs)
bool emptySubtype() const
Whether subtype is empty.
bool operator<(const ContentType &lhs, const ContentType &rhs)
bool operator>(const ContentType &lhs, const ContentType &rhs)
void subtype(std::string subtype_r)
Set subtype.
bool empty() const
Whether type and subtype are empty.
void type(std::string type_r)
Set type.
bool operator>=(const ContentType &lhs, const ContentType &rhs)
const std::string & subtype() const
Get subtype.
const std::string & type() const
Get type.
ContentType(std::string type_r)
Ctor taking "type[/subtype]"
bool operator==(const ContentType &lhs, const ContentType &rhs)
std::ostream & operator<<(std::ostream &str, const ContentType &obj)
void testAndSet(std::string &var_r, std::string val_r)
ContentType(std::string type_r, std::string subtype_r)
Ctor taking type and subtype.
ContentType()
Default ctor: empty.
bool operator<=(const ContentType &lhs, const ContentType &rhs)
std::string asString() const
String representation "type[/subtype]"
bool emptyType() const
Whether type is empty.
Mime type like 'type/subtype' classification of content.