5 #include "IJsonFileLoader.h"
6 #include "IJsonFileParser.h"
8 #include "CallbackCollection.h"
26 struct LocalJsonFileLoad
30 , m_pCallback(&callback)
33 const std::string& GetUrl()
const {
return m_url; }
44 std::vector<LocalJsonFileLoad> m_loads;
46 bool TryLoad(
const LocalJsonFileLoad& load)
51 const bool fileOpenSuccess = m_fileIO.OpenFile(stream, size, load.GetUrl());
58 const std::string categoryJson((std::istreambuf_iterator<char>(stream)), std::istreambuf_iterator<char>());
62 const bool parseSuccess = m_parser.TryParse(categoryJson, parserResult);
69 m_parsedResultsCallbacks.ExecuteCallbacks(parserResult);
81 , m_parser(jsonParser)
82 , m_parsedResultsCallbacks(parsedResultsCallbacks)
89 m_loads.emplace_back(url, callback);
94 for (
typename std::vector<LocalJsonFileLoad>::const_iterator iter = m_loads.begin(); iter != m_loads.end(); ++iter)
96 bool success = TryLoad(*iter);
99 Eegeo_TTY(
"Failed to load interior label category json file %s", iter->GetUrl().c_str());
103 iter->GetCallback()(result);