Back to index

unity  6.0.0
Public Member Functions | Private Attributes
unity::DndData Class Reference

#include <DndData.h>

Collaboration diagram for unity::DndData:
Collaboration graph
[legend]

List of all members.

Public Member Functions

void Fill (char *uris)
 Fills the object given a list of uris.
void Reset ()
 Resets the object.
std::set< std::string > const & Uris () const
 Returns a std::set<std::string> with all the uris.
std::set< std::string > const & Types () const
 Returns a std::set<std::string> with all the types.
std::set< std::string > const & UrisByType (const std::string &type) const
 Returns a std::set<std::string> with all uris of a given type.
std::string const & TypeByUri (const std::string &uris)
 Returns a std::set<std::string> with all types of a given uri.

Private Attributes

std::set< std::string > uris_
std::set< std::string > types_
std::map< std::string,
std::string > 
uris_to_types_
std::map< std::string,
std::set< std::string > > 
types_to_uris_

Detailed Description

Definition at line 29 of file DndData.h.


Member Function Documentation

void unity::DndData::Fill ( char *  uris)

Fills the object given a list of uris.

Definition at line 31 of file DndData.cpp.

{ 
  Reset();
  
  char* pch = strtok (uris, "\r\n");
  while (pch != NULL)
  {
    glib::Object<GFile> file(g_file_new_for_uri(pch));
    glib::Object<GFileInfo> info(g_file_query_info(file, G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE, G_FILE_QUERY_INFO_NONE, NULL, NULL));
    const char* content_type = g_file_info_get_content_type(info);
    
    uris_.insert(pch);
    
    if (content_type != NULL)
    {
      types_.insert(content_type);
      uris_to_types_[pch] = content_type;
      types_to_uris_[content_type].insert(pch);
    }
       
    pch = strtok (NULL, "\r\n");
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Resets the object.

Call this function when no longer need data

Definition at line 55 of file DndData.cpp.

{
  uris_.clear();
  types_.clear();
  uris_to_types_.clear();
  types_to_uris_.clear();
}

Here is the caller graph for this function:

std::string const& unity::DndData::TypeByUri ( const std::string &  uris) [inline]

Returns a std::set<std::string> with all types of a given uri.

Definition at line 60 of file DndData.h.

{ return uris_to_types_.find(uris)->second; }
std::set<std::string> const& unity::DndData::Types ( ) const [inline]

Returns a std::set<std::string> with all the types.

Definition at line 50 of file DndData.h.

{ return types_; }

Here is the caller graph for this function:

std::set<std::string> const& unity::DndData::Uris ( ) const [inline]

Returns a std::set<std::string> with all the uris.

Definition at line 45 of file DndData.h.

{ return uris_; }

Here is the caller graph for this function:

std::set<std::string> const& unity::DndData::UrisByType ( const std::string &  type) const [inline]

Returns a std::set<std::string> with all uris of a given type.

Definition at line 55 of file DndData.h.

{ return types_to_uris_.find(type)->second; }

Here is the caller graph for this function:


Member Data Documentation

std::set<std::string> unity::DndData::types_ [private]

Definition at line 64 of file DndData.h.

std::map<std::string, std::set<std::string> > unity::DndData::types_to_uris_ [private]

Definition at line 66 of file DndData.h.

std::set<std::string> unity::DndData::uris_ [private]

Definition at line 63 of file DndData.h.

std::map<std::string, std::string> unity::DndData::uris_to_types_ [private]

Definition at line 65 of file DndData.h.


The documentation for this class was generated from the following files: