39 FILE* fp = fopen(fileName.c_str(),
"wb");
47 template <
typename DICT>
48 static bool TryLoadFromFile(
const std::string& fileName,
49 std::shared_ptr<DICT>* dict) {
53 _wfopen(UTF8Util::GetPlatformString(fileName).c_str(), L
"rb")
55 fopen(UTF8Util::GetPlatformString(fileName).c_str(),
"rb")
62 std::shared_ptr<DICT> loadedDict = DICT::NewFromFile(fp);
68 template <
typename DICT>
69 static std::shared_ptr<DICT> NewFromFile(
const std::string& fileName) {
70 std::shared_ptr<DICT> dict;
71 if (!TryLoadFromFile<DICT>(fileName, &dict)) {
72 throw FileNotFound(fileName);
Definition: Exception.hpp:55
Serializable dictionary interface.
Definition: SerializableDict.hpp:28
virtual void SerializeToFile(const std::string &fileName) const
Serializes the dictionary and writes in to a file.
Definition: SerializableDict.hpp:38
virtual void SerializeToFile(FILE *fp) const =0
Serializes the dictionary and writes in to a file.