Main Page   Modules   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages   Examples  

misc/string.h File Reference

string and wstring utility routines More...

#include <glt/config.h>
#include <string>
#include <vector>
#include <iosfwd>

Include dependency graph for string.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Functions

bool isBinary (const std::string &str)
 Test a string for binary bytes.

void dos2unix (std::string &dest, const std::string &src)
 Convert text to Unix end-of-line convention.

void dos2unix (std::wstring &dest, const std::wstring &src)
 Convert wide text to Unix end-of-line convention.

void unix2dos (std::string &dest, const std::string &src)
 Convert text to DOS end-of-line convention.

void unix2dos (std::wstring &dest, const std::wstring &src)
 Convert wide text to DOS end-of-line convention.

void readStream (std::istream &is, std::string &dest)
 Read an input stream into a string, until EOF.

void writeStream (std::ostream &os, const std::string &src)
 Write a string to an output stream.

void readUnicodeStream (std::istream &is, std::wstring &dest)
 Read an input stream into a wide string, until EOF.

void writeUnicodeStream (std::ostream &os, const std::wstring &src)
 Write a wide string to an output stream.

void string2wstring (std::wstring &dest, const std::string &src)
 Convert a string to a wide string.

void wstring2string (std::string &dest, const std::wstring &src)
 Convert a wide string to a string.

void utf8decode (std::wstring &dest, const std::string &src)
 Convert a utf8 encoded string to a wide string.

void bin2src (std::ostream &os, const unsigned char *buffer, const int n)
 Output a memory buffer as C/C++ source.

void bin2src (std::ostream &os, const std::string &src)
 Output a binary string as C/C++ source.

void bin2src (std::ostream &os, std::istream &is)
 Encode binary input stream as C/C++ source, until EOF.

void bin2asm (std::ostream &os, const unsigned char *buffer, const int n)
 Output a memory buffer as gcc assembler.

void bin2asm (std::ostream &os, const std::string &src)
 Output a string as gcc assembler.

void bin2asm (std::ostream &os, std::istream &is)
 Encode input stream as gcc assembler.

unsigned int fromHex4 (unsigned char ch)
 Convert from ASCII character to binary.

unsigned char toHex4 (unsigned int val)
 Convert from binary to ASCII character.

bool stringSplit (std::vector< std::string > &vec, const std::string &str, const std::string &delim)
 Split a string, using a delimiter.

bool stringMerge (const std::vector< std::string > &vec, std::string &str, const std::string &delim)
 Merge a vector of strings, inserting a delimiter.

double atof (const std::string &str)
 std::string version of ANSI C atof()

int atoi (const std::string &str)
 std::string version of ANSI C atoi()

long atol (const std::string &str)
 std::string version of ANSI C atol()

bool atob (const std::string &str)
 std::string to bool, inspired by ANSI C atoi()

template<class T, class I> const int atoc (const std::string &str, T(*f)(const std::string &), const std::string &match, const I &begin, const I &end)
 Generalised parsing of containers.


Detailed Description

string and wstring utility routines

Author:
Nigel Stewart, RMIT (nigels.com@gmail.com)
Todo:
Implement utf8encode
Note:
The std::wstring class is for 16bit unicode text

Definition in file string.h.


Generated on Tue Nov 5 11:11:29 2002 for GLT by doxygen1.2.18