SimpleLib
Introducing SimpleLib
SimpleLib is a simple but powerful set of C++ template classes designed to be easy to use, easy to read, cross platform compatible, efficient and totally free.
SimpleLib includes classes for strings, vectors, sorted vectors, associative maps (three implementations), linked lists, ring buffers, auto (smart) pointers, auto restore variables, object pools (two implementations), singletons and dynamic types. Stacks and queues are supported through appropriately named operations on the vector class.
Features
- Easy to use - include one header file - no libraries to link against
- Easy to read, remember and understand syntax
- Flexible set of the most common structures/algorithms
- Well tested
- Lightweight
- Efficient
- Cross platform compatible
- License and royalty free
Download
Download SimpleLib as a zip file: SimpleLib.zip
(includes SimpleLib.h, SimpleLib.cpp and SimpleTest.cpp unit tests)
Supported Platforms
SimpleLib has been known to work with the following compilers and platforms
Since I primarily use Visual Studio 2005,this is the most supported environment. I just don't have time to test every change on every platform. If you find a problem let me know and I'll fix it.
- Microsoft Visual Studio 2005 (x86 and x64)
- Microsoft Visual Studio 2003 (x86)
- Microsoft Visual C++ Express Edition (x86)
- Microsoft Visual Studio 6.0
- gcc 4.1.2 on Ubuntu Linux
- gcc 4.0.1 on MacOS
- gcc 3.4.4 on Cygwin
Thanks to Nick Maher for gcc testing and fixes.
The SimpleLib.zip file includes a file SimpleTest.cpp that contains a fairly exhaustive set of unit tests that can be used to verify the compatibility of SimpleLib on other platforms. If you find SimpleLib works or almost works on a platform not mentioned above, please let me know and I'll update the list (and merge in required fixes if you send them...)
Known Issues
The following are known issues with SimpleLib:
- Unicode version of Format() doesn't work on gcc.
- gcc requires str.sz() or static_cast<const char*>(str) when passing CString's to vararg functions such as printf, Format etc...
- CLinkedList only supports a single chain element on Microsoft Visual Studio 6.0 due to lack of support for pointer to member template arguments.
- CDynamic is not supported on Microsoft Visual Studio 6.0 due unsupported template functionality.
- CThreadSafeRingBuffer requires a interlocked compare and exchange function and is currently only supported on with 32-bit Windows with the Microsoft Visual Studio 2005 compiler.
Setting up SimpleLib
To use SimpleLib, simply download the above .zip, extract it to a local folder and configure your compiler's include path to point to that folder. Alternatively you can just place the SimpleLib files in the same directory as the project that is to use it.
SimpleLib is supplied as two files - SimpleLib.h and SimpleLib.cpp. SimpleLib.h contains the declaration of the supported classes while SimpleLib.cpp contains the implementation of those classes.
Once your compiler's include path is configured simply #include the SimpleLib header file and optionally add a using clause for the SimpleLib namespace:
#include <SimpleLib.h>
using namespace Simple;
That's it! Your now ready to start using SimpleLib.
(Note there is no need to add SimpleLib.cpp to your project - it's included at the end of SimpleLib.h).
Documentation
Most of the classes in SimpleLib are fairly self explanatory to use. Rather than provide detailed documentation of every method and parameter, I've just provided a verbal description of how to use each class with a few examples.
If there's something you can't figure out, don't understand or think needs better explanation, please contact me.
- String Classes and Functions
- Vector Class (and stack and queue)
- SortedVector Class
- Map and Index and HashMap Classes
- Linked List Class
- Ring Buffer and Thread Safe Ring Buffer Classes
- Pool and Plex Memory Allocation Classes
- Container Semantic Classes
- Singleton Class
- Auto Restore Class
- Auto (Smart) Pointer Class
- Dynamic Types
SimpleLib Plus
SimpleLib Plus is a is a set of libraries built on the core functionality of SimpleLib that additional utility classes and functions. See SimpleLib Plus for more information.
Licensing SimpleLib and SimpleLib Plus
SimpleLib (and SimpleLib Plus) maybe used on following terms and conditions:
- SimpleLib is completely free for unrestricted use in any commercial, retail, freeware, shareware, open source or other software project.
- SimpleLib is provided on an as-is basis, with no warranty to suitability or quality.
- SimpleLib is provided with no support. Topten Software will usually provide some assistance in using SimpleLib but is not obliged to do so.
- The source code for SimpleLib may not be redistributed in either its original or modified form. Projects using SimpleLib that are distributed with source code should refer to http://www.toptensoftware.com/simplelib as the original source for SimpleLib. This limitation will not apply in the case that Topten Software ceases to exist, or in the case that Topten Software grants written permission.
- Copyright for SimpleLib remains with Topten Software, except for code contributed by other developers (which is clearly marked in the code base) where copyright remains with the respective contributors.
- There is no need to acknowledge use of SimpleLib in applications that use it.
