/*] Copyright (c) 2009-2010, Charles McGarvey [************************** **] All rights reserved. * * vi:ts=4 sw=4 tw=75 * * Distributable under the terms and conditions of the 2-clause BSD license; * see the file COPYING for a complete text of the license. * **************************************************************************/ #ifndef _MOOF_RESOURCE_HH_ #define _MOOF_RESOURCE_HH_ /** * @file Resource.hh * Interface for textures, sounds, and other types of resources. */ #include #include #include namespace Mf { /** * Generic resource class. */ class Resource { public: virtual ~Resource() {} /** * Add a directory to search when looking for resource files. * @param directory Path to a directory. */ static void addSearchPaths(const std::string& paths); static void addSearchPaths(const std::vector& pathList); /** * Get the path to a resource of a given name. * @param name Name of a resource. The name will be appended to each * search directory in order. * @return The first path found which resolves to a file. */ static std::string getPath(const std::string& path, const std::string& prefix = "", const std::string& extension = ""); static bool getPath(std::string& path, const std::string& prefix = "", const std::string& extension = ""); static FILE* openFile(std::string& path, std::string prefix = "", const std::string& extension = "", const std::string& mode = "rb"); private: static std::vector gSearchPaths; }; } // namespace Mf #endif // _MOOF_RESOURCE_HH_