Emergency 20 Dokumentation  4.2.0
qsf::NamedIdentifier Class Reference

Class combining strings with their hashes. More...

#include <NamedIdentifier.h>

Public Member Functions

 NamedIdentifier ()
 Default constructor. More...
 
 NamedIdentifier (const std::string &name)
 Constructor. More...
 
 NamedIdentifier (const char *name)
 Constructor. More...
 
 ~NamedIdentifier ()
 Destructor. More...
 
bool empty () const
 Check if named identifier is empty. More...
 
const std::string & getName () const
 Return the name string. More...
 
uint32 getHash () const
 Return the generated hash value. More...
 
 operator const std::string & () const
 Return the name string. More...
 
 operator uint32 () const
 Return the generated hash value. More...
 
 operator StringHash () const
 Return the identifier as a "qsf::StringHash". More...
 
bool operator== (const NamedIdentifier &other) const
 Compare two named identifiers. More...
 
bool operator== (uint32 other) const
 Compare named identifier with uint32. More...
 
bool operator== (const std::string &other) const
 Compare named identifier with string. More...
 
void reset ()
 Reset to an empty string with uninitialized hash. More...
 

Detailed Description

Class combining strings with their hashes.

Remarks
In the special case of uninitialized named identifiers (e.g. by default constructor), the hash does not fit to the empty string, but is "qsf::getUninitialized<uint32>()".

Constructor & Destructor Documentation

qsf::NamedIdentifier::NamedIdentifier ( )
inline

Default constructor.

qsf::NamedIdentifier::NamedIdentifier ( const std::string &  name)
inline

Constructor.

Parameters
[in]nameString to create the named identifier from
qsf::NamedIdentifier::NamedIdentifier ( const char *  name)
inline

Constructor.

Parameters
[in]nameString to create the named identifier from
qsf::NamedIdentifier::~NamedIdentifier ( )
inline

Destructor.

Note
  • Not virtual by intent

Member Function Documentation

bool qsf::NamedIdentifier::empty ( ) const
inline

Check if named identifier is empty.

Returns
"true" if empty or uninitialized, "false" if not
uint32 qsf::NamedIdentifier::getHash ( ) const
inline

Return the generated hash value.

Returns
The generated FNV-1a hash value
const std::string & qsf::NamedIdentifier::getName ( ) const
inline

Return the name string.

Returns
The identifier name
qsf::NamedIdentifier::operator const std::string & ( ) const
inline

Return the name string.

Returns
The identifier name
qsf::NamedIdentifier::operator StringHash ( ) const
inline

Return the identifier as a "qsf::StringHash".

Returns
The string hash instance, containing only the hash
qsf::NamedIdentifier::operator uint32 ( ) const
inline

Return the generated hash value.

Returns
The generated FNV-1a hash value
bool qsf::NamedIdentifier::operator== ( const NamedIdentifier other) const
inline

Compare two named identifiers.

Parameters
[in]otherNamed identifier to compare with
Returns
"true" if they are alike
bool qsf::NamedIdentifier::operator== ( uint32  other) const
inline

Compare named identifier with uint32.

Parameters
[in]otheruint32 to compare with
Returns
"true" if they are alike
bool qsf::NamedIdentifier::operator== ( const std::string &  other) const
inline

Compare named identifier with string.

Parameters
[in]otherString to compare with
Returns
"true" if they are alike
void qsf::NamedIdentifier::reset ( )
inline

Reset to an empty string with uninitialized hash.


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