Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
category.hpp
Go to the documentation of this file.
1/*
2 CATEGORY.hpp - 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#ifndef STEAM_ASSET_CATEGORY_H
21#define STEAM_ASSET_CATEGORY_H
22
23#include "lib/symbol.hpp"
24#include "lib/hash-standard.hpp"
25
26#include <string>
27#include <compare>
28#include <boost/functional/hash.hpp>
29
30
31
32namespace steam {
33namespace asset {
34
35 using lib::Literal;
36
37 using std::string;
38 using std::ostream;
39
55
56 /************************************************************************************/
68 {
69
71 string path_;
72
73 public:
74 Category (const Kind root, Literal subfolder ="")
75 : kind_(root), path_(subfolder) {};
76
77 auto operator<=> (Category const&) const =default;
78
79 bool hasKind (Kind refKind) const { return kind_ == refKind; }
80 bool isWithin (Category const&) const;
81 void setPath (string const& newpath) { this->path_ = newpath; }
82
83 operator string () const;
84
85 friend size_t hash_value (Category const&);
86 };
87
88
89 inline size_t
90 hash_value (Category const& cat)
91 {
92 size_t hash = 0;
93 boost::hash_combine(hash, cat.kind_);
94 boost::hash_combine(hash, cat.path_);
95 return hash;
96 }
97
98
99
100}} // namespace steam::asset
101#endif
Inline string literal.
Definition symbol.hpp:78
Tree like classification of Assets.
Definition category.hpp:68
bool isWithin(Category const &) const
hierarchical inclusion test.
Definition category.cpp:60
auto operator<=>(Category const &) const =default
friend size_t hash_value(Category const &)
Definition category.hpp:90
Category(const Kind root, Literal subfolder="")
Definition category.hpp:74
void setPath(string const &newpath)
Definition category.hpp:81
bool hasKind(Kind refKind) const
Definition category.hpp:79
Helper to use a single extension point for specialised hash functions.
#define hash
basic_ostream< char, char_traits< char > > ostream
The asset subsystem of the Steam-Layer.
size_t hash_value(Category const &cat)
Definition category.hpp:90
Kind
top-level distinction of different Kinds of Assets.
Definition category.hpp:48
Steam-Layer implementation namespace root.
Marker types to indicate a literal string and a Symbol.