nw::Erf

struct Erf : public nw::Container

Public Functions

Erf() = default
explicit Erf(const std::filesystem::path &path)
Erf(const Erf&) = delete
Erf(Erf &&other) = default
virtual ~Erf() = default
bool add(Resource res, const ByteArray &bytes)

Adds resources from array of bytes.

bool add(const std::filesystem::path &path)

Adds resources from path.

size_t erase(const Resource &res)

Removes resource.

bool merge(const Container *container)

Merges the contents of another container.

bool reload()

Reloads Erf

Note

Erf::working_directory() will not change

bool save() const

Saves Erf to Erf::path()

Note

It’s probably best to call Erf::reload after save.

bool save_as(const std::filesystem::path &path) const

Saves Erf to different path

Note

Current Erf unmodified, to load Erf at new path a new Erf must be constructed.

virtual Vector<ResourceDescriptor> all() const override

Get all resources.

virtual bool contains(Resource res) const override

Get if container contains resource.

virtual ResourceData demand(Resource res) const override

Reads resource data, empty ResourceData if no match.

virtual int extract(const std::regex &pattern, const std::filesystem::path &output) const override

Extract elements from a container by regex.

inline virtual const String &name() const override

Equivalent to basename path()

inline virtual const String &path() const override

Path to container, for basic containers, should be canonical.

virtual size_t size() const override

Determines the size, if applicable, of the container.

virtual ResourceDescriptor stat(const Resource &res) const override

Get some general data about a resource.

inline virtual bool valid() const noexcept override

Return true if loaded, false if not.

virtual void visit(std::function<void(const Resource&)> callback, std::initializer_list<ResourceType::type> types = {}) const noexcept override

Visits all resources in a container.

Erf &operator=(const Erf&) = delete
Erf &operator=(Erf&&) = default
virtual int extract_by_glob(StringView glob, const std::filesystem::path &output) const

Extract elements from a container by glob pattern.

const std::filesystem::path &working_directory() const

Get container working directory.

Public Members

ErfType type = ErfType::erf

Erf type.

ErfVersion version = ErfVersion::v1_0

Version.

LocString description

Description.