34 lines
647 B
C++
34 lines
647 B
C++
/* ===============================================================
|
|
Asset
|
|
================================================================ */
|
|
#include "Asset.hpp"
|
|
#include <stdlib.h>
|
|
Asset::Asset() {
|
|
flags = IS_NULL;
|
|
data = NULL;
|
|
data_length = 0;
|
|
data_checksum = 0;
|
|
}
|
|
Asset::~Asset() {
|
|
if (flags & IS_LOADED) {
|
|
free(data);
|
|
}
|
|
}
|
|
std::string Asset::getName() {
|
|
return filename;
|
|
}
|
|
char* Asset::getData() {
|
|
return data;
|
|
}
|
|
off_t Asset::getDataLength() {
|
|
return data_length;
|
|
}
|
|
uint32_t Asset::getChecksum() {
|
|
return data_checksum;
|
|
}
|
|
void Asset::unloadData() {
|
|
if (flags & IS_LOADED) {
|
|
free(data);
|
|
}
|
|
flags &= ~IS_LOADED;
|
|
} |