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

binary string type. More...

#include <attributes.h>

Public Member Functions

 String ()
 constructs an empty string.
 
 String (const char *b, const char *e)
 constructs a string with the given begin and end pointers.
 
 String (const char *s)
 constructs a string with the given char * interpreted as a C-style string.
 
 String (const char *s, int len)
 constructs a string with the given pointer and length.
 
 String (const String &x)
 constructs a copy of a given string. More...
 
Stringoperator= (const String x)
 assigns this string to the given string. More...
 
Stringassign (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 &x) const
 equality test for strings.
 
bool operator< (const String &x) const
 lexicographical order relation. More...
 
bool operator> (const String &x) const
 lexicographical order relation. More...
 
bool operator!= (const String &x) const
 not equals
 
bool has_prefix (const String &x) const
 prefix
 
bool has_suffix (const String &x) const
 suffix
 
bool has_substring (const String &x) const
 substring
 
std::string & to_string (std::string &s) const
 assigns this string value to a standard string.
 
std::string to_string () const
 returns this string value as a standard string value.
 

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

binary string type.

A reference to a contiguous sequence of bytes (8-bit characters). This is a very simple string representation. The sequence is external to the String object and is referred to 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 objects are immutable for the purpose of the forwarding module, in the sense that the String class does not provide methods to modify the value of a String.

Examples:
message_iteration.cc, simple_attributes_types.cc, and simple_attributes_types.h.

Constructor & Destructor Documentation

siena::String::String ( const String 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& siena::String::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::operator< ( const String x) const

lexicographical order relation.

returns true iff this string lexicographically precedes the given string.

String& siena::String::operator= ( const String  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::operator> ( const String x) const
inline

lexicographical order relation.

returns true iff this string lexicographically follows the given string.