Siena Fast Forwarding Documentation (v. 1.13.0)
Classes | Public Member Functions | Public Attributes | List of all members
siena::string_t Class Reference

string type. More...

#include <types.h>

Classes

class  iterator
 iterator type for string_t. More...
 

Public Member Functions

 string_t ()
 constructs an empty string.
 
 string_t (const char *b, const char *e)
 constructs a string with the given begin and end pointers.
 
 string_t (const char *s)
 constructs a string with the given char * interpreted as a C-style string.
 
 string_t (const char *s, int len)
 constructs a string with the given pointer and length.
 
 string_t (const string_t &x)
 constructs a copy of a given string. More...
 
string_toperator= (const string_t x)
 assigns this string to the given string. More...
 
string_tassign (const char *b, const char *e)
 assigns this string to the given sequence. More...
 
unsigned int length () const
 returns the size of the string.
 
const char & operator[] (int x) const
 accessor method for strings.
 
bool operator== (const string_t &x) const
 equality test for strings.
 
bool operator< (const string_t &x) const
 lexicographical order relation. More...
 
bool operator> (const string_t &x) const
 lexicographical order relation. More...
 
bool operator!= (const string_t &x) const
 not equals
 
bool has_prefix (const string_t &x) const
 prefix
 
bool has_suffix (const string_t &x) const
 suffix
 
bool has_substring (const string_t &x) const
 substring
 

Public Attributes

const char * begin
 pointer to the first character in the string.
 
const char * end
 pointer to the first character past-the-end of the string.
 

Detailed Description

string type.

a string is contiguous sequence of 8-bit characters. The sequence is defined by a pair of pointers. The first pointer begin points to the first character; the second pointer end points to the first charcter past the end of the sequence. A string may contain any character. A string may also be empty (when begin == end.)

string_ts are immutable strings, in the sense that string_t does not provide methods to modify the value of a string_t.

Examples:
simple_types.cc.

Constructor & Destructor Documentation

siena::string_t::string_t ( const string_t x)
inline

constructs a copy of a given string.

The copy is simply a copy of the reference. In other words, this method does not allocate memory for the string value. Instead, the new string will point to the same sequence of the given string.

Member Function Documentation

string_t& siena::string_t::assign ( const char *  b,
const char *  e 
)
inline

assigns this string to the given sequence.

This method does not allocate memory.

References begin, and end.

bool siena::string_t::operator< ( const string_t x) const
inline

lexicographical order relation.

returns true iff this string lexicographically precedes the given string.

References begin, and end.

string_t& siena::string_t::operator= ( const string_t  x)
inline

assigns this string to the given string.

This method does not allocate memory. Instead, this string will point to the same memory sequence pointed by the given string.

References begin, and end.

bool siena::string_t::operator> ( const string_t x) const
inline

lexicographical order relation.

returns true iff this string lexicographically follows the given string.