CBMC: dstringt Class Reference

dstringt has one field, an unsigned integer no which is an index into a static table of strings. More...

#include <dstring.h>

Public Member Functions

 dstringt ()
 
 dstringt (const char *s)
 
 dstringt (const std::string &s)
 
 dstringt (const dstringt &)=default
 
 dstringt (dstringt &&other)
 Move constructor.
 
bool empty () const
 
bool starts_with (const char *s) const
 equivalent of as_string().starts_with(s)
 
bool starts_with (const std::string &prefix) const
 equivalent of as_string().starts_with(s)
 
char operator[] (size_t i) const
 
const charc_str () const
 
size_t size () const
 
bool operator< (const dstringt &b) const
 
bool operator== (const dstringt &b) const
 
bool operator!= (const dstringt &b) const
 
bool operator== (const char *b) const
 
bool operator!= (const char *b) const
 
bool operator== (const std::string &b) const
 
bool operator!= (const std::string &b) const
 
bool operator< (const std::string &b) const
 
bool operator> (const std::string &b) const
 
bool operator<= (const std::string &b) const
 
bool operator>= (const std::string &b) const
 
int compare (const dstringt &b) const
 
void clear ()
 
void swap (dstringt &b)
 
dstringtoperator= (const dstringt &b)
 
dstringtoperator= (dstringt &&other)
 Move assignment.
 
std::ostream & operator<< (std::ostream &out) const
 
unsigned get_no () const
 
size_t hash () const
 
std::string::const_iterator begin () const
 
std::string::const_iterator end () const
 

dstringt has one field, an unsigned integer no which is an index into a static table of strings.

This makes it expensive to create a new string(because you have to look through the whole table to see if it is already there, and add it if it isn't) but very cheap to compare strings (just compare the two integers). It also means that when you have lots of copies of the same string you only have to store the whole string once, which saves space.

irep_idt is typedef-ed to dstringt in irep.h.

Note: Marked final to disable inheritance. No virtual destructor, so runtime-polymorphic use would be unsafe.

Definition at line 37 of file dstring.h.

◆ dstringt() [1/6]

dstringt::dstringt ( )
inline

◆ dstringt() [2/6]

◆ dstringt() [3/6]

dstringt::dstringt ( const std::string &  s)
inline

◆ dstringt() [4/6]

◆ dstringt() [5/6]

dstringt::dstringt ( dstringt &&  other)
inline

Move constructor.

There is no need and no point in actually destroying the source object other, this is effectively just a copy constructor.

Definition at line 82 of file dstring.h.

◆ dstringt() [6/6]

dstringt::dstringt ( unsigned  _no)
inlineexplicitprivate

◆ as_string()

const std::string & dstringt::as_string ( ) const
inlineprivate

◆ begin()

std::string::const_iterator dstringt::begin ( ) const
inline

◆ c_str()

const char * dstringt::c_str ( ) const
inline

◆ clear()

void dstringt::clear ( )
inline

◆ compare()

◆ empty()

bool dstringt::empty ( ) const
inline

◆ end()

std::string::const_iterator dstringt::end ( ) const
inline

◆ get_no()

unsigned dstringt::get_no ( ) const
inline

◆ hash()

size_t dstringt::hash ( ) const
inline

◆ make_from_table_index()

◆ operator!=() [1/3]

◆ operator!=() [2/3]

◆ operator!=() [3/3]

bool dstringt::operator!= ( const std::string &  b) const
inline

◆ operator<() [1/2]

◆ operator<() [2/2]

bool dstringt::operator< ( const std::string &  b) const
inline

◆ operator<<()

std::ostream & dstringt::operator<< ( std::ostream &  out) const

◆ operator<=()

bool dstringt::operator<= ( const std::string &  b) const
inline

◆ operator=() [1/2]

◆ operator=() [2/2]

Move assignment.

There is no need and no point in actually destroying the source object other, this is effectively just an assignment.

Definition at line 170 of file dstring.h.

◆ operator==() [1/3]

◆ operator==() [2/3]

◆ operator==() [3/3]

bool dstringt::operator== ( const std::string &  b) const
inline

◆ operator>()

bool dstringt::operator> ( const std::string &  b) const
inline

◆ operator>=()

bool dstringt::operator>= ( const std::string &  b) const
inline

◆ operator[]()

char dstringt::operator[] ( size_t  i) const
inline

◆ size()

size_t dstringt::size ( ) const
inline

◆ starts_with() [1/2]

◆ starts_with() [2/2]

bool dstringt::starts_with ( const std::string &  prefix) const
inline

◆ swap()

◆ no


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