00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include "proc/asset/category.hpp"
00025 #include "lib/util.hpp"
00026 #include "include/nobugcfg.h"
00027
00028 #include <boost/algorithm/string.hpp>
00029
00030 using boost::algorithm::starts_with;
00031 using util::isnil;
00032
00033 namespace asset
00034 {
00035
00039 Category::operator string () const
00040 {
00041 typedef const char * const SymID;
00042
00043 SymID kinds[6] = { "AUDIO"
00044 , "VIDEO"
00045 , "EFFECT"
00046 , "CODEC"
00047 , "STRUCT"
00048 , "META"
00049 };
00050 REQUIRE ( 0<=kind_ && kind_< 6 );
00051 string str (kinds[kind_]);
00052 if (!isnil (path_))
00053 str += "/"+path_;
00054 return str;
00055 }
00056
00057
00058
00063 bool
00064 Category::isWithin (const Category& ref) const
00065 {
00066 return ( ref.hasKind (kind_)
00067 && starts_with (path_, ref.path_)
00068 );
00069 }
00070
00071
00072 }