CXXLIBRARY
[See also: CXXTOOLS.txt, CXXDIRVIEWER, CXXEDITOR.txt, CXXCURSORWINDOWS.txt, and README]
CXX LIBRARY
INTRODUCTION
------------
The CXX library is a collection of source code created originally with
several important goals in mind:
1) The explicit intent of making it free for anyone to use without charge
or obligation -- other than the requirement that you will not claim it to be
your own and that you agree to indemnify me, the author, against function or
malfunction or failure to function that might arise as a consequence of your
use thereof.
2) The goal of making portable routines that could make maximal use of the
power of the C++ language given widespread compiler incompatibilities
prevalent during the early phases of development.
3) The goal of creating a repository of well documented algorithms. This
does not necessarily mean that they are best ways of performing their
particular tasks but rather that they were very clearly documented and are
also very heavily tested to make sure that they do work as described. Not
only should the source code perform a useful function, but it should also
teach.
4) To provide useful abstractions. Many of the classes and functions in
the library are simply wrappers around functionality that already exist in
the operating system but are presented to the using programs in a modular,
orthognal, consistent, and sometimes quirky manner. For example, the class
"FileName" contains a std::string and can be converted to and from a string
easily. However, it adds numerous member functions that one would
expect to be related to a file's name, including:
* determining if the file actually exists
* determining if it is a directory
* getting the absolute pathname (ie converting "file" into "/dir/file")
* various static methods that work on filenames -- like
- finding all the matching files given a filename fragment
containing wildcards
* getting a file's permissions and other attributes.
All these "file name" related functions are represented in class FileName so
that there is a single point of contact for that kind of OS functionality.
Note that FileName has no "open" members. To open the file, you still have
to convert the FileName to a c style string and call the appropriate
iostream constructors or methods.
5) To provide a repository of C++ template algorithms and techniques. This
goal is similar to 3) above but more explicitly address the goal of
providing useful C++ templates that do helpful things. For example:
* include/BIscan/BIscan.h provides sscanf like parsing of built in types
such as integers, strings and floats -- but all functionality is
inline. Experiments show these routines to be faster than sscanf. See
class BIscan::stream.
* include/fmtio/fmtio.h provides fmtio::cs which is similar to
boost::format in syntax and basic logic, but which is simpler and
significantly faster. Basically, it lets you convert any type
into a an object that can be printed using operator<< or converted
to a std::string. See fmtd<> below.
* include/cxxtls/fmtd.h provides fmtd<>, a (seemingly) trivial wrapper
around sprintf that uses templates to minimize the confusion.
Basically, it is similar to fmtio::cs but is specific to built in types
and requires a character buffer or a std::string to hold the converted
text.
* Other various helper classes and routines:
+ class traits templates: a set of template classes which define
member enumeration constants that tell you important facts about
the template parameters. for example:
isSameType<T,U> -- defines member value to be true if T and U
are the same type
isPodType<T> -- defines member value to be true if T is
a built in type. Sadly, cannot tell you
if a class is pod. Having non-pod
members is not detectable without
compiler support.
isConst<T> -- defines member value to be true if T is a
const type
removeConst<T> -- defines nested type, type to be a non-const
version of T.
isConvertibleType<A,B> -- defines member value to be true if
A can be converted into B.
isPolymorphic<T> -- defines member value to be true if T is a
class with virtual methods.
And many more -- see the doxygen comments about that file. The
comments in the file explain how to use the type traits
information or you can see example uses in
tests/test_classTraits.cxx
+ etags database reading functionality
+ cpptagdb database reading functionality
+ CXXTLS_FOREACH -- like BOOST_FOREACH, and achieves the same
performance levels but slightly less functional. Read its
documentation. Lets you write code like this:
int array[40] = { ... }
CXXTLS_FOREACH(int cur, array)
{
cout << "cur = " << i << endl;
}
This works for array, stl containers (anything with a begin-
end pair), character strings, and std::strings.
+ template hash_list<T>: an enhancment to std::list that gives
it an approximately O(1) search. Works good but the insert
cost increases a lot to do this.
+ options.h -- defines functionality helpful in accessing
program command line arguments and environment variables.
Analogous to getopt() but works quite differently.
+ spline.h -- cubic spline template
+ streamable.h -- defines a class that you can inherit from
that lets your class appear on the left side of the
stream output operator. Cursor text windows are streamables.
See streamable.h for instructions on how to use it.
+ strtool.h -- defines a class, StrTool, that contains many
static member functions that perform string parsing, searching,
etc functions.
6) To provide a portable cursor text windowing system. see file
CXXCURSORWINDOWS.txt for more details.
DETAILS
-------
Refer to the doxygen generated manual pages for the various classes and
function. See http://www.bordoon.com/tools/index.hml
Or look at the headers and source code found in include/* and lib/*.