cprover
dstringt Class Referencefinal

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)
 
bool empty () const
 
char operator[] (size_t i) const
 
const char * c_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)
 
std::ostream & operator<< (std::ostream &out) const
 
unsigned get_no () const
 
size_t hash () const
 

Static Public Member Functions

static dstringt make_from_table_index (unsigned no)
 

Private Member Functions

 dstringt (unsigned _no)
 
const std::string & as_string () const
 

Private Attributes

unsigned no
 

Detailed Description

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 and irep_namet are typedef-ed to dstringt in irep.h unless USE_STD_STRING is set.

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

Definition at line 33 of file dstring.h.

Constructor & Destructor Documentation

◆ dstringt() [1/4]

dstringt::dstringt ( )
inline

Definition at line 40 of file dstring.h.

Referenced by make_from_table_index().

◆ dstringt() [2/4]

dstringt::dstringt ( const char *  s)
inline

Definition at line 61 of file dstring.h.

◆ dstringt() [3/4]

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

Definition at line 67 of file dstring.h.

◆ dstringt() [4/4]

dstringt::dstringt ( unsigned  _no)
inlineexplicitprivate

Definition at line 156 of file dstring.h.

Member Function Documentation

◆ as_string()

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

◆ c_str()

◆ clear()

void dstringt::clear ( void  )
inline

Definition at line 127 of file dstring.h.

References no.

Referenced by c_storage_spect::clear(), mm_parsert::clear(), goto_tracet::clear(), and Parser::rFunctionBody().

◆ compare()

int dstringt::compare ( const dstringt b) const
inline

◆ empty()

bool dstringt::empty ( ) const
inline

Definition at line 73 of file dstring.h.

References no.

Referenced by ansi_c_parsert::add_declarator(), string_abstractiont::add_dummy_symbol_and_value(), goto_program2codet::add_local_types(), c_typecheck_baset::apply_asm_label(), source_locationt::as_string(), ansi_c_declaratort::build(), build_function_environment(), string_abstractiont::build_new_symbol(), build_ssa_identifier_rec(), custom_bitvector_analysist::check(), goto_program2codet::cleanup_code(), goto_program2codet::cleanup_code_block(), goto_program2codet::cleanup_expr(), dump_ct::cleanup_expr(), dump_ct::cleanup_type(), dump_ct::collect_typedefs_rec(), java_bytecode_convert_classt::convert(), convert(), java_bytecode_convert_methodt::convert(), expr2ct::convert_code(), expr2ct::convert_code_fence(), dump_ct::convert_compound(), dump_ct::convert_compound_declaration(), dump_ct::convert_global_variable(), expr2ct::convert_member(), java_bytecode_convert_methodt::convert_multianewarray(), java_bytecode_convert_methodt::convert_new(), cpp_typecheckt::convert_parameter(), convert_properties_json(), expr2ct::convert_rec(), expr2cppt::convert_rec(), boolbvt::convert_symbol(), expr2ct::convert_with(), cover_basic_blockst::cover_basic_blockst(), cpp_exception_list_rec(), cpp_type2name(), stub_global_initializer_factoryt::create_stub_global_initializer_symbols(), create_stub_global_symbols(), goto_symext::dereference_rec(), symbolt::display_name(), value_set_fit::do_function_call(), parameter_assignmentst::do_function_calls(), linkingt::duplicate_code_symbol(), ci_lazy_methodst::entry_point_methods(), filter_out(), find_symbols(), dump_ct::gather_global_typedefs(), java_object_factoryt::gen_nondet_struct_init(), get_clinit_wrapper_body(), floatbv_typet::get_f(), get_failed_symbol(), remove_virtual_functionst::get_functions(), get_inherited_component(), fixedbv_typet::get_integer_bits(), java_bytecode_convert_methodt::get_lambda_method_symbol(), get_main_symbol(), get_mode_from_identifier(), get_nil_irep(), stub_global_initializer_factoryt::get_stub_initializer_body(), get_thread_safe_clinit_wrapper_body(), value_sett::get_value_set_rec(), ci_lazy_methodst::get_virtual_method_targets(), goto_inlinet::goto_inline(), goto_program_coverage_recordt::goto_program_coverage_recordt(), ci_lazy_methodst::handle_virtual_methods_with_no_callees(), goto_program_dereferencet::has_failed_symbol(), expr2ct::id_shorthand(), cpp_typecheckt::instantiate_template(), taint_analysist::instrument(), java_bytecode_instrumentt::instrument_code(), irept::is_comment(), java_build_arguments(), java_enum_static_init_unwind_handler(), json(), ui_message_handlert::json_ui_msg(), list_functions(), Parser::make_subtype(), jsil_typecheckt::make_type_compatible(), cpp_declaratort::merge_type(), move_label_ifthenelse(), cpp_scopest::new_scope(), goto_convertt::new_tmp_symbol(), custom_bitvector_domaint::object2id(), syntactic_difft::operator()(), java_syntactic_difft::operator()(), graphml_witnesst::operator()(), dump_ct::operator()(), class_hierarchyt::operator()(), resolve_inherited_componentt::operator()(), goto_symex_statet::level0t::operator()(), goto_symex_statet::level1t::operator()(), internal_goals_filtert::operator()(), cpp_typecheckt::operator_is_overloaded(), c_storage_spect::operator|=(), Parser::optIntegralTypeOrClassSpec(), java_bytecode_parse_treet::classt::output(), change_impactt::output_instruction(), goto_inlinet::parameter_assignments(), goto_symext::parameter_assignments(), goto_inlinet::parameter_destruction(), java_bytecode_languaget::parse(), class_hierarchy_grapht::populate(), message_handlert::print(), gcc_message_handlert::print(), cpp_typecheckt::put_compound_into_scope(), cpp_scopest::put_into_scope(), cpp_convert_typet::read_function_type(), ansi_c_convert_typet::read_rec(), remove_function_pointerst::remove_function_pointer(), remove_virtual_functionst::remove_virtual_function(), goto_symex_statet::rename(), replace_location(), cpp_typecheck_resolvet::resolve_scope(), java_bytecode_parsert::rmethod_attribute(), Parser::rOperatorName(), Parser::rTypeName(), Parser::set_location(), goto_symex_statet::set_ssa_indices(), symbolt::show(), simplify_exprt::simplify_rec(), sort_and_join(), goto_symext::symex_assign_symbol(), symex_bmct::symex_step(), to_reference_type(), custom_bitvector_domaint::transform(), escape_domaint::transform(), rd_range_domaint::transform_end_function(), rd_range_domaint::transform_function_call(), type2name(), c_typecheck_baset::typecheck_array_type(), c_typecheck_baset::typecheck_c_enum_type(), c_typecheck_baset::typecheck_code_type(), cpp_typecheckt::typecheck_compound_bases(), cpp_typecheckt::typecheck_compound_body(), cpp_typecheckt::typecheck_compound_declarator(), jsil_typecheckt::typecheck_expr_main(), c_typecheck_baset::typecheck_expr_member(), c_typecheck_baset::typecheck_expr_symbol(), cpp_typecheckt::typecheck_expr_this(), jsil_typecheckt::typecheck_function_call(), cpp_typecheckt::typecheck_member_function(), c_typecheck_baset::typecheck_type(), cpp_typecheckt::typecheck_type(), goto_unwindt::unwind(), jsil_typecheckt::update_expr_type(), validate_type(), value_sets_to_xml(), java_bytecode_convert_methodt::variable(), xml(), and ui_message_handlert::xml_ui_msg().

◆ get_no()

unsigned dstringt::get_no ( ) const
inline

Definition at line 142 of file dstring.h.

References no.

Referenced by as_string().

◆ hash()

size_t dstringt::hash ( ) const
inline

Definition at line 147 of file dstring.h.

References no.

Referenced by hash_string(), dstring_hash::operator()(), and std::hash< dstringt >::operator()().

◆ make_from_table_index()

static dstringt dstringt::make_from_table_index ( unsigned  no)
inlinestatic

Definition at line 48 of file dstring.h.

References dstringt(), and no.

◆ operator!=() [1/3]

bool dstringt::operator!= ( const dstringt b) const
inline

Definition at line 103 of file dstring.h.

References no.

◆ operator!=() [2/3]

bool dstringt::operator!= ( const char *  b) const
inline

Definition at line 109 of file dstring.h.

References as_string().

◆ operator!=() [3/3]

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

Definition at line 112 of file dstring.h.

References as_string().

◆ operator<() [1/2]

bool dstringt::operator< ( const dstringt b) const
inline

Definition at line 96 of file dstring.h.

References no.

◆ operator<() [2/2]

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

Definition at line 113 of file dstring.h.

References as_string().

◆ operator<<()

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

Definition at line 16 of file dstring.cpp.

References as_string().

◆ operator<=()

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

Definition at line 115 of file dstring.h.

References as_string().

◆ operator=()

dstringt& dstringt::operator= ( const dstringt b)
inline

Definition at line 133 of file dstring.h.

References no.

◆ operator==() [1/3]

bool dstringt::operator== ( const dstringt b) const
inline

Definition at line 100 of file dstring.h.

References no.

◆ operator==() [2/3]

bool dstringt::operator== ( const char *  b) const
inline

Definition at line 108 of file dstring.h.

References as_string().

◆ operator==() [3/3]

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

Definition at line 111 of file dstring.h.

References as_string().

◆ operator>()

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

Definition at line 114 of file dstring.h.

References as_string().

◆ operator>=()

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

Definition at line 116 of file dstring.h.

References as_string().

◆ operator[]()

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

Definition at line 78 of file dstring.h.

References as_string().

◆ size()

◆ swap()

void dstringt::swap ( dstringt b)
inline

Member Data Documentation

◆ no

unsigned dstringt::no
private

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