History log of /haiku/headers/os/support/String.h
Revision Date Author Comments
# bcd6a663 19-Sep-2021 Niels Sascha Reedijk <niels.reedijk@gmail.com>

BString: make move constructor and assignment noexcept

Change-Id: I87f5ecad22f46b59386a091a1bb502536f460315


# 530f89aa 09-Sep-2021 Niels Sascha Reedijk <niels.reedijk@gmail.com>

BString: rewrite cleanup methods

This removes the use of the destructor in the move assignment operator, as it
may rely on undefined behaviour from the compiler. Additionally, some duplicate
logic to dereference and free a shared string has been unified under
_ReleasePrivateData().

Change-Id: Ie9f51d598c734f83cd0fba49b651315c6e9c8aac
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4440
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>


# 0b86520c 06-Sep-2021 Niels Sascha Reedijk <niels.reedijk@gmail.com>

BString: add support for move semantics with C++11 and up.

This implements the "rule of 5" for this type. While the copy operation for
BString was already using shallow copies of the underlying data, this change
further optimizes moving the data from one object to another.

While it is not the intention to implement move semantics to all types in the
legacy Haiku/Be kits, data types like BString are good candidates, because move
operations are often useful when working with data within an application.

In this implementation, the internal data of the string object will be set to
NULL, thus leaving an empty string.

Change-Id: I16bf9424f9b17f622b0b57659b80628e18760288
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4428
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>


# 388ac82b 05-Jan-2017 John Scipione <jscipione@gmail.com>

BString: Add IStartsWith() and IEndsWith() methods

Case-insensitive version of StartsWith() and EndsWith()


# bdd02e0d 12-Jan-2017 Adrien Destugues <pulkomandy@pulkomandy.tk>

BString: rename SetCharAt to SetByteAt

Makes it clear that it operates on bytes, not unicode codepoints.
Thanks to mmlr for remembering me of this subtlety.


# 0c5219a1 12-Jan-2017 Jérôme Duval <jerome.duval@gmail.com>

Restore missing symbol _ZN7BStringixEi on x86 and x86_64.

* Vision and others were broken after 3eac8208dfcd6bd73a534303414784d3754de855.
* this adds BStringRef in the backward compatibility section.
* fixes #13199.


# 3eac8208 09-Jan-2017 Adrien Destugues <pulkomandy@pulkomandy.tk>

Remove BStringRef and users.

As discussed in 2008
(http://www.freelists.org/post/haiku-development/BString-on-GCC4,1),
this class was not efficient because of lack of inlining. Implement the
suggested solution of a SetCharAt method instead. Also add a CompareAt
which covers a specific use case in KeyboardLayout.cpp.

Adjust all places which were using this feature to safer APIs.

Also fixes a copypaste error in FormattingConventions.cpp.


# 3fe7b3f7 02-Nov-2014 Michael Lotz <mmlr@mlotz.ch>

BString: Add ScanWithFormat convenience method.


# 969af804 02-Nov-2014 Michael Lotz <mmlr@mlotz.ch>

BString: Add format attribute to SetToFormatVarArgs.


# 29e8fa59 24-Jun-2014 John Scipione <jscipione@gmail.com>

Style fixes to Support Kit files


# 077c84eb 05-Nov-2013 Pawel Dziepak <pdziepak@quarnos.org>

kernel: atomic_*() functions rework

* No need for the atomically changed variables to be declared as
volatile.
* Drop support for atomically getting and setting unaligned data.
* Introduce atomic_get_and_set[64]() which works the same as
atomic_set[64]() used to. atomic_set[64]() does not return the
previous value anymore.


# 406ad5be 10-Sep-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BString::SetToFormat(): Add printf format function attribute


# be3833c9 27-Aug-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BString: Add SetToFormatVarArgs()


# c82776b2 23-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BString: Add Split()


# 379131d9 08-Apr-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BString: Add StartsWith() and EndsWith() methods


# ad07ecd8 16-Jul-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

BString::Private class to access BString internals


# 156ea481 16-Jul-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Add HashValue() methods to BString


# d0c41784 16-Jul-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

BString::Private class to access BString internals


# 5a54e156 16-Jul-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Add HashValue() methods to BString


# 85b41b15 07-Jul-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added bool and double BString::operator<<() versions.
* Removed the clashing operator in JobSetupDlg. Automatic whitespace
cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42387 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a928c3f0 13-Jun-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

operation <<(): Use the standard types [unsigned] long [long] instead of
[u]int32 and [u]int64 to avoid clashes with the int/unsigned int versions.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42165 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b2d98439 12-Apr-2011 Jonas Sundström <jonas@kirilla.com>

Add BString::IsEmpty() method.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41242 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a29fb938 01-Mar-2011 Jonas Sundström <jonas@kirilla.com>

Rename and a small simplification. Thanks, Clemens and Ingo.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40756 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c9e27ada 27-Feb-2011 Jonas Sundström <jonas@kirilla.com>

Cleanup. Efficiency makerover.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40720 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7581d0b2 26-Feb-2011 Jonas Sundström <jonas@kirilla.com>

BString::SetToArguments(). Forgot the header. :I

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40697 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 323e7fe5 12-Aug-2010 Rene Gollent <anevilyak@gmail.com>

Fix build error in IMAP client due to incorrect inequality check in one of BString's inlines. Fixes #6439.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38075 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a5b7cbe3 31-Jan-2010 Michael Lotz <mmlr@mlotz.ch>

Adding utf-8 aware version of most functions to BString. They are named after
the corresponding normal functions but have a "Chars" in the name like
"MoveCharsInto" or "AppendChars". Also added CountBytes() and CharAt().
This should make everyday string handling with multibyte strings a bit easier.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35371 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e90b90da 31-Jul-2009 Axel Dörfler <axeld@pinc-software.de>

* Added desperately missing Trim() method.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32035 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1746066c 20-Jul-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Made _Allocate() static.
* Moved the private inline methods up in the source file, so they can actually
be inlined.
* UnlockBuffer(): Removed superfluous "if". Maybe the one who wrote it can have
a look and check whether something else was intended originally.
* _MakeWritable() (both versions): Removed the superfluous ref count increment
and the matching decrements.
* _Resize(): Fixed ref count ASSERT. It would always be triggered when called
from UnlockBuffer(), since the ref count is -1 in that case.
* Clarified some comments.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31662 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ff293f20 01-Jul-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Added (const char*) cast operator. That makes BString more convenient to pass
around, particularly returning it from methods instead of a const char*, if the
object stores the string as a BString anyway, thus leveraging CoW.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31354 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e52400cf 06-Jun-2009 Axel Dörfler <axeld@pinc-software.de>

* Fixed a race condition in the former _Detach*() functions: since atomic_get()
was used, two different threads could decide to share the same mutable string.
* Renamed some functions to make clearer what they do, ie. _Detach() is now
called _MakeWritable().
* Cleaned up some questionable semantics, like the const char* parameter in
_DetachWith() - you can now choose to copy the original string or not with
a boolean. This also makes sure that the string is actually copied when it
has to, which wasn't the case before (but that was no problem with the way
that function was used).
* Made the header compliant with our style guide.
* Further cleanup.
* All BString related unit tests are passed, so I guess I didn't break too
much :-)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30980 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4b832620 10-Mar-2008 Axel Dörfler <axeld@pinc-software.de>

* _Realloc() did not initialize the reference count either.
* _Alloc() can now preserve the original reference count, only _Clone()
still initializes it to 1. As Karsten pointed out, this is necessary to
preserve the "shareable" status of the private data.
* I hope that's finally it. What happened to our testing suite, anyway? :-)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24355 a95241bf-73f2-0310-859d-f6bbb57e9c96


# bf4ddb61 10-Mar-2008 Axel Dörfler <axeld@pinc-software.de>

* As found by Karsten, the reference count was not initialized in
_ReplaceAtPositions(), and _DoCharacterEscape() (we don't need to preserve
it, though, as it must be 1).
* Factored out an _Alloc() method which is now always called when the private
data is allocated. It also takes care of correct initialization (and thus
fixes the above problem).
* This fix finally allows turning on reference counting again, thanks Karsten!
* Minor cleanup, renamed "oldAdr"/"newAdr" to "oldString", resp. "newString".


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24348 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 688c1426 10-Mar-2008 Axel Dörfler <axeld@pinc-software.de>

* After my last change, _IsShareable() was called on the wrong string in the
copy constructors, effectively turning of references completely.
* Since that caused troubles (NetPositive now crashes when started), I
temporarily disabled references by letting _IsShareable() always return
false until the issue is resolved.
* _FreePrivateData() now sets the fPrivateData member to NULL, and is also
safe to be called when fPrivateData is NULL.
* Removed my comment about the threading problem in _Detach() and _DetachWith()
as that just couldn't happen.
* _Clone() must not use memcpy() as the string pointed to by "data" might not
be as long as "length".
* LockBuffer() now marks a string as unshareable.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24345 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 002b33b7 08-Mar-2008 Axel Dörfler <axeld@pinc-software.de>

* Fixed a bunch or concurreny bugs and memory leaks of the new reference
string stuff.
* It's still not thread-safe for all usage patterns, though, so we might want
to remove or disable it: if a string is shared between several threads, and
one of those starts to use a reference, all kinds of problems can happen.
* Some cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24312 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 93608e10 24-Feb-2008 Karsten Heimrich <host.haiku@gmx.de>

* fixed coding style...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24103 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 576e2bf8 24-Feb-2008 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Patch by Julun: implements a refcounted BString. Thank You!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24102 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 43cca04a 06-Jan-2007 Axel Dörfler <axeld@pinc-software.de>

Cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19731 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5480b459 13-Nov-2003 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Another patch from Oliver Tappe: BString behaves better when the user supplies out-of bounds values in Insert(), Remove(), etc.
Code is refactored, and it fully complies with our guidelines.
Tests have been updated too (hint: try the replace tests with R5 and our implementation...)


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5348 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 67330a12 15-Feb-2003 Ingo Weinhold <ingo_weinhold@gmx.de>

Added missing _DoReplace().


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2718 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 769a8954 18-Nov-2002 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Corrected some inaccuracies imported from the BeOS headers:
CapitalizeEachWord() DOESN'T capitalize words separated by spaces, it
capitalizes words separated by non alphabethical characters.
FindLast(char, int32) prototype was misleading.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2008 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1c5c50fc 27-Sep-2002 shatty <shatty@nowhere.fake>

fixed newline at end of file.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1215 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a15ed5a1 26-Sep-2002 Stefano Ceccherini <stefano.ceccherini@gmail.com>

fixed a typo


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1193 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6ad2c5a1 06-Sep-2002 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Added a first BString header


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@987 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 93779182 09-Jul-2002 Ingo Weinhold <ingo_weinhold@gmx.de>

This file shadows Be's header. So if it doesn't contain anything, iclude at least the original header.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@17 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 52a38012 08-Jul-2002 ejakowatz <ejakowatz@nowhere.fake>

It is accomplished ...


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3fe7b3f72c545aae15ca08f85f5f5dad4c55817b 02-Nov-2014 Michael Lotz <mmlr@mlotz.ch>

BString: Add ScanWithFormat convenience method.


# 969af8044aeec17f9154065f24f2b7ff8827c97c 02-Nov-2014 Michael Lotz <mmlr@mlotz.ch>

BString: Add format attribute to SetToFormatVarArgs.


# 29e8fa5922c9f9a5eb09a2fcc92e7fb321d4cc59 24-Jun-2014 John Scipione <jscipione@gmail.com>

Style fixes to Support Kit files


# 077c84eb27b25430428d356f3d13afabc0cc0d13 05-Nov-2013 Pawel Dziepak <pdziepak@quarnos.org>

kernel: atomic_*() functions rework

* No need for the atomically changed variables to be declared as
volatile.
* Drop support for atomically getting and setting unaligned data.
* Introduce atomic_get_and_set[64]() which works the same as
atomic_set[64]() used to. atomic_set[64]() does not return the
previous value anymore.


# 406ad5becebc1761f0858fbd0af64f0be8870ec0 10-Sep-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BString::SetToFormat(): Add printf format function attribute


# be3833c9a41fbd09c1a4fa8c458f5cae5ff792ee 27-Aug-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BString: Add SetToFormatVarArgs()


# c82776b2fabe0e546e213495e53cef22a8afb6a6 23-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BString: Add Split()


# 379131d97d1bda4b50a0a384c36abd239783cc83 08-Apr-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BString: Add StartsWith() and EndsWith() methods


# ad07ecd82172564bbf3ecad2b9cdf6e7dd3747a6 16-Jul-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

BString::Private class to access BString internals


# 156ea481b3270fa156bf26c88b5cf571e97e7374 16-Jul-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Add HashValue() methods to BString


# d0c417848b2a5b665578911e6acb3593bed8d0e8 16-Jul-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

BString::Private class to access BString internals


# 5a54e156e5b96ef240ce432a09f18dea364dcd47 16-Jul-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Add HashValue() methods to BString


# 85b41b15d95ef86c0880faa6dcb0b35547328024 07-Jul-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added bool and double BString::operator<<() versions.
* Removed the clashing operator in JobSetupDlg. Automatic whitespace
cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42387 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a928c3f001e0919aa0f206ee35b60c6042861a20 13-Jun-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

operation <<(): Use the standard types [unsigned] long [long] instead of
[u]int32 and [u]int64 to avoid clashes with the int/unsigned int versions.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42165 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b2d9843906fdaabca1237f6415533b0da1904765 12-Apr-2011 Jonas Sundström <jonas@kirilla.com>

Add BString::IsEmpty() method.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41242 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a29fb9388d8f0fe48c526b6c582bcd02892f7ba9 01-Mar-2011 Jonas Sundström <jonas@kirilla.com>

Rename and a small simplification. Thanks, Clemens and Ingo.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40756 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c9e27adabfc36772dd8b8c2b32a4b9233f58e07a 27-Feb-2011 Jonas Sundström <jonas@kirilla.com>

Cleanup. Efficiency makerover.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40720 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7581d0b22480a1d61ac76d53b8ba9dc3c83d360d 26-Feb-2011 Jonas Sundström <jonas@kirilla.com>

BString::SetToArguments(). Forgot the header. :I

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40697 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 323e7fe56710901702a25563bc65595a311d8f8b 12-Aug-2010 Rene Gollent <anevilyak@gmail.com>

Fix build error in IMAP client due to incorrect inequality check in one of BString's inlines. Fixes #6439.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38075 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a5b7cbe3318e316b14b06334c26800f46ac26f3d 31-Jan-2010 Michael Lotz <mmlr@mlotz.ch>

Adding utf-8 aware version of most functions to BString. They are named after
the corresponding normal functions but have a "Chars" in the name like
"MoveCharsInto" or "AppendChars". Also added CountBytes() and CharAt().
This should make everyday string handling with multibyte strings a bit easier.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35371 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e90b90daf6315ab2650ea947cfaa55f86e859591 31-Jul-2009 Axel Dörfler <axeld@pinc-software.de>

* Added desperately missing Trim() method.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32035 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1746066cde0af657e63ce6ca99e2331c7c6216c5 20-Jul-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Made _Allocate() static.
* Moved the private inline methods up in the source file, so they can actually
be inlined.
* UnlockBuffer(): Removed superfluous "if". Maybe the one who wrote it can have
a look and check whether something else was intended originally.
* _MakeWritable() (both versions): Removed the superfluous ref count increment
and the matching decrements.
* _Resize(): Fixed ref count ASSERT. It would always be triggered when called
from UnlockBuffer(), since the ref count is -1 in that case.
* Clarified some comments.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31662 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ff293f209a92c434cf14cac86a4f8ab75bad9675 01-Jul-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Added (const char*) cast operator. That makes BString more convenient to pass
around, particularly returning it from methods instead of a const char*, if the
object stores the string as a BString anyway, thus leveraging CoW.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31354 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e52400cf24d1a3c668a8f127e78b9e3226964cd0 06-Jun-2009 Axel Dörfler <axeld@pinc-software.de>

* Fixed a race condition in the former _Detach*() functions: since atomic_get()
was used, two different threads could decide to share the same mutable string.
* Renamed some functions to make clearer what they do, ie. _Detach() is now
called _MakeWritable().
* Cleaned up some questionable semantics, like the const char* parameter in
_DetachWith() - you can now choose to copy the original string or not with
a boolean. This also makes sure that the string is actually copied when it
has to, which wasn't the case before (but that was no problem with the way
that function was used).
* Made the header compliant with our style guide.
* Further cleanup.
* All BString related unit tests are passed, so I guess I didn't break too
much :-)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30980 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4b83262008f3f368f2b4dd19b65a2552efa6f136 10-Mar-2008 Axel Dörfler <axeld@pinc-software.de>

* _Realloc() did not initialize the reference count either.
* _Alloc() can now preserve the original reference count, only _Clone()
still initializes it to 1. As Karsten pointed out, this is necessary to
preserve the "shareable" status of the private data.
* I hope that's finally it. What happened to our testing suite, anyway? :-)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24355 a95241bf-73f2-0310-859d-f6bbb57e9c96


# bf4ddb61e1d7e76bb4ac2c1c809ab007c7588d14 10-Mar-2008 Axel Dörfler <axeld@pinc-software.de>

* As found by Karsten, the reference count was not initialized in
_ReplaceAtPositions(), and _DoCharacterEscape() (we don't need to preserve
it, though, as it must be 1).
* Factored out an _Alloc() method which is now always called when the private
data is allocated. It also takes care of correct initialization (and thus
fixes the above problem).
* This fix finally allows turning on reference counting again, thanks Karsten!
* Minor cleanup, renamed "oldAdr"/"newAdr" to "oldString", resp. "newString".


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24348 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 688c14266c074ca6507884d55ca07260bc54a2b3 10-Mar-2008 Axel Dörfler <axeld@pinc-software.de>

* After my last change, _IsShareable() was called on the wrong string in the
copy constructors, effectively turning of references completely.
* Since that caused troubles (NetPositive now crashes when started), I
temporarily disabled references by letting _IsShareable() always return
false until the issue is resolved.
* _FreePrivateData() now sets the fPrivateData member to NULL, and is also
safe to be called when fPrivateData is NULL.
* Removed my comment about the threading problem in _Detach() and _DetachWith()
as that just couldn't happen.
* _Clone() must not use memcpy() as the string pointed to by "data" might not
be as long as "length".
* LockBuffer() now marks a string as unshareable.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24345 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 002b33b7200207e2d72b35499e34675ee69de713 08-Mar-2008 Axel Dörfler <axeld@pinc-software.de>

* Fixed a bunch or concurreny bugs and memory leaks of the new reference
string stuff.
* It's still not thread-safe for all usage patterns, though, so we might want
to remove or disable it: if a string is shared between several threads, and
one of those starts to use a reference, all kinds of problems can happen.
* Some cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24312 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 93608e10d15a2fbafc1f3f5ce87bf72d06495db6 24-Feb-2008 Karsten Heimrich <host.haiku@gmx.de>

* fixed coding style...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24103 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 576e2bf833a58f8948eca3fc65fdf7c10f2cfbc6 24-Feb-2008 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Patch by Julun: implements a refcounted BString. Thank You!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24102 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 43cca04a9a7d68c5510667a0bc7eab0322a66cb2 06-Jan-2007 Axel Dörfler <axeld@pinc-software.de>

Cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19731 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5480b4590e267957b90b79736b3990ddd39459a3 13-Nov-2003 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Another patch from Oliver Tappe: BString behaves better when the user supplies out-of bounds values in Insert(), Remove(), etc.
Code is refactored, and it fully complies with our guidelines.
Tests have been updated too (hint: try the replace tests with R5 and our implementation...)


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5348 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 67330a126799e077ecbe5a28752439b0541a540d 15-Feb-2003 Ingo Weinhold <ingo_weinhold@gmx.de>

Added missing _DoReplace().


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2718 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 769a89545028226bc60b236d0be9c4345cd79ddf 18-Nov-2002 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Corrected some inaccuracies imported from the BeOS headers:
CapitalizeEachWord() DOESN'T capitalize words separated by spaces, it
capitalizes words separated by non alphabethical characters.
FindLast(char, int32) prototype was misleading.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2008 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1c5c50fc822de2e63bed2c361abbb7038fe7aeb1 27-Sep-2002 shatty <shatty@nowhere.fake>

fixed newline at end of file.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1215 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a15ed5a14ad97feacf3bf5c08e1cb18861e3d87f 26-Sep-2002 Stefano Ceccherini <stefano.ceccherini@gmail.com>

fixed a typo


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1193 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6ad2c5a19cdd4593cb3fb6e72f504d84de5c29bb 06-Sep-2002 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Added a first BString header


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@987 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9377918226cf2059def937e5d63faa291017c869 09-Jul-2002 Ingo Weinhold <ingo_weinhold@gmx.de>

This file shadows Be's header. So if it doesn't contain anything, iclude at least the original header.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@17 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 52a380120846174213ccce9c4aab0dda17c72083 08-Jul-2002 ejakowatz <ejakowatz@nowhere.fake>

It is accomplished ...


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10 a95241bf-73f2-0310-859d-f6bbb57e9c96