asset::Category Class Reference

Tree like classification of Assets. More...

#include <category.hpp>

Collaboration diagram for asset::Category:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 Category (const Kind root, string subfolder="")
int compare (const Category &co) const
bool hasKind (Kind refKind) const
bool isWithin (const Category &) const
 hierarchical inclusion test.
 operator string () const
 human readable representation of the asset::Category.
bool operator!= (const Category &other) const
bool operator== (const Category &other) const
void setPath (const string &newpath)

Private Attributes

Kind kind_
string path_

Friends

size_t hash_value (const Category &cat)


Detailed Description

By virtue of the Category, Assets can be organized in nested bins (folders). This includes the distinction of different kinds of Assets, like Audio, Video, Effects...

Todo:
could be far more elaborate. could be a singleton like centralized tree, while just holding references to Catetory nodes in the individual Asset. At the moment, we use just the most simplistic implementation and handle Category objects using value semantics.

Definition at line 64 of file category.hpp.


Member Function Documentation

bool asset::Category::isWithin ( const Category ref  )  const

Returns:
true if this can be considered a subcategory of the given reference

Definition at line 62 of file category.cpp.

References hasKind(), and path_.

00063   {
00064     return ( ref.hasKind (kind_)
00065           && starts_with (path_, ref.path_) 
00066            );
00067   }

Here is the call graph for this function:

asset::Category::operator string (  )  const

Todo:
to be localized.

Definition at line 39 of file category.cpp.

00040   {
00041     char *kinds[6] = { "AUDIO"
00042                      , "VIDEO"
00043                      , "EFFECT"
00044                      , "CODEC"
00045                      , "STRUCT"
00046                      , "META"
00047                      };
00048     REQUIRE ( 0<=kind_ && kind_< 6 );
00049     string str (kinds[kind_]);
00050     if (!isnil (path_))
00051       str += "/"+path_;
00052     return str;
00053   }


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

Generated on Sat Aug 16 18:10:40 2008 for Lumiera by  doxygen 1.5.5