Lumiera  0.pre.03
»edityourfreedom«
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
category.cpp
Go to the documentation of this file.
1 /*
2  Category - tree like classification of Assets
3 
4  Copyright (C) Lumiera.org
5  2008, Hermann Vosseler <Ichthyostega@web.de>
6 
7  This program is free software; you can redistribute it and/or
8  modify it under the terms of the GNU General Public License as
9  published by the Free Software Foundation; either version 2 of
10  the License, or (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 
21 * *****************************************************/
22 
23 
29 #include "proc/asset/category.hpp"
30 #include "lib/util.hpp"
31 #include "include/logging.h"
32 
33 #include <boost/algorithm/string.hpp>
34 
35 using boost::algorithm::starts_with;
36 using util::isnil;
37 
38 namespace proc {
39 namespace asset {
40 
44  Category::operator string () const
45  {
46  typedef const char * const SymID;
47 
48  SymID kinds[6] = { "AUDIO"
49  , "VIDEO"
50  , "EFFECT"
51  , "CODEC"
52  , "STRUCT"
53  , "META"
54  };
55  REQUIRE ( 0<=kind_ && kind_< 6 );
56  string str (kinds[kind_]);
57  if (!isnil (path_))
58  str += "/"+path_;
59  return str;
60  }
61 
62 
63 
68  bool
69  Category::isWithin (const Category& ref) const
70  {
71  return ( ref.hasKind (kind_)
72  && starts_with (path_, ref.path_)
73  );
74  }
75 
76 
77 }} // namespace asset
The asset subsystem of the Proc-Layer.
Definition: id-scheme.hpp:64
This header is for including and configuring NoBug.
bool hasKind(Kind refKind) const
Definition: category.hpp:88
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
Tree like classification of Assets.
Definition: category.hpp:75
bool isnil(lib::time::Duration const &dur)
Definition: timevalue.hpp:642
Proc-Layer implementation namespace root.
Definition: id-scheme.hpp:63
Definition of Asset categorisation.
bool isWithin(Category const &) const
hierarchical inclusion test.
Definition: category.cpp:69