BIscan.h File Reference

Defines namespace BIscan which provides routines which perform fast and flexible scanning of character buffers and strings for the builtin types: More...

#include <string>
#include <string.h>
#include <stdio.h>
Include dependency graph for BIscan.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  BinaryParsed< IntegerType >
 This class is a wrapper around a reference to an integer, which exists so that that operator>> can be specialized such that when a binary object is serialized, it will parse the stream for a binary integer instead of a decimal integer. More...
struct  HexParsed< IntegerType >
 This class is a wrapper around a reference to an integer which exists so that that operator>> can be specialized such that when a Hex object is serialized, it will parse the stream for a hex integer instead of a decimal integer. More...
struct  IsIntType< T >
 Wrapper around the member, value, which will be 1 if T is an integral type (including unsigned char but not regular char). For all other types, value will be 0. More...
struct  OctalParsed< IntegerType >
 This class is a wrapper around a reference to an integer which exists so that that operator>> can be specialized such that when a Octal object is serialized, it will parse the stream for a octal integer instead of a decimal integer. More...
struct  SKIPSET
 An object which represents a set of characters which a Stream should ignore when parsing with operator>>. The parsed characters are discarded from the stream. At least one member of the set must appear or an error results. More...
class  Stream
 A Representation of a stream of bytes that can be parsed quickly. See its related operator >> functions. The Stream does not own the bytes, and so they must not be changed or destroyed while the parsing process is in effect. More...
struct  StreamReader< T, TypeCategory >
 StreamReader is a class used to parse integers out of stream. The default implementation will not allow ANY class to compile. You must use a specialization to get the code to compile. See StreamReader specializations below. We made add specializations to StreamReader later to allow other kinds of classes to be parsable. More...
struct  StreamReader< T, 1 >
 Decimal Integer StreamReader. More...
struct  StreamReader< T, 3 >
 Hexadecimal Integer StreamReader. More...
struct  StreamReader< T, 5 >
 Octal Integer StreamReader. More...
struct  StreamReader< T, 7 >
 Binary Integer StreamReader. More...

Namespaces

namespace  BIscan
 

Namespace BIscan defines a variety of fast text scanning classes and functions which eliminate the overhead found using iostreams when scanning simple text buffers for builtin types. Basically, using class BIscan::Stream is like using sscanf -- and is 3X faster for integers because of inlining. For example:


Functions

template<class IntegerType >
BinaryParsed< IntegerType > Binary (IntegerType &t)
 Construct a wrapper around an integer reference to indicate to the Stream parsing logic that the integer should be parsed as binary.
template<class StringType >
bool convertDouble (StringType const &s, double &d)
 Convert a string, possibly with leading blanks, into an double.
bool convertDouble (char const *const &s, double &d)
 Convert a string, possibly with leading blanks, into an double.
template<class StringType >
bool convertFloat (StringType const &s, float &f)
 Convert a string, possibly with leading blanks, into an float.
bool convertFloat (char const *const &s, float &f)
 Convert a string, possibly with leading blanks, into an float.
template<class T , class StringType >
bool convertInteger (StringType const &s, T &integer, int base=10, int signable=true)
 Convert a std::string, possibly with leading blanks, into an integer.
template<class T >
bool convertInteger (char const *const &s, T &integer, int base=10, int signable=true)
 Convert a string, possibly with leading blanks, into an integer.
int digitValue (char c, int base=10)
 Determine the numeric value of a character in a given base. The character and the base are assumed to be a valid combination and no error checking is done, use isValidDigit() for that.
template<class IntegerType >
HexParsed< IntegerType > Hex (IntegerType &t)
 Construct a wrapper around an integer reference to indicate to the Stream parsing logic that the integer should be parsed as hexadecimal.
bool isValidDigit (char c, int base)
 Determine if a character is a valid digit in the specified base.
template<class IntegerType >
OctalParsed< IntegerType > Octal (IntegerType &t)
 Construct a wrapper around an integer reference to indicate to the Stream parsing logic that the integer should be parsed as octal.
Stream & operator>> (Stream &s, SKIPSET const &cs)
 Verify that the specified stream contains one or more characters which is found in the specified character set.
template<class IntegerType >
Stream & operator>> (Stream const &s, BinaryParsed< IntegerType > o)
 This overload of the Stream output operator is designed to trigger binary rather than decimal parsing of of integers from the stream. The BinaryParsed<> object which is passed in as a parameter is nothing more than a wrapper around some integer which should be parsed as hex rather than decimal. Unlike the i/o streams, there are no stream states, instead, you accomplish hex parsing like this:
template<class IntegerType >
Stream & operator>> (Stream const &s, OctalParsed< IntegerType > o)
 This overload of the Stream output operator is designed to trigger octal rather than decimal parsing of of integers from the stream. The OctalParsed<> object which is passed in as a parameter is nothing more than a wrapper around some integer which should be parsed as hex rather than decimal. Unlike the i/o streams, there are no stream states, instead, you accomplish hex parsing like this:
template<class IntegerType >
Stream & operator>> (Stream const &s, HexParsed< IntegerType > h)
 This overload of the Stream output operator is designed to trigger hexadecimal rather than decimal parsing of of integers from the stream. The HexParsed<> object which is passed in as a parameter is nothing more than a wrapper around some integer which should be parsed as hex rather than decimal. Unlike the i/o streams, there are no stream states, instead, you accomplish hex parsing like this:
Stream & operator>> (Stream const &s, float &f)
 Skip leading blanks then parse a floating point number from the stream and store it into a float variable.
Stream & operator>> (Stream const &s, double &d)
 Skip leading whitespace then parse a double precision floating point number from the stream and store it into a double variable.
Stream & operator>> (Stream const &s, std::string &str)
 Parse a std::string out of the Stream. Skip leading whitespace. Does not nul terminate str.
Stream & operator>> (Stream const &s, char const *skipString)
 Compare the contents of the stream to a specified string. If the stream contents exactly match all the characters in the string, in sequence, then the stream is moved passed the match.
template<size_t N>
Stream & operator>> (Stream const &s, char(&array)[N])
 Parse a string out of the stream and store it in an array of characters. Note that you must supply an array rather than a pointer for this to work.
Stream & operator>> (Stream const &s, char &c)
 This overload of operator>> allows you to read characters out of Stream without ignoring whitespace. Its pretty sluggish though, you should probably consider using some other interface for any kind of bulk processing. See.
template<class IntegerType >
Stream & operator>> (Stream const &s, IntegerType &variable)
 Template operator >> for the Stream class. It handles all data types for which specific overloads are not aleady defined, below.
template<class Iterator >
bool parseDouble (Iterator &firstRef, Iterator const &last, double &d)
 Parse a double from a string. Leading blanks are ignored.
template<class T , class Iterator >
bool parseInteger (Iterator &startRef, Iterator const &end, T &integer, int base=10, bool signable=true)
 Parse a signed or unsigned integer from a character range and store it in a integer variable. Remove leading blanks first.
template<class Iterator >
bool parseUnsignedDecimal (Iterator &start, Iterator const &end, unsigned long long &tmp)
 A hardcoded parser for base 10 numbers which is used to speed it up parseInteger() slightly.
Stream stream (char const *begin, size_t length)
 One of a family of overloaded functions that returns a stream whose type is based on its parameters.
template<class StringType >
Stream stream (StringType const &s)
 One of a family of overloaded functions that returns a stream whose type is based on its parameters.
Stream stream (char const *begin, char const *end)
 One of a family of overloaded functions that returns a stream whose type is based on its parameters.
Stream stream (char const *const &p)
 One of a family of overloaded functions that returns a stream whose type is based on its parameters.

Detailed Description

Defines namespace BIscan which provides routines which perform fast and flexible scanning of character buffers and strings for the builtin types:

Definition in file BIscan.h.

Generated on Wed Feb 29 22:51:01 2012 for CXXUtilities by  doxygen 1.6.3