Porytiles
Loading...
Searching...
No Matches
porytiles2::ArtifactKey Class Reference

A type-safe wrapper for artifact keys. More...

#include <artifact_key.hpp>

Public Member Functions

 ArtifactKey (std::string key)
 Constructs an ArtifactKey from a string value.
 
const std::string & key () const
 Gets the underlying string value.
 
bool operator== (const ArtifactKey &other) const =default
 Equality comparison operator.
 
auto operator<=> (const ArtifactKey &other) const =default
 Three-way comparison operator for ordered containers.
 

Detailed Description

A type-safe wrapper for artifact keys.

The ArtifactKey class provides a strong type wrapper around std::string to represent artifact keys in the compilation system. This improves type safety and makes the concept of artifact keys more explicit in the codebase.

The class supports usage in all standard containers, including std::set, std::map, and std::unordered_map, through appropriate comparison operators and hash specialization.

Definition at line 19 of file artifact_key.hpp.

Constructor & Destructor Documentation

◆ ArtifactKey()

porytiles2::ArtifactKey::ArtifactKey ( std::string  key)
inlineexplicit

Constructs an ArtifactKey from a string value.

Parameters
keyThe string value to wrap

Definition at line 26 of file artifact_key.hpp.

Member Function Documentation

◆ key()

const std::string & porytiles2::ArtifactKey::key ( ) const
inline

Gets the underlying string value.

Returns
The wrapped string value

Definition at line 33 of file artifact_key.hpp.

◆ operator<=>()

auto porytiles2::ArtifactKey::operator<=> ( const ArtifactKey other) const
default

Three-way comparison operator for ordered containers.

Parameters
otherThe other ArtifactKey to compare with
Returns
The comparison result (strong ordering)

◆ operator==()

bool porytiles2::ArtifactKey::operator== ( const ArtifactKey other) const
default

Equality comparison operator.

Parameters
otherThe other ArtifactKey to compare with
Returns
True if the keys are equal, false otherwise

The documentation for this class was generated from the following file: