Deprecated: Function set_magic_quotes_runtime() is deprecated in /home/jellycan/public_html/_code.jellycan.com/framework/initialize.php on line 33

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/jellycan/public_html/_code.jellycan.com/framework/initialize.php:33) in /home/jellycan/public_html/_code.jellycan.com/framework/initialize.php on line 57

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/jellycan/public_html/_code.jellycan.com/framework/initialize.php:33) in /home/jellycan/public_html/_code.jellycan.com/framework/initialize.php on line 57
Jellycan Code - StringWrapper

The StringWrapper component classes provide a very thin wrapper around the ICU UnicodeString (UTF-16 Unicode strings) and a simple implementation of the same API for char strings (MBCS and ASCII). It also ensures that the "getBuffer() const" are always NULL terminated. Note that this guarantee is for the const version of the API (a guarantee not provided by the raw ICU UnicodeString). Released as open-source and free using the MIT licence.

Documentation

Summary documentation of the interface is available as online documentation or is embedded in the header file.

Downloads

The current version of StringWrapper for ICU is 2.2 (last updated: 14 Apr 2008)

Download StringWrapper-2.2.zip (about 10Kb)

Features

The primary advantages of using this wrapper are:

  • Both string types expose a similar interface so users need to learn only a single string interface.
  • All strings returned by "getBuffer() const" are always NULL terminated. Note that this guarantee is for the *const* version of the API, this guarantee is not provided by the raw ICU UnicodeString.
  • Debug checking of correct use of dynamic buffer allocation (i.e. ensure that getBuffer(int32_t) is followed by releaseBuffer() and no other calls occur between the two).

The primary disadvantages of using this wrapper are:

  • Only a subset of the UnicodeString API is exposed by WideString.
  • Automatic string aliasing of read-only strings as supported by ICU is lost. It is still possible to manually cause a WideString to be an alias of another string, however this removes the guarantee of NULL-terminated buffers.
  • Every modification to a WideString invokes two method calls on the UnicodeString (to ensure NULL terminated strings).

The StringWrapper classes are designed to be usable on any platform that ICU is available, however testing has been restricted to Windows and Linux only. It has been released under the MIT Licence, allowing free use in all software (including GPL and commercial).

Change History

2.2 (14 Apr 2008)
Small bugfixes. Added crossplatform support for the %lld print formatter.

2.0 (13 Nov 2007)
Moved from std::string to roll-your-own implementation to avoid problems in the getBuffer(int32_t) code and provide the small static buffer like WideString.

1.0.1 (10 May 2007)
Add Makefile and fix Linux build.

1.0 (10 May 2007)
First public release.

Stats
Powered by Website Baker