3 #include <wibble/string.h>
18 #ifndef EPT_CORE_DESKTOP_H
19 #define EPT_CORE_DESKTOP_H
38 operator std::string()
const {
return name; }
44 while ( i.peek() != EOF ) {
46 if ( c ==
';' )
return i;
52 struct Entry : wibble::mixin::Comparable< Entry > {
54 Entry( std::string n, std::string g,
55 std::string p, std::string d , std::string i )
62 void load( std::string file ) {
64 std::ifstream i( file.c_str() );
82 std::istringstream i( s );
85 std::istream_iterator< Category >( i ),
86 std::istream_iterator< Category >(),
88 std::bind1st( std::equal_to< std::string >(),
"" ) );
95 std::string
id()
const {
return m_id; }
149 DIR *d = opendir(
dir.c_str() );
160 while ( ( ent = readdir( d ) ) != 0 ) {
161 std::string name( ent->d_name );
162 if ( name ==
"." || name ==
".." )
164 if ( !wibble::str::endsWith( name,
".desktop" ) )
207 t._id = std::string(
"desktop:" ) + i.
id();
213 e.
load( t.desktop() );
221 template< PropertyId p >
232 PropertyFilter< Group, IsInGroup >::T
group( std::string
id )
234 return propertyFilter< Group >(
IsInGroup(
id ) );
239 template<>
inline std::string Source::getInternal< Name >(
Entry e ) {
243 template<>
inline std::string Source::getInternal< Icon >(
Entry e ) {
247 template<>
inline ept::Token Source::getInternal< Package >( Entry e ) {
253 template<>
inline std::string Source::getInternal< Group >( Entry e ) {
254 return m_policy->group( e );
257 template<>
inline std::string Source::getInternal< ShortDescription >( Entry e ) {
258 return e.description();