Fling Engine  0.00.1
Fling Engine is a game engine written in Vulkan
JsonFile.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "Resource.h"
4 
5 #include <sstream>
6 #include <iostream>
7 #include <fstream>
8 #include <iomanip>
9 #include <nlohmann/json.hpp>
10 
11 namespace Fling
12 {
16  class JsonFile : public Resource
17  {
18  public:
19 
20  static std::shared_ptr<Fling::JsonFile> Create(Guid t_ID);
21 
27  explicit JsonFile(Guid t_ID);
28 
29  virtual ~JsonFile() = default;
30 
35  FORCEINLINE nlohmann::json& GetJsonData() { return m_JsonData; }
36 
40  void Write();
41 
42  protected:
43 
44  nlohmann::json m_JsonData;
45 
50  void LoadJsonFile();
51  };
52 } // namespace Fling
nlohmann::json m_JsonData
Definition: JsonFile.h:44
Base class that represents a loaded resource in the engine.
Definition: Resource.h:11
void LoadJsonFile()
Loads the JsonFile based on Guid path.
Definition: JsonFile.cpp:36
void Write()
Write the contents of this JSON file out to given name.
Definition: JsonFile.cpp:18
virtual ~JsonFile()=default
entt::hashed_string Guid
Definition: FlingTypes.h:26
A JsonFile provides an interface for easily using JSON files.
Definition: JsonFile.h:16
JsonFile(Guid t_ID)
Construct a new JsonFile object.
Definition: JsonFile.cpp:12
static std::shared_ptr< Fling::JsonFile > Create(Guid t_ID)
Definition: JsonFile.cpp:7
FORCEINLINE nlohmann::json & GetJsonData()
Get a reference to the current JSON data that is loaded from this file.
Definition: JsonFile.h:35
Definition: Engine.h:29