Nebula
Loading...
Searching...
No Matches
Util::StringAtom Class Reference

#include <stringatom.h>

Detailed Description

A StringAtom.

See StringAtomTableBase for details about the StringAtom system in N3.

TODO: WARNING/STATISTICS for creation from char* or String and converting back to String!

Public Member Functions

 StringAtom ()
 default constructor
 
 StringAtom (const StringAtom &rhs)
 copy constructor
 
 StringAtom (char *ptr)
 construct from char ptr
 
 StringAtom (const char *ptr)
 construct from char ptr
 
 StringAtom (const char *ptr, size_t len)
 construct from char ptr
 
 StringAtom (unsigned char *ptr)
 construct from char ptr
 
 StringAtom (const unsigned char *ptr)
 construct from char ptr
 
 StringAtom (const String &str)
 construct from string object
 
 StringAtom (std::nullptr_t)
 constructor from nullptr
 
void operator= (const StringAtom &rhs)
 assignment
 
void operator= (const char *ptr)
 assignment from char ptr
 
void operator= (const String &str)
 assignment from string object
 
bool operator== (const StringAtom &rhs) const
 equality operator
 
bool operator== (std::nullptr_t) const
 equality operator for nullptr
 
bool operator!= (const StringAtom &rhs) const
 inequality operator
 
bool operator> (const StringAtom &rhs) const
 greater-then operator
 
bool operator< (const StringAtom &rhs) const
 less-then operator
 
bool operator>= (const StringAtom &rhs) const
 greater-or-equal operator
 
bool operator<= (const StringAtom &rhs) const
 less-or-equal operator
 
bool operator== (const char *rhs) const
 equality with char* (SLOW!)
 
bool operator!= (const char *rhs) const
 inequality with char* (SLOW!)
 
bool operator== (const String &rhs) const
 equality with string object (SLOW!)
 
bool operator!= (const String &rhs) const
 inequality with string object (SLOW!)
 
void Clear ()
 clear content (becomes invalid)
 
bool IsValid () const
 return true if valid (contains a non-empty string)
 
const char * Value () const
 get contained string as char ptr (fast)
 
String AsString () const
 get containted string as string object (SLOW!!!)
 
uint32_t HashCode () const
 calculate hash code for Util::HashTable (basically just the adress)
 
uint32_t StringHashCode () const
 calculate persistent hash code (based on string content)
 
const char * c_str () const
 helpers to interface with libraries that expect std::string like apis
 
size_t length () const
 
bool empty () const
 

Private Member Functions

void Setup (const char *str)
 setup the string atom from a string pointer
 

Private Attributes

const char * content
 

Constructor & Destructor Documentation

◆ StringAtom() [1/9]

__forceinline Util::StringAtom::StringAtom ( )

default constructor

◆ StringAtom() [2/9]

__forceinline Util::StringAtom::StringAtom ( const StringAtom & rhs)

copy constructor

◆ StringAtom() [3/9]

Util::StringAtom::StringAtom ( char * ptr)
inline

construct from char ptr

◆ StringAtom() [4/9]

Util::StringAtom::StringAtom ( const char * ptr)
inline

construct from char ptr

◆ StringAtom() [5/9]

Util::StringAtom::StringAtom ( const char * ptr,
size_t len )
inline

construct from char ptr

◆ StringAtom() [6/9]

Util::StringAtom::StringAtom ( unsigned char * ptr)
inline

construct from char ptr

◆ StringAtom() [7/9]

Util::StringAtom::StringAtom ( const unsigned char * ptr)
inline

construct from char ptr

◆ StringAtom() [8/9]

Util::StringAtom::StringAtom ( const String & str)
inline

construct from string object

◆ StringAtom() [9/9]

Util::StringAtom::StringAtom ( std::nullptr_t )
inline

constructor from nullptr

Member Function Documentation

◆ AsString()

String Util::StringAtom::AsString ( ) const
inline

get containted string as string object (SLOW!!!)

SLOW!!!

◆ c_str()

__forceinline const char * Util::StringAtom::c_str ( ) const

helpers to interface with libraries that expect std::string like apis

◆ Clear()

__forceinline void Util::StringAtom::Clear ( )

clear content (becomes invalid)

◆ empty()

__forceinline bool Util::StringAtom::empty ( ) const

◆ HashCode()

uint32_t Util::StringAtom::HashCode ( ) const
inline

calculate hash code for Util::HashTable (basically just the adress)

◆ IsValid()

__forceinline bool Util::StringAtom::IsValid ( ) const

return true if valid (contains a non-empty string)

◆ length()

__forceinline size_t Util::StringAtom::length ( ) const

◆ operator!=() [1/3]

bool Util::StringAtom::operator!= ( const char * rhs) const

inequality with char* (SLOW!)

Compare with raw string.

Careful, slow!

◆ operator!=() [2/3]

bool Util::StringAtom::operator!= ( const String & rhs) const
inline

inequality with string object (SLOW!)

Compare with String object.

Careful, slow!

◆ operator!=() [3/3]

__forceinline bool Util::StringAtom::operator!= ( const StringAtom & rhs) const

inequality operator

◆ operator<()

__forceinline bool Util::StringAtom::operator< ( const StringAtom & rhs) const

less-then operator

◆ operator<=()

__forceinline bool Util::StringAtom::operator<= ( const StringAtom & rhs) const

less-or-equal operator

◆ operator=() [1/3]

void Util::StringAtom::operator= ( const char * ptr)
inline

assignment from char ptr

◆ operator=() [2/3]

void Util::StringAtom::operator= ( const String & str)
inline

assignment from string object

◆ operator=() [3/3]

__forceinline void Util::StringAtom::operator= ( const StringAtom & rhs)

assignment

◆ operator==() [1/4]

bool Util::StringAtom::operator== ( const char * rhs) const

equality with char* (SLOW!)

Compare with raw string.

Careful, slow!

◆ operator==() [2/4]

bool Util::StringAtom::operator== ( const String & rhs) const
inline

equality with string object (SLOW!)

Compare with String object.

Careful, slow!

◆ operator==() [3/4]

__forceinline bool Util::StringAtom::operator== ( const StringAtom & rhs) const

equality operator

◆ operator==() [4/4]

bool Util::StringAtom::operator== ( std::nullptr_t ) const

equality operator for nullptr

◆ operator>()

__forceinline bool Util::StringAtom::operator> ( const StringAtom & rhs) const

greater-then operator

◆ operator>=()

__forceinline bool Util::StringAtom::operator>= ( const StringAtom & rhs) const

greater-or-equal operator

◆ Setup()

void Util::StringAtom::Setup ( const char * str)
private

setup the string atom from a string pointer

◆ StringHashCode()

uint32_t Util::StringAtom::StringHashCode ( ) const

calculate persistent hash code (based on string content)

◆ Value()

__forceinline const char * Util::StringAtom::Value ( ) const

get contained string as char ptr (fast)

Member Data Documentation

◆ content

const char* Util::StringAtom::content
private

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