BSDL Device Tree Compiler
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator
Classes | Public Member Functions | Static Public Member Functions | List of all members
dtc::string Class Reference

Public Member Functions

 string (const char *s, int l)
 
 string (const char *s)
 
 string ()
 
 string (input_buffer &s)
 
bool operator== (const string &other) const
 
bool operator== (const char *other) const
 
template<typename T >
bool operator!= (T other)
 
bool operator< (const string &other) const
 
bool empty () const
 
size_t size ()
 
void push_to_buffer (byte_buffer &buffer, bool escapes=false)
 
void print (FILE *file)
 
void dump ()
 

Static Public Member Functions

static string parse_node_name (input_buffer &s)
 
static string parse_property_name (input_buffer &s)
 
static string parse_node_or_property_name (input_buffer &s, bool &is_property)
 

Detailed Description

String, referring to a place in the input file. We don't bother copying strings until we write them to the final output. These strings should be two words long: a start and a length. They are intended to be cheap to copy and store in collections. Copying the string object does not copy the underlying storage.

Strings are not nul-terminated.

Constructor & Destructor Documentation

dtc::string::string ( const char *  s,
int  l 
)
inline

Constructs a string referring into another buffer.

dtc::string::string ( const char *  s)
inline

Constructs a string from a C string.

dtc::string::string ( )
inline

Default constructor, returns an empty string.

dtc::string::string ( input_buffer s)
inline

Construct a from an input buffer, ending with a nul terminator.

Member Function Documentation

void dtc::string::dump ( )
inline

Dumps the string to the standard error stream. Intended to be used for debugging.

bool dtc::string::empty ( ) const
inline

Returns true if this is the empty string, false otherwise.

template<typename T >
bool dtc::string::operator!= ( other)
inline

Inequality operator, defined as the inverse of the equality operator.

bool dtc::string::operator< ( const string other) const
inline

Comparison operator, defined to allow strings to be used as keys in maps.

bool dtc::string::operator== ( const string other) const
inline

Compares two strings for equality. Strings are equal if they refer to identical byte sequences.

bool dtc::string::operator== ( const char *  other) const
inline

Compares a string against a C string. The trailing nul in the C string is ignored for the purpose of comparison, so this will always fail if the string contains nul bytes.

static string dtc::string::parse_node_name ( input_buffer s)
inlinestatic

Returns the longest string in the input buffer starting at the current cursor and composed entirely of characters that are valid in node names.

static string dtc::string::parse_node_or_property_name ( input_buffer s,
bool &  is_property 
)
inlinestatic

Parses either a node or a property name. If is_property is true on entry, then only property names are parsed. If it is false, then it will be set, on return, to indicate whether the parsed name is only valid as a property.

static string dtc::string::parse_property_name ( input_buffer s)
inlinestatic

Returns the longest string in the input buffer starting at the current cursor and composed entirely of characters that are valid in property names.

void dtc::string::print ( FILE *  file)
inline

Prints the string to the specified output stream.

void dtc::string::push_to_buffer ( byte_buffer &  buffer,
bool  escapes = false 
)
inline

Writes the string to the specified buffer.

size_t dtc::string::size ( )
inline

Returns the size of the string, in bytes.


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