Lumiera  0.pre.03
»edit your freedom«
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 "steam/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 steam {
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
bool isWithin(Category const &) const
hierarchical inclusion test.
Definition: category.cpp:69
Tree like classification of Assets.
Definition: category.hpp:75
This header is for including and configuring NoBug.
Steam-Layer implementation namespace root.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
The asset subsystem of the Steam-Layer.
Definition: wrapperptr.hpp:44
Definition of Asset categorisation.