Class endstone::NamespacedKey¶
ClassList > endstone > NamespacedKey
Represents a string-based key which consists of two components - a namespace and a key. More...
#include <endstone/namespaced_key.h>
Public Static Attributes¶
Type | Name |
---|---|
constexpr std::string_view | MINECRAFT = "minecraft" |
Public Functions¶
Type | Name |
---|---|
const std::string & | getKey () noexcept const |
const std::string & | getNamespace () noexcept const |
bool | operator!= (const NamespacedKey & other) noexcept const |
bool | operator== (const NamespacedKey & other) noexcept const |
std::string | toString () noexcept const |
Public Static Functions¶
Type | Name |
---|---|
Result< NamespacedKey > | create (const Plugin & plugin, std::string_view key) Create a key in the plugin's namespace. |
Result< NamespacedKey > | fromString (std::string_view input, const Plugin * plugin=nullptr) |
Detailed Description¶
Namespaces may only contain lowercase alphanumeric characters, periods, underscores, and hyphens.
Keys may only contain lowercase alphanumeric characters, periods, underscores, hyphens, and forward slashes.
Public Static Attributes Documentation¶
variable MINECRAFT¶
The namespace representing all inbuilt keys.
Public Functions Documentation¶
function getKey¶
function getNamespace¶
function operator!=¶
function operator==¶
function toString¶
Public Static Functions Documentation¶
function create¶
Create a key in the plugin's namespace.
static inline Result< NamespacedKey > endstone::NamespacedKey::create (
const Plugin & plugin,
std::string_view key
)
Parameters:
plugin
the plugin to use for the namespacekey
the key to create
function fromString¶
static inline Result< NamespacedKey > endstone::NamespacedKey::fromString (
std::string_view input,
const Plugin * plugin=nullptr
)
Parse a NamespacedKey from a string, with an optional default namespace.
Examples: * fromString("foo", plugin) -> "plugin:foo" * fromString("foo:bar", nullptr) -> "foo:bar" * fromString(":foo", nullptr) -> "minecraft:foo" * fromString("foo", nullptr) -> "minecraft:foo" * fromString("Foo", plugin) -> std::nullopt
Parameters:
input
the string to parseplugin
optional default namespace; if nullptr, uses the minecraft namespace
Returns:
optional containing the parsed key, or std::nullopt if invalid
The documentation for this class was generated from the following file include/endstone/namespaced_key.h