sandbox / mbed-client

Fork of mbed-client by Christopher Haster

Embed: (wiki syntax)

« Back to documentation index

String Class Reference

String Class Reference

Simple C++ string class, used as replacement for std::string. More...

#include <m2mstring.h>

Public Member Functions

size_type size () const
 size without terminating NULL
size_type length () const
 as size()
const char * c_str () const
 raw data
void reserve (size_type n)
 Reserve internal string memory so that n characters can be put into the string (plus 1 for the NULL char).
void resize (size_type n)
 Resize string.
void resize (size_type n, char c)
 Resize string.
void swap (String &)
 swap contents
Stringerase (size_type pos, size_type len)
 erase len characters at position pos
Stringappend (const char *str, size_type n)
 Append n characters of a string.

Detailed Description

Simple C++ string class, used as replacement for std::string.

Definition at line 31 of file m2mstring.h.


Member Function Documentation

String & append ( const char *  str,
size_type  n 
)

Append n characters of a string.

Definition at line 225 of file m2mstring.cpp.

const char* c_str (  ) const

raw data

Definition at line 66 of file m2mstring.h.

String & erase ( size_type  pos,
size_type  len 
)

erase len characters at position pos

Definition at line 201 of file m2mstring.cpp.

size_type length (  ) const

as size()

Definition at line 60 of file m2mstring.h.

void reserve ( size_type  n )

Reserve internal string memory so that n characters can be put into the string (plus 1 for the NULL char).

If there is already enough memory, nothing happens, if not, the memory will be realloated to exactly this amount.

Definition at line 293 of file m2mstring.cpp.

void resize ( size_type  n )

Resize string.

If n is less than the current size, the string will be truncated. If n is larger, the memory will be reallocated to exactly this amount, and the additional characters will be NULL characters.

Definition at line 300 of file m2mstring.cpp.

void resize ( size_type  n,
char  c 
)

Resize string.

If n is less than the current size, the string will be truncated. If n is larger, the memory will be reallocated to exactly this amount, and the additional characters will be c characters.

Definition at line 304 of file m2mstring.cpp.

size_type size (  ) const

size without terminating NULL

Definition at line 59 of file m2mstring.h.

void swap ( String s )

swap contents

Definition at line 318 of file m2mstring.cpp.