]> Dogcows Code - chaz/yoink/blob - src/Moof/Resource.hh
tcp socket disconnecting by remote
[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 <cstdio>
21 #include <string>
22 #include <vector>
23
24
25 namespace Mf {
26
27
28 /**
29 * Generic resource class.
30 */
31
32 class Resource
33 {
34 public:
35
36 virtual ~Resource() {}
37
38
39 /**
40 * Add a directory to search when looking for resource files.
41 * @param directory Path to a directory.
42 */
43
44 static void addSearchPaths(const std::string& paths);
45 static void addSearchPaths(const std::vector<std::string>& pathList);
46
47 /**
48 * Get the path to a resource of a given name.
49 * @param name Name of a resource. The name will be appended to each
50 * search directory in order.
51 * @return The first path found which resolves to a file.
52 */
53
54 static std::string getPath(const std::string& path,
55 const std::string& prefix = "",
56 const std::string& extension = "");
57
58 static bool getPath(std::string& path,
59 const std::string& prefix = "",
60 const std::string& extension = "");
61
62 static FILE* openFile(std::string& path,
63 std::string prefix = "",
64 const std::string& extension = "",
65 const std::string& mode = "rb");
66
67 private:
68
69 static std::vector<std::string> gSearchPaths;
70 };
71
72
73 } // namespace Mf
74
75 #endif // _MOOF_RESOURCE_HH_
76
This page took 0.035447 seconds and 4 git commands to generate.