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 ) );
238 return t.get<
Group >();
241 list::Unique< list::Sorted<
242 list::Map< ComposedList< Name >,
246 list::sort( list::map( list< Name >(),
251 template<>
inline std::string Source::getInternal< Name >(
Entry e ) {
255 template<>
inline std::string Source::getInternal< Icon >(
Entry e ) {
259 template<>
inline ept::Token Source::getInternal< Package >( Entry e ) {
265 template<>
inline std::string Source::getInternal< Group >( Entry e ) {
266 return m_policy->group( e );
269 template<>
inline std::string Source::getInternal< ShortDescription >( Entry e ) {
270 return e.description();