libabigail
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | 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 (const interned_string &o)
 Copy constructor.
 
void clear ()
 Clear the string.
 
bool empty () const
 Test if the current instance of interned_string is empty.
 
 operator string () const
 Conversion operator to string.
 
bool operator!= (const interned_string &o) const
 Inequality operator.
 
bool operator!= (const string &o) const
 Inequality operator.
 
bool operator< (const interned_string &o) const
 "Less than" operator.
 
interned_string & operator= (const interned_string &o)
 Assignment operator.
 
bool operator== (const interned_string &o) const
 Compare the current instance of interned_string against another instance of interned_string.
 
bool operator== (const string &o) const
 Compare the current instance of interned_string against an instance of std::string.
 
const string * raw () const
 Return the underlying pointer to std::string that this interned_string wraps.
 

Public Attributes

std::unique_ptr< priv > priv_
 

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]

Definition at line 190 of file abg-ir.cc.

◆ ~interned_string()

Definition at line 195 of file abg-ir.cc.

◆ interned_string() [2/2]

Copy constructor.

Parameters
othe other instance to copy from.

Definition at line 202 of file abg-ir.cc.

Member Function Documentation

◆ clear()

void clear ( )

Clear the string.

Definition at line 221 of file abg-ir.cc.

◆ empty()

bool empty ( ) const

Test if the current instance of interned_string is empty.

Returns
true iff the currentisntance of interned_string is empty.

Definition at line 232 of file abg-ir.cc.

◆ operator string()

operator string ( ) const

Conversion operator to string.

Returns
the underlying string this instance refers too.

Definition at line 324 of file abg-ir.cc.

◆ operator!=() [1/2]

bool operator!= ( const interned_string &  o) const

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 273 of file abg-ir.cc.

◆ operator!=() [2/2]

bool operator!= ( const string &  o) const

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 304 of file abg-ir.cc.

◆ operator<()

bool operator< ( const interned_string &  o) const

"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 317 of file abg-ir.cc.

◆ operator=()

interned_string & operator= ( const interned_string &  o)

Assignment operator.

Parameters
othe other instance to assign to the current one.

Definition at line 211 of file abg-ir.cc.

◆ operator==() [1/2]

bool operator== ( const interned_string &  o) const

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 260 of file abg-ir.cc.

◆ operator==() [2/2]

bool operator== ( const string &  o) const

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 286 of file abg-ir.cc.

◆ raw()

const string * raw ( ) const

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 244 of file abg-ir.cc.

Friends And Related Symbol Documentation

◆ interned_string_pool

friend class interned_string_pool
friend

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

Member Data Documentation

◆ priv_

std::unique_ptr<priv> priv_

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


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