 |
Gorgon Game Engine
|
Go to the documentation of this file.
9 namespace Gorgon {
namespace Resource {
31 unsigned long GetSize()
const {
return (
unsigned long)
data.size(); }
45 std::vector<Byte> t;
data.swap(t);
76 bool load(std::shared_ptr<Reader>
reader,
unsigned long size,
bool forceload);
constexpr Type File
File.
Definition: GID.h:84
std::enable_if< decltype(gorgon__enum_tr_loc(T_()))::isupgradedenum, std::string >::type From(const T_ &e)
Definition: Enum.h:303
static Blob * LoadResource(std::weak_ptr< File > file, std::shared_ptr< Reader > reader, unsigned long size)
This function loads a blob resource from the given file.
Definition: Blob.cpp:7
GID::Type compression
Compression mode of this blob.
Definition: Blob.h:91
bool load(std::shared_ptr< Reader > reader, unsigned long size, bool forceload)
Loads the blob from the data stream.
Definition: Blob.cpp:52
std::ostream & GetStream()
This should be last resort, use if the actual stream is needed.
Definition: Writer.h:96
bool lateloading
Whether to load this blob during initial loading.
Definition: Blob.h:94
Type GetType() const
Returns the type of the blob.
Definition: Blob.h:34
void WriteChunkHeader(GID::Type type, unsigned long size)
Writes the header of a chunk.
Definition: Writer.h:364
int Type
The type information related to the blob.
Definition: Blob.h:19
Blob()
Default constructor.
Definition: Blob.h:22
void Destroy()
Destroys the data stored in the blob.
Definition: Blob.h:43
Marker WriteObjectStart(const Base &base)
Writes the start of an object. Should have a matching WriteEnd with the returned marker.
Definition: File.cpp:211
void WriteUInt32(unsigned long value)
Writes a 32-bit unsigned integer to the stream.
Definition: Writer.h:158
std::vector< Byte > & GetData()
Returns the data stored in this blob.
Definition: Blob.h:57
bool Load()
Loads the blob from the disk. If blob is already loaded, this function will return true.
Definition: Blob.cpp:33
void Encode(I_ &input, O_ &output)
Encodes the given data to LZMA compressed data.
Definition: LZMA.h:293
bool ImportFile(const std::string &filename)
Imports the given file as data without changing the type of the blob.
Definition: Blob.h:60
void ASSERT_FALSE(const std::string &message, int skip=1, int depth=4)
Definition: Assert.h:192
This is sound resource.
Definition: Blob.h:15
virtual GID::Type GetGID() const override
04010000h (Extended, Blob)
Definition: Blob.h:28
Root namespace for Gorgon Game Engine.
Definition: Any.h:19
bool IsLoaded() const
Returns whether the blob data is loaded.
Definition: Blob.h:53
Marker WriteChunkStart(GID::Type type)
Writes the start of a chunk. Should have a matching WriteEnd.
Definition: Writer.h:351
void save(Writer &writer) const override
Definition: Blob.cpp:108
unsigned long GetSize() const
Size of the blob.
Definition: Blob.h:31
bool AppendFile(const std::string &filename)
Appends the given file to the end of the blob data.
Definition: Blob.cpp:163
std::vector< Byte > & Ready(unsigned long size, Type type=0)
Readies the blob for data writing.
Definition: Blob.cpp:18
LZMA Lzma
A default constructed LZMA object.
Definition: LZMA.cpp:196
constexpr Type None
Empty, different from Null resource.
Definition: GID.h:81
constexpr Type Blob
Definition: GID.h:227
constexpr Type Blob_Cmp_Data
Definition: GID.h:230
This class is the base for all Gorgon Resources.
Definition: Base.h:20
std::shared_ptr< Reader > reader
Used to handle late loading.
Definition: Blob.h:85
virtual ~Blob()
Destructor.
Definition: Blob.h:25
constexpr Type Blob_Data
Definition: GID.h:229
This class allows resource objects to save their data to a stream.
Definition: Writer.h:59
std::vector< Byte > data
Blob data.
Definition: Blob.h:100
Type type
Type of the blob data.
Definition: Blob.h:97
unsigned char Byte
Represents smallest cell in memory.
Definition: Types.h:9
void WriteEnd(Marker &marker)
This function performs writes necessary to end a chunk that is represented by the marker.
Definition: Writer.h:373
constexpr Type Blob_Props
Definition: GID.h:228
void WriteInt32(long value)
Writes a 32-bit integer to the stream.
Definition: Writer.h:149
constexpr Type LZMA
LZMA compression.
Definition: GID.h:120
void WriteBool(bool value)
Writes a boolean value. In resource 1.0, booleans are stored as 32bit integers.
Definition: Writer.h:220
Type to store GID information.
Definition: GID.h:23
void WriteGID(GID::Type value)
Writes a GID to the given stream.
Definition: Writer.h:303
void Decode(I_ &input, O_ &output, Byte *compressionproperties=nullptr, unsigned long long fsize=(unsigned long long)(long long) -1)
Decodes LZMA compressed data.
Definition: LZMA.h:317
unsigned long entrypoint
Entry point of this resource within the physical file.
Definition: Blob.h:82
bool isloaded
Whether this blob is loaded or not.
Definition: Blob.h:88
void WriteVector(const std::vector< T_ > &data)
Writes a vector to the stream.
Definition: Writer.h:298