CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
CeresEngine::DummyStringDatabase Class Reference

A database that doesn't store the string-values. More...

#include <CeresEngine/Foundation/StringID.hpp>

Inheritance diagram for CeresEngine::DummyStringDatabase:
CeresEngine::StringDatabase

Public Member Functions

StringID::Status insert (StringID::Hash, StringView) override
 Inserts a new hash-string-pair with prefix (optional) into the internal database.
 
StringID::Status insertPrefix (StringID::Hash, StringID::Hash, StringView) override
 Inserts a hash-string-pair with given prefix into the internal database.
 
StringView lookup (StringID::Hash) const noexcept override
 Returns the string stored with a given hash.
 
- Public Member Functions inherited from CeresEngine::StringDatabase
 StringDatabase (const StringDatabase &)=delete
 
 StringDatabase (StringDatabase &&)=delete
 
virtual ~StringDatabase ()=default
 

Additional Inherited Members

- Static Public Member Functions inherited from CeresEngine::StringDatabase
static StringDatabasegetDefault () noexcept
 
- Protected Member Functions inherited from CeresEngine::StringDatabase
 StringDatabase ()=default
 

Detailed Description

A database that doesn't store the string-values.

It does not detect collisions or allows retrieving, lookup() returns "StringID database disabled".

Member Function Documentation

◆ insert()

StringID::Status CeresEngine::DummyStringDatabase::insert ( StringID::Hash  ,
StringView   
)
inlineoverridevirtual

Inserts a new hash-string-pair with prefix (optional) into the internal database.

Note
The string must be copied prior to storing, it may not stay valid.
Parameters
hashThe hash of the string.
stringThe string which does not need to be null-terminated.
Returns
The status of the insertion.

Implements CeresEngine::StringDatabase.

◆ insertPrefix()

StringID::Status CeresEngine::DummyStringDatabase::insertPrefix ( StringID::Hash  ,
StringID::Hash  ,
StringView   
)
inlineoverridevirtual

Inserts a hash-string-pair with given prefix into the internal database.

Note
The default implementation performs a lookup of the prefix string and appends it, then it calls insert. Override it if you can do it more efficiently.
Parameters
hashThe hash of the string plus prefix.
prefixThe hash of the prefix-string.
stringThe suffix which does not need to be null-terminated.
Returns
The status of the insertion.

Reimplemented from CeresEngine::StringDatabase.

◆ lookup()

StringView CeresEngine::DummyStringDatabase::lookup ( StringID::Hash  ) const
inlineoverridevirtualnoexcept

Returns the string stored with a given hash.

Note
It is guaranteed that the hash value has been inserted before.
Returns
A null-terminated string belonging to the hash code or an error message if the database does not store anything. The return value must stay valid as long as the database exists.

Implements CeresEngine::StringDatabase.


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