All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
LocalJsonInteriorLabelCategoryLoader.h
1 // Copyright eeGeo Ltd (2012-2014), All Rights Reserved
2 
3 #pragma once
4 
5 
6 #include "IInteriorLabelCategoryLoader.h"
7 #include "Types.h"
8 #include "Helpers.h"
9 #include "CallbackCollection.h"
10 
11 #include <vector>
12 
13 namespace Eegeo
14 {
15  namespace Resources
16  {
17  namespace Interiors
18  {
20  {
21  public:
23 
25  const IInteriorLabelCategoryParser& interiorLabelCategoryParser,
26  TParsedResultsCallbacks& parsedResultsCallbacks
27  );
28 
29  void Load(const std::string& url, LoadCompleteCallbackType& callback);
30 
31  void Update();
32 
33  private:
34 
35  struct InteriorLabelCategoryLoad
36  {
37  InteriorLabelCategoryLoad(const std::string& url, LoadCompleteCallbackType& callback)
38  : m_url(url)
39  , m_pCallback(&callback)
40  {}
41 
42  const std::string& GetUrl() const { return m_url; }
43  LoadCompleteCallbackType& GetCallback() const { return *m_pCallback; }
44  private:
45  std::string m_url;
46  LoadCompleteCallbackType* m_pCallback;
47  };
48 
49  bool TryLoad(const InteriorLabelCategoryLoad& load);
50 
51  Helpers::IFileIO& m_fileIO;
52  const IInteriorLabelCategoryParser& m_interiorLabelCategoryParser;
53  TParsedResultsCallbacks& m_parsedResultsCallbacks;
54 
55  std::vector<InteriorLabelCategoryLoad> m_loads;
56  };
57  }
58  }
59 }