2 #include <wibble/mixin.h>
10 struct Token : wibble::mixin::Comparable< Token > {
12 std::string
id()
const {
return _id; }
15 Token( std::string s ) : _id( s ) {}
18 return _id.find(
'_' ) == std::string::npos ?
"" :
19 std::string( _id, _id.find(
'_' ) + 1, _id.size() );
23 return std::string( _id, 0,
24 _id.find(
'_' ) == std::string::npos ?
25 _id.size() : _id.find(
'_' ) );
29 return std::string( _id, 0, 8 ) ==
"desktop:";
33 return isDesktop() ? std::string( _id, 8, _id.size() ) :
"";
bool hasVersion() const
Definition: token.h:36
std::string id() const
Definition: token.h:12
bool isDesktop() const
Definition: token.h:28
Token(std::string s)
Definition: token.h:15
std::string desktop() const
Definition: token.h:32
-*- C++ -*- (c) 2006, 2007 Petr Rockai me@mornfall.net
Definition: apt.cc:43
std::string package() const
Definition: token.h:22
bool valid() const
Definition: token.h:40
Token()
Definition: token.h:14
std::string version() const
Definition: token.h:17
std::string _id
Definition: token.h:11
std::ostream & operator<<(std::ostream &o, const Sources::Entry &e)
Definition: sources.h:193
bool operator<=(const Token &o) const
Definition: token.h:44