iFun Engine API  1.0.0-b2601
Great Technology for Great Games
 All Classes Files Functions Variables Typedefs Macros
resource_manager.h
Go to the documentation of this file.
1 // Copyright (C) 2013-2015 iFunFactory Inc. All Rights Reserved.
2 //
3 // This work is confidential and proprietary to iFunFactory Inc. and
4 // must not be used, disclosed, copied, or distributed without the prior
5 // consent of iFunFactory Inc.
6 
9 #ifndef INCLUDE_FUNAPI_SYSTEM_RESOURCE_MANAGER_H_
10 #define INCLUDE_FUNAPI_SYSTEM_RESOURCE_MANAGER_H_
11 
12 #include <boost/unordered_map.hpp>
13 #include <funapi/common/json.h>
15 #include <funapi/types.h>
16 
17 namespace fun {
18 
19 const string &GetResRoot();
20 
21 
23 typedef boost::unordered_map<int, Ptr<const Json> > IndexedJsonData;
24 
25 
26 class ResourceManager : public Component {
27  public:
29  static void Reload();
30 
33  static void Reload(const string &filename);
34 
36  //
39  static Ptr<const Json> GetJsonData(const string &filename);
40 
45  static Ptr<const IndexedJsonData> IndexJsonArray(const Json &array,
46  const string &fieldname);
47 
48 
49  // Invoked by Funapi framework.
50  static bool Install(const ArgumentMap &arguments);
51  static bool Uninstall();
52 };
53 
54 } // namespace fun
55 
56 #endif // INCLUDE_FUNAPI_SYSTEM_RESOURCE_MANAGER_H_
ArgumentMap class manages application-specific run-time arguments.
Definition: argument_map.h:23
Base class for any service in Funapi.
Definition: component.h:19
Definition: resource_manager.h:26
static Ptr< const Json > GetJsonData(const string &filename)
Returns JSON object identified as '$dirname/$filename'.
static void Reload()
Reloads all resource files from JSON, Text and Database.
Definition: json.h:27
static Ptr< const IndexedJsonData > IndexJsonArray(const Json &array, const string &fieldname)
Converts JSON array into a map.