Files
EVEngine/src/modules/filesystem/FileData.h
T
西风逍遥游 4377e062dd feat: zeroerr parameter validation + Doxygen API documentation
Squashed onto current main. Adds src/engine/common/Assert.h (EV_PARAM_CHECK / EV_ASSERT backed by zeroerr), an EVENGINE_ENABLE_ASSERTS option (non-Debug builds strip ZEROERR_NO_ASSERT unless enabled), parameter checks at key entry points, Doxygen comments across headers, Doxyfile + make docs / CMake docs targets, and Windows setup + code conventions in AGENTS.md.
2026-08-19 09:01:12 +08:00

51 lines
1.3 KiB
C++

#pragma once
#include <string>
#include <cstdint>
#include "common/Data.h"
#include "common/Exception.h"
namespace eve {
namespace filesystem {
/** @brief Data buffer paired with a filename (used for type identification). */
class FileData : public Data {
public:
/** @brief Allocates a buffer of the given size for the named file. */
FileData(const std::string &filename, uint64_t size);
/** @brief Deep-copies another FileData. */
FileData(const FileData &c);
virtual ~FileData();
/** @brief Implements eve::Data. */
FileData *clone() const;
void * getData() const { return data; }
size_t getSize() const { return size; }
/** @brief Filename, extension (without dot) and base name. */
const std::string &getFilename() const { return filename; }
const std::string &getExtension() const { return extension; }
const std::string &getName() const { return name; }
private:
// The actual data.
uint8_t *data;
// Size of the data.
uint64_t size;
// The filename used for error purposes.
std::string filename;
// The extension (without dot). Used to identify file type.
std::string extension;
// The file name without the extension (and without the dot).
std::string name;
}; // FileData
} // namespace filesystem
} // namespace eve