AString C++ Ansi String Library  0.4
AString Main Page
Author
Laurent NAVARRO ln@al.nosp@m.tide.nosp@m.v.com
Version
0.4 2014-09-03

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL LAURENT NAVARRO BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Except as contained in this notice, the name of the Laurent NAVARRO shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the Laurent NAVARRO.

Description

AString is a library providing a C++ Ansi (8 bits char set) String class

I've create it because, I work with several compiler and it's often difficult to decide which string class I should use, because some compiler have their own framework string class (Visual Studio CString, QT QString,C++ Builder AnsiString) and all of them support std::string and C char*. I could always use std:string but framework's strings are generally a bit more richer in features. I'm also doing multi-threading but on pre-c++ 11 there's no guarantee std::string works fine, you have to investigate, sometimes it's ok, sometimes it's not OK.

AString provide the following features :

Documentation

Documentation is generated using Doxygen, available online here http://www.altidev.com/ln/AString/ or at chm format here AString.chm and on the repository.

Configuration details

Some configuration can be done by settings some define on the — Write your settings Here — section of the Header file
Here a summary See source for details :

Implementation details

if ASTRING_IMPLEMENT_WITH_STD_STRING is set to 0 the string is implemented by a pointer on a buffer.
However a specific tips was used to allow string to be used on s printf like function on some compiler inspired from Chris OldWood blog A Not-So-Clever-Now String Implementation
The tips consists to have a pointer pointing on the full buffer itself but on the char* section of the buffer and to compute with offset to access to stored size and capacity attributes as described here.

+--------------+
+ Size + <-- StrBuffer - 2*sizeof(unsigned) or GetSize() or GetRawBuffer()
+--------------+
+ Capacity + <-- StrBuffer - 1*sizeof(unsigned) or GetCapacity()
+--------------+
+ char* Buffer + <-- StrBuffer Attribute, conatains zero terminated characters string.
+--------------+
Todo:
  • Add missing std::string reimplementation (rfind)
  • Add some features ToUpper, ToLower
  • Add some useful string simple algorithms
    • ToIntFromHex "0x20" or "20" to 32 , ToIntFromBin "0101" to 5
    • assignAsHex 32 to "0x20" or "20" optional 0x
    • assignAsBin 5 to "0101" parameter to set width and space on result (0101 0011 if param=4)
  • Finalize/improve documentation and tests, test on Clang
  • Add interaction with some others frameworks (QT, WxWidget, ... )
  • Improve implementation of CString interoperability (make constructor param const by avoiding get buffer

Test details

I'm using the TDD logic for this library, so it include mainly project to run CPP Unit Project include test project on

I've done memory check using visual leak detector on Visual Studio http://vld.codeplex.com/
And DrMemory on Windows
And valgring on Linux, here command to test :

Release History