nw::Resource

struct Resource

A nw::Resource consists of a nw::Resref and a nw::ResourceType. Since NWN1/EE doesn’t have any notion of hierarchical organization (paths, etc), it represents a fully-qualified resource identifier.

Public Functions

Resource() noexcept
Resource(const Resref &resref_, ResourceType::type type_) noexcept
Resource(StringView resref_, ResourceType::type type_) noexcept
Resource(const Resource&) = default
Resource(Resource&&) = default
String filename() const

Gets a Resrefs file name with extension.

bool valid() const noexcept

A resource is valid if resref is not empty and resref type is not invalid.

Resource &operator=(const Resource&) = default
Resource &operator=(Resource&&) = default

Public Members

Resref resref
ResourceType::type type

Public Static Functions

static Resource from_filename(StringView)
static Resource from_path(const std::filesystem::path &path, bool preserve_path = false)