]>
Dogcows Code - chaz/yoink/blob - src/moof/resource.hh
2 /*] Copyright (c) 2009-2010, Charles McGarvey [**************************
3 **] All rights reserved.
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.
10 **************************************************************************/
12 #ifndef _MOOF_RESOURCE_HH_
13 #define _MOOF_RESOURCE_HH_
17 * Interface for textures, sounds, and other types of resources.
29 * Generic resource class.
36 virtual ~resource() {}
40 * Add a directory to search when looking for resource files.
41 * \param paths A colon-separated list of directory paths.
43 static void add_search_paths(const std::string
& paths
);
46 * Add directories to search when looking for resource files.
47 * \param pathList The list of directory paths.
49 static void add_search_paths(const std::vector
<std::string
>& pathList
);
53 * Get the path to a resource of a given name.
54 * \param path The name of the resource to find. Upon successful
55 * return, this is changed to an absolute path to the resource.
56 * \param prefix A colon-separated list of subdirectories to search.
57 * \param extension A colon-separated list of possible extensions.
58 * \return True if a path to a resource was found, false otherwise.
60 static bool find_path(std::string
& path
,
61 const std::string
& prefix
= "",
62 const std::string
& extension
= "");
65 * Get the path to a resource of a given name and open it if a resource
67 * \param path The name of the resource to find. Upon successful
68 * return, this is changed to an absolute path to the resource.
69 * \param prefix A colon-separated list of subdirectories to search.
70 * \param extension A colon-separated list of possible extensions.
71 * \param mode The open mode.
72 * \return The FILE* if the resource was found, 0 otherwise.
74 static FILE* open_file(std::string
& path
,
75 const std::string
& prefix
= "",
76 const std::string
& extension
= "",
77 const std::string
& mode
= "rb");
82 static std::vector
<std::string
> search_paths_
;
88 #endif // _MOOF_RESOURCE_HH_
This page took 0.039015 seconds and 4 git commands to generate.