]> Dogcows Code - chaz/yoink/blob - src/Moof/Resource.hh
8446d0896b715cd626a2444e97172903a6c00fa6
[chaz/yoink] / src / Moof / Resource.hh
1
2 /*] Copyright (c) 2009-2010, Charles McGarvey [**************************
3 **] All rights reserved.
4 *
5 * vi:ts=4 sw=4 tw=75
6 *
7 * Distributable under the terms and conditions of the 2-clause BSD license;
8 * see the file COPYING for a complete text of the license.
9 *
10 **************************************************************************/
11
12 #ifndef _MOOF_RESOURCE_HH_
13 #define _MOOF_RESOURCE_HH_
14
15 /**
16 * @file Resource.hh
17 * Interface for textures, sounds, and other types of resources.
18 */
19
20 #include <string>
21 #include <vector>
22
23
24 namespace Mf {
25
26
27 /**
28 * Generic resource class.
29 */
30
31 class Resource
32 {
33 public:
34
35 virtual ~Resource() {}
36
37
38 /**
39 * Add a directory to search when looking for resource files.
40 * @param directory Path to a directory.
41 */
42
43 static void addSearchPaths(const std::string& path);
44 static void addSearchPaths(const std::vector<std::string>& path);
45
46 /**
47 * Get the path to a resource of a given name.
48 * @param name Name of a resource. The name will be appended to each
49 * search directory in order.
50 * @return The first path found which resolves to a file.
51 */
52
53 static std::string getPath(const std::string& name);
54
55 private:
56
57 static std::vector<std::string> gSearchPaths;
58 };
59
60
61 } // namespace Mf
62
63 #endif // _MOOF_RESOURCE_HH_
64
This page took 0.029927 seconds and 3 git commands to generate.