libabigail
Public Member Functions | Friends | List of all members
interned_string Class Reference

The abstraction of an interned string. More...

#include <abg-interned-str.h>

Public Member Functions

 interned_string ()
 Default constructor. More...
 
 interned_string (const interned_string &o)
 Copy constructor. More...
 
void clear ()
 Clear the string. More...
 
bool empty () const
 Test if the current instance of interned_string is empty. More...
 
 operator string () const
 Conversion operator to string. More...
 
bool operator!= (const interned_string &o) const
 Inequality operator. More...
 
bool operator!= (const string &o) const
 Inequality operator. More...
 
bool operator< (const interned_string &o) const
 "Less than" operator. More...
 
interned_stringoperator= (const interned_string &o)
 Assignment operator. More...
 
bool operator== (const interned_string &o) const
 Compare the current instance of interned_string against another instance of interned_string. More...
 
bool operator== (const string &o) const
 Compare the current instance of interned_string against an instance of std::string. More...
 
const string * raw () const
 Return the underlying pointer to std::string that this interned_string wraps. More...
 

Friends

class interned_string_pool
 

Detailed Description

The abstraction of an interned string.

It's a wrapper around a pointer to a std::string, along with a set of method that helps make this string integrate with std::string seamlessly. For instance, the type provides equality operators that help compare it against std::string.

Note that this interned_string type is design to have the same size as a pointer to a string.

Definition at line 42 of file abg-interned-str.h.

Constructor & Destructor Documentation

◆ interned_string() [1/2]

interned_string ( )
inline

Default constructor.

Constructs an empty pointer to string.

Definition at line 59 of file abg-interned-str.h.

◆ interned_string() [2/2]

interned_string ( const interned_string o)
inline

Copy constructor.

Parameters
othe other instance to copy from.

Definition at line 66 of file abg-interned-str.h.

Member Function Documentation

◆ clear()

void clear ( )
inline

Clear the string.

Definition at line 81 of file abg-interned-str.h.

◆ empty()

bool empty ( ) const
inline

Test if the current instance of interned_string is empty.

Returns
true iff the currentisntance of interned_string is empty.

Definition at line 89 of file abg-interned-str.h.

◆ operator string()

operator string ( ) const
inline

Conversion operator to string.

Returns
the underlying string this instance refers too.

Definition at line 174 of file abg-interned-str.h.

◆ operator!=() [1/2]

bool operator!= ( const interned_string o) const
inline

Inequality operator.

Parameters
othe other interned_string to compare the current instance against.
Returns
true iff the current instance is different from the o.

Definition at line 123 of file abg-interned-str.h.

◆ operator!=() [2/2]

bool operator!= ( const string &  o) const
inline

Inequality operator.

Takes the current instance of interned_string and an instance of std::string.

Parameters
othe instance of std::string to compare the current instance of interned_string against.
Returns
true if the current instance of interned_string is different from o.

Definition at line 154 of file abg-interned-str.h.

◆ operator<()

bool operator< ( const interned_string o) const
inline

"Less than" operator.

Lexicographically compares the current instance of interned_string against another instance.

Parameters
othe other instance of interned_string to compare against.
Returns
true iff the current instance of interned_string is lexicographycally less than the string o.

Definition at line 167 of file abg-interned-str.h.

◆ operator=()

interned_string& operator= ( const interned_string o)
inline

Assignment operator.

Parameters
othe other instance to assign to the current one.

Definition at line 73 of file abg-interned-str.h.

◆ operator==() [1/2]

bool operator== ( const interned_string o) const
inline

Compare the current instance of interned_string against another instance of interned_string.

Note that this comparison is done in O(1), because it compares the pointer values of the two underlying pointers to std::string held by each instances of interned_string.

Parameters
othe other interned_string to compare against.
Returns
true iff the current instance equals o.

Definition at line 112 of file abg-interned-str.h.

◆ operator==() [2/2]

bool operator== ( const string &  o) const
inline

Compare the current instance of interned_string against an instance of std::string.

Note that this comparison is done in O(N), N being the size (in number of characters) of the strings being compared.

Parameters
othe instance of std::string to compare against.
Returns
true iff the current instance equals o.

Definition at line 136 of file abg-interned-str.h.

◆ raw()

const string* raw ( ) const
inline

Return the underlying pointer to std::string that this interned_string wraps.

Returns
a pointer to the underlying std::string, or 0 if this interned_string is empty.

Definition at line 98 of file abg-interned-str.h.


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