Fling Engine  0.00.1
Fling Engine is a game engine written in Vulkan
File.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "Resource.h"
4 
5 #include <fstream>
6 #include <vector>
7 
8 namespace Fling
9 {
13  class File : public Resource
14  {
15  public:
16 
17  static std::shared_ptr<Fling::File> Create(Guid t_ID);
18 
24  explicit File(Guid t_ID);
25 
31  const char* GetData() const { return m_Characters.data(); }
32 
38  size_t GetFileLength() const { return m_Characters.size(); }
39 
43  bool IsLoaded() const { return m_Characters.size() != 0; }
44 
45  private:
46 
52  void LoadFile();
53 
55  std::vector<char> m_Characters;
56  };
57 } // namespace Fling
void LoadFile()
Loads the file based on Guid path.
Definition: File.cpp:18
Base class that represents a loaded resource in the engine.
Definition: Resource.h:11
bool IsLoaded() const
Returns true if this file resource is loaded or not (i.e.
Definition: File.h:43
entt::hashed_string Guid
Definition: FlingTypes.h:26
File(Guid t_ID)
Construct a new File object.
Definition: File.cpp:12
const char * GetData() const
Get char* that represents the text in this file.
Definition: File.h:31
std::vector< char > m_Characters
Array of characters that represents this file.
Definition: File.h:55
static std::shared_ptr< Fling::File > Create(Guid t_ID)
Definition: File.cpp:7
Definition: Engine.h:29
A file is a basic text file that contains a basic text file.
Definition: File.h:13
size_t GetFileLength() const
Get the File Length object.
Definition: File.h:38