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)
5  2008, Hermann Vosseler <Ichthyostega@web.de>
6 
7   **Lumiera** is free software; you can redistribute it and/or modify it
8   under the terms of the GNU General Public License as published by the
9   Free Software Foundation; either version 2 of the License, or (at your
10   option) any later version. See the file COPYING for further details.
11 
12 * *****************************************************************/
13 
14 
20 #include "steam/asset/category.hpp"
21 #include "lib/util.hpp"
22 #include "include/logging.h"
23 
24 #include <boost/algorithm/string.hpp>
25 
26 using boost::algorithm::starts_with;
27 using util::isnil;
28 
29 namespace steam {
30 namespace asset {
31 
35  Category::operator string () const
36  {
37  typedef const char * const SymID;
38 
39  SymID kinds[6] = { "AUDIO"
40  , "VIDEO"
41  , "EFFECT"
42  , "CODEC"
43  , "STRUCT"
44  , "META"
45  };
46  REQUIRE ( 0<=kind_ && kind_< 6 );
47  string str (kinds[kind_]);
48  if (!isnil (path_))
49  str += "/"+path_;
50  return str;
51  }
52 
53 
54 
59  bool
60  Category::isWithin (const Category& ref) const
61  {
62  return ( ref.hasKind (kind_)
63  && starts_with (path_, ref.path_)
64  );
65  }
66 
67 
68 }} // namespace asset
bool isWithin(Category const &) const
hierarchical inclusion test.
Definition: category.cpp:60
Tree like classification of Assets.
Definition: category.hpp:66
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:35
Definition of Asset categorisation.