PawLIB
PawLIB is a collection of data structures, classes, and tools designed to make C++ easier, friendlier, and more efficient to use.
See PawLIB in action in this DEV article by Lead Developer Jason C. McDonald:
Flex Data Structures
Dynamic allocation is the key to all "magically" resizing data structures, but it is also a major cause of performance issues. PawLIB's Flex data structures help to alleviate some of these problems.
FlexArray, FlexQueue, and FlexStack are largely analogous in function to std::vector, std::queue, and std::stack, but prove to be consistently faster in benchmark tests.
Future versions of PawLIB will bring additional Flex data structures (such as FlexBit and FlexMap), as well as further optimizations.
IOChannel
Once you move beyond basic strings, printing to the console using std::iostream can be quite non-trivial in C++. PawLIB's IOChannel is a wrapper for std::cout and printf, offering a whole bevy of powerful and intuitive features:
- Intelligently converts and displays ANY basic data type, including integers, floating-point numbers, booleans, and more!
- Format output colors and attributes (i.e. bold, underline) using simple flags. (This will be automatically cross-compatible in future versions.)
- Categorize and prioritize messages, allowing you to suppress certain messages on-the-fly.
- Easily output pointer addresses and raw memory dumps.
- Route messages to multiple outputs, including the standard ostream buffer and custom functions.
Goldilocks
While many C++ projects ship with tests, the code has to be recompiled before those tests can be run. PawLIB Goldilocks offers an alternative: you can write your tests and actually compile them into your production code! Then, the tests can be executed on-the-fly from within a custom program console.
Goldilocks' built-in benchmarker even allows you to run comparative benchmarks on any system, without having to install special software. The detailed results let you verify the statistical validity of the benchmark, thereby accounting for common causes of benchmark inaccuracies.
A later version of PawLIB will also include Blueshell, which will allow you to quickly implement a custom interactive console for Goldilocks.
Trilean
Ever wished you could handle uncertainty in your flag variables and conditionals? PawLIB Trilean makes this possible!
Trilean is a true atomic data type that always behaves how you'd expect. It has three unique states - true, false, and maybe - and is fully compatible with boolean variables and constants, as well as all C++ conditional statements and relevant operators.
No surprises, no hacks, no inconsistencies - just real, atomic trilean variables in C++.
tril foo = maybe;
if(foo) // or '(foo == true)'
//True
else if(!foo) // or '(foo == false)'
//False
else if(~exampleTrilean) // or '(foo == maybe)'
//Maybe
Pool
The object pool design pattern is frequently used in game design to better manage memory in certain scenarios. To use this pattern in C++, however, you usually have to implement it yourself.
PawLIB Pool is a general purpose implementation of the object pool design pattern. It allows you to create, manage, and remove objects safely using Pool's own reference variables, thereby avoiding potential memory issues.
Right now, Pool is generally slower than straight dynamic allocation. We hope to improve performance of Pool in a future version of PawLIB.
OneString
(Experimental, Releasing in 1.1)
Anyone who has tried to work with std::string and Unicode knows the two don't play well together. They never have! OneString fixes that: it is the first C++ string class to be fully compatible with Unicode in all operations, while being completely cross-compatible with std::string and C-strings.
In other words, imagine a string that is functionally identical to std::string, while fully supporting Unicode.
OneString is built on the same algorithm as the Flex data structures, which holds promise for major gains in performance in later versions.
Utilities
PawLIB also offers a number of useful utility functions:
- Convert integers, floats, and addresses to std::string or C-string.
- Split a std::string by tokens and store in a std::vector.
- Reverse a C-string.
FAQs: PawLIB
(Click a question to view the answer.)