2007-04-16 13:28:29 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2007, Haiku, Inc. All Rights Reserved.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*
|
|
|
|
* Documentation by:
|
|
|
|
* Niels Sascha Reedijk <niels.reedijk@gmail.com>
|
|
|
|
* Corresponds to:
|
|
|
|
* /trunk/headers/os/support/String.h rev 19731
|
|
|
|
* /trunk/src/kits/support/String.cpp rev 19731
|
|
|
|
*/
|
2007-02-26 13:34:35 +03:00
|
|
|
|
2006-12-29 03:26:34 +03:00
|
|
|
/*!
|
|
|
|
\file String.h
|
2007-03-30 17:50:00 +04:00
|
|
|
\brief Defines the BString class and global operators and functions for handling strings.
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
2007-03-30 17:50:00 +04:00
|
|
|
\class BString String.h
|
2006-12-29 03:26:34 +03:00
|
|
|
\ingroup support
|
|
|
|
\ingroup libbe
|
|
|
|
\brief String class supporting common string operations.
|
|
|
|
|
|
|
|
BString is a string allocation and manipulation class. The object
|
|
|
|
takes care to allocate and free memory for you, so it will always be
|
|
|
|
"big enough" to store your strings.
|
|
|
|
|
|
|
|
\author Marc Flerackers \<mflerackers@androme.be\>
|
|
|
|
\author Stefano Ceccherini \<burton666@freemail.it\>
|
|
|
|
\author Oliver Tappe \<openbeos@hirschaefer.de\>
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
2007-02-26 13:34:35 +03:00
|
|
|
\var char* BString::fPrivateData
|
2007-03-30 17:50:00 +04:00
|
|
|
\brief BString's storage for data.
|
2007-02-26 13:34:35 +03:00
|
|
|
|
2007-03-02 16:36:32 +03:00
|
|
|
This member is deprecated and might even go \c private in future releases.
|
|
|
|
|
2007-02-26 13:34:35 +03:00
|
|
|
If you are planning to derive from this object and you want to manipulate the raw
|
|
|
|
string data, please have a look at LockBuffer() and UnlockBuffer().
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString::BString()
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Create an uninitialized BString.
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString::BString(const char* str)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Create a BString and initializes it to the given string.
|
2006-12-29 03:26:34 +03:00
|
|
|
\param str Pointer to a NULL terminated string.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString::BString(const BString &string)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Create a BString and makes it a copy of the supplied one.
|
2006-12-29 03:26:34 +03:00
|
|
|
\param string the BString object to be copied.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString::BString(const char *str, int32 maxLength)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Create a BString and initializes it to the given string.
|
2006-12-29 03:26:34 +03:00
|
|
|
\param str Pointer to a NULL terminated string.
|
|
|
|
\param maxLength The amount of characters you want to copy from the original
|
|
|
|
string.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString::~BString()
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Free all resources associated with the object.
|
2006-12-29 03:26:34 +03:00
|
|
|
|
2007-02-26 13:34:35 +03:00
|
|
|
The destructor frees the internal buffer associated with the string.
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\name Access Methods
|
|
|
|
*/
|
|
|
|
|
|
|
|
//! @{
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn const char* BString::String() const
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Return a pointer to the object string, NULL terminated.
|
|
|
|
|
|
|
|
The pointer to the object string is guaranteed to be NULL
|
2006-12-29 03:26:34 +03:00
|
|
|
terminated. You can't modify or free the pointer. Once the BString
|
|
|
|
object is deleted, the pointer becomes invalid.
|
2007-02-26 13:34:35 +03:00
|
|
|
|
|
|
|
If you want to manipulate the internal C-string of the object directly, have
|
|
|
|
a look at LockBuffer().
|
2006-12-29 03:26:34 +03:00
|
|
|
|
|
|
|
\return A pointer to the object string.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn int32 BString::Length() const
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Get the length of the string in bytes.
|
|
|
|
|
|
|
|
\return An integer with the length of the string, measured in bytes.
|
|
|
|
\sa CountChars()
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn int32 BString::CountChars() const
|
|
|
|
\brief Returns the length of the object measured in characters.
|
|
|
|
|
2007-02-26 13:34:35 +03:00
|
|
|
BString is somewhat aware of UTF8 characters, so this method will count
|
|
|
|
the actual number of characters in the string.
|
|
|
|
|
2006-12-29 03:26:34 +03:00
|
|
|
\return An integer which is the number of characters in the string.
|
2007-02-26 13:34:35 +03:00
|
|
|
\sa Length()
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
//! @}
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\name Assignment Methods
|
2007-02-26 13:34:35 +03:00
|
|
|
|
|
|
|
To assign a string to the object, thus overriding the previous string
|
|
|
|
that was stored, there are different methods to use. Use one of the
|
|
|
|
overloaded Adopt() methods to take over data from another object. Use
|
|
|
|
one of the assignment operators to copy data from another object, or
|
|
|
|
use one of the SetTo() methods for more advanced copying.
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
//! @{
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::operator=(const BString &string)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Re-initialize the object to a copy of the data of a BString.
|
2006-12-29 03:26:34 +03:00
|
|
|
\param string The string object to copy.
|
|
|
|
\return The function always returns \c *this .
|
2007-02-26 13:34:35 +03:00
|
|
|
\sa Adopt(BString &from)
|
|
|
|
\sa SetTo(const BString &string, int32 length)
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::operator=(const char *str)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Re-initialize the object to a copy of the data of a C-string.
|
|
|
|
\param str Pointer to a C-string.
|
2006-12-29 03:26:34 +03:00
|
|
|
\return The function always returns \c *this .
|
2007-02-26 13:34:35 +03:00
|
|
|
\sa SetTo(const char *str, int32 maxLength)
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::operator=(char c)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Re-initialize the object to a character.
|
2006-12-29 03:26:34 +03:00
|
|
|
\param c The character which you want to initialize the string to.
|
|
|
|
\return The function always returns \c *this .
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::SetTo(const char *str, int32 maxLength)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Re-initialize the object to a copy of the data of a C-string.
|
2006-12-29 03:26:34 +03:00
|
|
|
\param str Pointer to a string.
|
|
|
|
\param maxLength Amount of characters to copy from the original string.
|
|
|
|
\return The function always returns \c *this .
|
2007-02-26 13:34:35 +03:00
|
|
|
\sa operator=(const char *str)
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::SetTo(const BString &from)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Re-initialize the object to a copy of the data of a BString.
|
2006-12-29 03:26:34 +03:00
|
|
|
\param from The string object to copy.
|
|
|
|
\return The function always returns \c *this .
|
2007-02-26 13:34:35 +03:00
|
|
|
\sa SetTo(const BString &string, int32 length)
|
|
|
|
\sa Adopt(BString &from)
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::SetTo(const char *str)
|
|
|
|
\brief Re-initialize the object to a copy of the data of a C-string.
|
|
|
|
|
|
|
|
This method calls operator=(const char *str).
|
|
|
|
|
|
|
|
\param str Pointer to a C-string.
|
|
|
|
\return The function always returns \c *this .
|
|
|
|
\sa SetTo(const char *str, int32 maxLength)
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::Adopt(BString &from)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Adopt the data of the given BString object.
|
|
|
|
|
|
|
|
This method adopts the data. Please note that the object that is adopted
|
|
|
|
from is not deleted, only its private data is initialized to a null
|
|
|
|
string. So if the from object was created on the heap, you need to
|
|
|
|
clean it up yourself.
|
|
|
|
|
2006-12-29 03:26:34 +03:00
|
|
|
\param from The string object to adopt.
|
|
|
|
\return The function always returns \c *this .
|
2007-02-26 13:34:35 +03:00
|
|
|
\sa operator=(const BString &string)
|
|
|
|
\sa SetTo(const BString &string, int32 length)
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::SetTo(const BString &string, int32 length)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Re-initialize the string to a copy of the given BString object.
|
2006-12-29 03:26:34 +03:00
|
|
|
\param string The string object to copy.
|
|
|
|
\param length Amount of characters to copy from the original BString.
|
|
|
|
\return The function always returns \c *this .
|
2007-02-26 13:34:35 +03:00
|
|
|
\sa operator=(const BString &string)
|
|
|
|
\sa Adopt(BString &from, int32 length)
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::Adopt(BString &from, int32 length)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Adopt the data of the given BString object.
|
|
|
|
|
|
|
|
This method adopts the data. Please note that the object that is adopted
|
|
|
|
from is not deleted, only its private data is initialized to a null
|
|
|
|
string. So if the from object was created on the heap, you need to
|
|
|
|
clean it up yourself.
|
|
|
|
|
2006-12-29 03:26:34 +03:00
|
|
|
\param from The string object to adopt.
|
|
|
|
\param length Amount of characters to get from the original BString.
|
|
|
|
\return The function always returns \c *this .
|
2007-02-26 13:34:35 +03:00
|
|
|
\sa operator=(const BString &string)
|
|
|
|
\sa SetTo(const BString &string, int32 length)
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::SetTo(char c, int32 count)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Re-initialize the object to a string composed of a character you specify.
|
|
|
|
|
|
|
|
This method lets you specify the length of a string and what character you want the
|
|
|
|
string to contain repeatedly.
|
|
|
|
|
2006-12-29 03:26:34 +03:00
|
|
|
\param c The character you want to initialize the BString.
|
2007-02-26 13:34:35 +03:00
|
|
|
\param count The length of the string.
|
2006-12-29 03:26:34 +03:00
|
|
|
\return The function always returns \c *this .
|
2007-02-26 13:34:35 +03:00
|
|
|
\sa operator=(char c)
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
//! @}
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\name Substring Copying
|
|
|
|
*/
|
|
|
|
|
|
|
|
//! @{
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString &BString::CopyInto(BString &into, int32 fromOffset, int32 length) const
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Copy the object's data (or part of it) into another BString.
|
|
|
|
|
|
|
|
This methods makes sure you don't copy more bytes than are available in the string. If
|
|
|
|
the length exceeds the length of the string, it only copies the number of characters that
|
|
|
|
are actually available.
|
|
|
|
|
|
|
|
\param into The BString to where to copy the object.
|
|
|
|
\param fromOffset The zero-based offset where to begin the copy.
|
2006-12-29 03:26:34 +03:00
|
|
|
\param length The amount of bytes to copy.
|
2007-02-26 13:34:35 +03:00
|
|
|
\return This method always returns a pointer to the string passed as the \c into parameter.
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn void BString::CopyInto(char *into, int32 fromOffset, int32 length) const
|
|
|
|
\brief Copy the BString data (or part of it) into the supplied buffer.
|
2007-02-26 13:34:35 +03:00
|
|
|
|
|
|
|
This methods makes sure you don't copy more bytes than are available in the string. If
|
|
|
|
the length exceeds the length of the string, it only copies the number of characters that
|
|
|
|
are actually available.
|
|
|
|
|
|
|
|
It's up to you to make sure your buffer is large enough.
|
|
|
|
|
2006-12-29 03:26:34 +03:00
|
|
|
\param into The buffer where to copy the object.
|
2007-02-26 13:34:35 +03:00
|
|
|
\param fromOffset The zero-based offset where to begin the copy.
|
2006-12-29 03:26:34 +03:00
|
|
|
\param length The amount of bytes to copy.
|
|
|
|
*/
|
|
|
|
|
|
|
|
//! @}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\name Appending Methods
|
|
|
|
*/
|
|
|
|
|
|
|
|
//! @{
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::operator+=(const char *str)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Append the given string to the object.
|
|
|
|
\param str A pointer to the NULL-terminated C-string to append.
|
|
|
|
\return This method always returns \c *this .
|
|
|
|
\sa Append(const char *str, int32 length)
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::operator+=(char c)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Append the given character to the object.
|
2006-12-29 03:26:34 +03:00
|
|
|
\param c The character to append.
|
2007-02-26 13:34:35 +03:00
|
|
|
\return This method always returns \c *this .
|
|
|
|
\sa Append(char c, int32 count)
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString & BString::operator+=(const BString &string)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Append the given string to the object
|
|
|
|
\param string The string to append
|
|
|
|
\return This method always returns \c *this .
|
|
|
|
\sa Append(const BString &string, int32 length)
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString &BString::Append(const BString &string)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Append the given string to the object
|
|
|
|
\param string The string to append
|
|
|
|
\return This method always returns \c *this .
|
|
|
|
\sa Append(const BString &string, int32 length)
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString &BString::Append(const char *str)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Append the given string to the object.
|
|
|
|
|
|
|
|
This method calls operator+=(const char *str).
|
|
|
|
\sa Append(const char *str, int32 length)
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::Append(const BString &string, int32 length)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Append a part of the given BString to the object.
|
2006-12-29 03:26:34 +03:00
|
|
|
\param string The BString to append.
|
2007-02-26 13:34:35 +03:00
|
|
|
\param length The maximum number ofbytes to get from the original object.
|
|
|
|
\return This method always returns \c *this .
|
|
|
|
\sa operator+=(const BString &string)
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::Append(const char *str, int32 length)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Append a part of the given string to the object.
|
2006-12-29 03:26:34 +03:00
|
|
|
\param str A pointer to the string to append.
|
|
|
|
\param length The maximum bytes to get from the original string.
|
2007-02-26 13:34:35 +03:00
|
|
|
\return This method always returns \c *this .
|
|
|
|
\sa operator+=(const char *str)
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::Append(char c, int32 count)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Append the given character repeatedly to the object.
|
2006-12-29 03:26:34 +03:00
|
|
|
\param c The character to append.
|
2007-02-26 13:34:35 +03:00
|
|
|
\param count The number of times this character should be appended.
|
|
|
|
\return This method always returns \c *this .
|
|
|
|
\sa operator+=(char c)
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
//! @}
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\name Prepending Methods
|
|
|
|
*/
|
|
|
|
|
|
|
|
//! @{
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::Prepend(const char *str)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Prepend the given string to the object.
|
2006-12-29 03:26:34 +03:00
|
|
|
\param str A pointer to the string to prepend.
|
2007-02-26 13:34:35 +03:00
|
|
|
\return This method always returns \c *this .
|
|
|
|
\sa Prepend(const char *str, int32 length)
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::Prepend(const BString &string)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Prepend the given BString to the object.
|
2006-12-29 03:26:34 +03:00
|
|
|
\param string The BString object to prepend.
|
2007-02-26 13:34:35 +03:00
|
|
|
\return This method always returns \c *this .
|
|
|
|
\sa Prepend(const BString &string, int32 len)
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::Prepend(const char *str, int32 length)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Prepend the given string to the object.
|
2006-12-29 03:26:34 +03:00
|
|
|
\param str A pointer to the string to prepend.
|
|
|
|
\param length The maximum amount of bytes to get from the string.
|
2007-02-26 13:34:35 +03:00
|
|
|
\return This method always returns \c *this .
|
|
|
|
\sa Prepend(const char *str)
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::Prepend(const BString &string, int32 len)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Prepend the given BString to the object.
|
2006-12-29 03:26:34 +03:00
|
|
|
\param string The BString object to prepend.
|
|
|
|
\param len The maximum amount of bytes to get from the BString.
|
2007-02-26 13:34:35 +03:00
|
|
|
\return This method always returns \c *this .
|
|
|
|
\sa Prepend(const BString &string)
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::Prepend(char c, int32 count)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Prepend the given character repeatedly to the object.
|
2006-12-29 03:26:34 +03:00
|
|
|
\param c The character to prepend.
|
2007-02-26 13:34:35 +03:00
|
|
|
\param count The number of times this character should be prepended.
|
|
|
|
\return This method always returns \c *this .
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
//! @}
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\name Inserting Methods
|
|
|
|
*/
|
|
|
|
|
|
|
|
//! @{
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::Insert(const char *str, int32 pos)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Insert the given string at the given position into the object's data.
|
2006-12-29 03:26:34 +03:00
|
|
|
\param str A pointer to the string to insert.
|
2007-02-26 13:34:35 +03:00
|
|
|
\param pos The offset in bytes into the BString's data where to insert the string.
|
|
|
|
\return This method always returns \c *this .
|
|
|
|
\sa Insert(const char *str, int32 length, int32 pos)
|
|
|
|
\sa Insert(const char *str, int32 fromOffset, int32 length, int32 pos)
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::Insert(const char *str, int32 length, int32 pos)
|
|
|
|
\brief Inserts the given string at the given position into the object's data.
|
|
|
|
\param str A pointer to the string to insert.
|
|
|
|
\param length The amount of bytes to insert.
|
2007-02-26 13:34:35 +03:00
|
|
|
\param pos The offset in bytes into the BString's data where to insert the string.
|
|
|
|
\return This method always returns \c *this .
|
|
|
|
\sa Insert(const char *str, int32 pos)
|
|
|
|
\sa Insert(const char *str, int32 fromOffset, int32 length, int32 pos)
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::Insert(const char *str, int32 fromOffset, int32 length, int32 pos)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Insert the given string at the given position into the object's data.
|
2006-12-29 03:26:34 +03:00
|
|
|
\param str A pointer to the string to insert.
|
2007-02-26 13:34:35 +03:00
|
|
|
\param fromOffset The offset in the string that is to be inserted
|
2006-12-29 03:26:34 +03:00
|
|
|
\param length The amount of bytes to insert.
|
2007-02-26 13:34:35 +03:00
|
|
|
\param pos The offset in bytes into the BString's data where to insert the string.
|
|
|
|
\return This method always returns \c *this .
|
|
|
|
\sa Insert(const char *str, int32 pos)
|
|
|
|
\sa Insert(const char *str, int32 length, int32 pos)
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::Insert(const BString &string, int32 pos)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Insert the given BString at the given position into the object's data.
|
2006-12-29 03:26:34 +03:00
|
|
|
\param string The BString object to insert.
|
2007-02-26 13:34:35 +03:00
|
|
|
\param pos The offset in bytes into the BString's data where to insert the string.
|
|
|
|
\return This method always returns \c *this .
|
|
|
|
\sa Insert(const BString &string, int32 length, int32 pos)
|
|
|
|
\sa Insert(const BString &string, int32 fromOffset, int32 length, int32 pos)
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::Insert(const BString &string, int32 length, int32 pos)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Insert the given BString at the given position into the object's data.
|
2006-12-29 03:26:34 +03:00
|
|
|
\param string The BString object to insert.
|
|
|
|
\param length The amount of bytes to insert.
|
2007-02-26 13:34:35 +03:00
|
|
|
\param pos The offset in bytes into the BString's data where to insert the string.
|
|
|
|
\return This method always returns \c *this .
|
|
|
|
\sa Insert(const BString &string, int32 pos)
|
|
|
|
\sa Insert(const BString &string, int32 fromOffset, int32 length, int32 pos)
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::Insert(const BString &string, int32 fromOffset, int32 length, int32 pos)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Insert the given string at the given position into the object's data.
|
2006-12-29 03:26:34 +03:00
|
|
|
\param string The BString object to insert.
|
2007-02-26 13:34:35 +03:00
|
|
|
\param fromOffset The offset in the string that is to be inserted
|
2006-12-29 03:26:34 +03:00
|
|
|
\param length The amount of bytes to insert.
|
2007-02-26 13:34:35 +03:00
|
|
|
\param pos The offset in bytes into the BString's data where to insert the string.
|
|
|
|
\return This method always returns \c *this .
|
|
|
|
\sa Insert(const BString &string, int32 pos)
|
|
|
|
\sa Insert(const BString &string, int32 length, int32 pos)
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::Insert(char c, int32 count, int32 pos)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Insert the given character repeatedly at the given position into the object's data.
|
2006-12-29 03:26:34 +03:00
|
|
|
\param c The character to insert.
|
2007-02-26 13:34:35 +03:00
|
|
|
\param count The number of times to insert the character.
|
|
|
|
\param pos The offset in bytes into the BString's data where to insert the string.
|
|
|
|
\return This method always returns \c *this .
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
//! @}
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\name Removing Methods
|
|
|
|
*/
|
|
|
|
|
|
|
|
//! @{
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::Truncate(int32 newLength, bool lazy)
|
|
|
|
\brief Truncate the string to the new length.
|
|
|
|
\param newLength The new lenght of the string.
|
|
|
|
\param lazy If true, the memory-optimisation is postponed to later
|
2007-02-26 13:34:35 +03:00
|
|
|
\return This method always returns \c *this .
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::Remove(int32 from, int32 length)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Remove some bytes, starting at the given offset
|
2006-12-29 03:26:34 +03:00
|
|
|
\param from The offset from which you want to start removing
|
|
|
|
\param length The number of bytes to remove
|
2007-02-26 13:34:35 +03:00
|
|
|
\return This function always returns \c *this .
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::RemoveFirst(const BString &string)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Remove the first occurrence of the given BString.
|
2006-12-29 03:26:34 +03:00
|
|
|
\param string The BString to remove.
|
2007-02-26 13:34:35 +03:00
|
|
|
\return This function always returns \c *this .
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::RemoveLast(const BString &string)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Remove the last occurrence of the given BString.
|
2006-12-29 03:26:34 +03:00
|
|
|
\param string The BString to remove.
|
2007-02-26 13:34:35 +03:00
|
|
|
\return This function always returns \c *this .
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::RemoveAll(const BString &string)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Remove all occurrences of the given BString.
|
2006-12-29 03:26:34 +03:00
|
|
|
\param string The BString to remove.
|
2007-02-26 13:34:35 +03:00
|
|
|
\return This function always returns \c *this .
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::RemoveFirst(const char *string)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Remove the first occurrence of the given string.
|
2006-12-29 03:26:34 +03:00
|
|
|
\param string A pointer to the string to remove.
|
2007-02-26 13:34:35 +03:00
|
|
|
\return This function always returns \c *this .
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::RemoveLast(const char *string)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Remove the last occurrence of the given string.
|
2006-12-29 03:26:34 +03:00
|
|
|
\param string A pointer to the string to remove.
|
2007-02-26 13:34:35 +03:00
|
|
|
\return This function always returns \c *this .
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::RemoveAll(const char *str)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Remove all occurrences of the given string.
|
2006-12-29 03:26:34 +03:00
|
|
|
\param str A pointer to the string to remove.
|
2007-02-26 13:34:35 +03:00
|
|
|
\return This function always returns \c *this .
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::RemoveSet(const char *setOfCharsToRemove)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Remove all the characters specified.
|
2006-12-29 03:26:34 +03:00
|
|
|
\param setOfCharsToRemove The set of characters to remove.
|
2007-02-26 13:34:35 +03:00
|
|
|
\return This function always returns \c *this .
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::MoveInto(BString &into, int32 from, int32 length)
|
|
|
|
\brief Move the BString data (or part of it) into another BString.
|
|
|
|
\param into The BString where to move the object.
|
|
|
|
\param from The offset (zero based) where to begin the move
|
|
|
|
\param length The amount of bytes to move.
|
2007-02-26 13:34:35 +03:00
|
|
|
\return This method always returns \c into .
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn void BString::MoveInto(char *into, int32 from, int32 length)
|
|
|
|
\brief Move the BString data (or part of it) into the given buffer.
|
|
|
|
\param into The buffer where to move the object.
|
2007-03-30 17:50:00 +04:00
|
|
|
\param from The offset (zero based) where to begin the move.
|
2006-12-29 03:26:34 +03:00
|
|
|
\param length The amount of bytes to move.
|
|
|
|
*/
|
|
|
|
|
|
|
|
//! @}
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\name Comparison Methods
|
2007-02-26 13:34:35 +03:00
|
|
|
|
|
|
|
There are two different comparison methods. First of all there
|
|
|
|
is the whole range of operators that return a boolean value, secondly
|
|
|
|
there are methods that return an integer value, both case sensitive
|
|
|
|
and case insensitive.
|
|
|
|
|
|
|
|
There are also global comparison operators and global compare functions.
|
|
|
|
You might need these in case you have a sort routine that takes a generic
|
|
|
|
comparison function, such as BList::SortItems().
|
|
|
|
See the String.h documentation file to see the specifics, though basically
|
|
|
|
there are the same as implemented in this class.
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
//! @{
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn bool BString::operator<(const char *string) const
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Lexographically compare if this string is less than a given string.
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn bool BString::operator<(const BString &string) const
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Lexographically compare if this string is less than a given string.
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn bool BString::operator<=(const char *string) const
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Lexographically compare if this string is less than or equal to a given string.
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn bool BString::operator<=(const BString &string) const
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Lexographically compare if this string is less than or equal to a given string.
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn bool BString::operator==(const char *string) const
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Lexographically compare if this string is equal to a given string.
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn bool BString::operator==(const BString &string) const
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Lexographically compare if this string is equal to a given string.
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn bool BString::operator>=(const char *string) const
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Lexographically compare if this string is more than or equal to a given string.
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn bool BString::operator>=(const BString &string) const
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Lexographically compare if this string is more than or equal to a given string.
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn bool BString::operator>(const char *string) const
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Lexographically compare if this string is more than a given string.
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn bool BString::operator>(const BString &string) const
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Lexographically compare if this string is more than a given string.
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn bool BString::operator!=(const BString &string) const
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Lexographically compare if this string is not equal to a given string.
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn bool BString::operator!=(const char *str) const
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Lexographically compare if this string is not equal to a given string.
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn int BString::Compare(const BString &string) const
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Lexographically compare this string to another.
|
|
|
|
|
|
|
|
\param string The string to compare to.
|
|
|
|
\retval >0 The object sorts lexographically after \c string.
|
|
|
|
\retval =0 The object is equal to \c string.
|
|
|
|
\retval <0 The object sorts lexographically before \c string.
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
2007-02-26 13:34:35 +03:00
|
|
|
\fn int BString::Compare(const char *str) const
|
|
|
|
\brief Lexographically compare this string to another.
|
|
|
|
|
|
|
|
\sa Compare(const BString &string) const
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn int BString::Compare(const BString &string, int32 n) const
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Lexographically compare a number of characters of this string to another.
|
|
|
|
|
|
|
|
\param string The string to compare to.
|
|
|
|
\param n The number of characters to compare
|
|
|
|
\retval >0 The object sorts lexographically after \c string.
|
|
|
|
\retval =0 The object is equal to \c string.
|
|
|
|
\retval <0 The object sorts lexographically before \c string.
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
2007-02-26 13:34:35 +03:00
|
|
|
\fn int BString::Compare(const char *str, int32 n) const
|
|
|
|
\brief Lexographically compare a number of characters of this string to another.
|
|
|
|
|
|
|
|
\sa Compare(const BString &string, int32 n) const
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn int BString::ICompare(const BString &string) const
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Lexographically compare this string to another in a case-insensitive way.
|
|
|
|
|
|
|
|
\sa Compare(const BString &string) const
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn int BString::ICompare(const char *str) const
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Lexographically compare this string to another in a case-insensitive way.
|
|
|
|
|
|
|
|
\sa Compare(const BString &string) const
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn int BString::ICompare(const BString &string, int32 n) const
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Lexographically compare a number of characters of this string to another.
|
|
|
|
|
|
|
|
\sa Compare(const BString &string, int32 n) const
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn int BString::ICompare(const char *str, int32 n) const
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Lexographically compare a number of characters of this string to another.
|
|
|
|
|
|
|
|
\sa Compare(const BString &string, int32 n) const
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
//! @}
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\name Searching Methods
|
|
|
|
*/
|
|
|
|
|
|
|
|
//! @{
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn int32 BString::FindFirst(const BString &string) const
|
|
|
|
\brief Find the first occurrence of the given BString.
|
|
|
|
\param string The BString to search for.
|
2007-02-26 13:34:35 +03:00
|
|
|
\return The offset(zero based) into the data
|
2006-12-29 03:26:34 +03:00
|
|
|
where the given BString has been found.
|
2007-02-26 13:34:35 +03:00
|
|
|
\retval B_ERROR Could not find \c string.
|
|
|
|
\sa IFindFirst(const BString &string) const
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
2007-02-26 13:34:35 +03:00
|
|
|
\fn int32 BString::FindFirst(const char *str) const
|
2006-12-29 03:26:34 +03:00
|
|
|
\brief Find the first occurrence of the given string.
|
2007-02-26 13:34:35 +03:00
|
|
|
\param str The string to search for.
|
2006-12-29 03:26:34 +03:00
|
|
|
\return The offset(zero based) into the data
|
|
|
|
where the given string has been found.
|
2007-02-26 13:34:35 +03:00
|
|
|
\retval B_BAD_VALUE The \c str pointer is invalid.
|
|
|
|
\retval B_ERROR Could not find \c str.
|
|
|
|
\sa IFindFirst(const char *str) const
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn int32 BString::FindFirst(const BString &string, int32 fromOffset) const
|
|
|
|
\brief Find the first occurrence of the given BString,
|
|
|
|
starting from the given offset.
|
|
|
|
\param string The BString to search for.
|
|
|
|
\param fromOffset The offset where to start the search.
|
|
|
|
\return An integer which is the offset(zero based) into the data
|
|
|
|
where the given BString has been found.
|
2007-02-26 13:34:35 +03:00
|
|
|
\retval B_ERROR Could not find \c string.
|
|
|
|
\sa IFindFirst(const BString &string, int32 fromOffset) const
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
2007-02-26 13:34:35 +03:00
|
|
|
\fn int32 BString::FindFirst(const char *str, int32 fromOffset) const
|
2006-12-29 03:26:34 +03:00
|
|
|
\brief Find the first occurrence of the given string,
|
|
|
|
starting from the given offset.
|
2007-02-26 13:34:35 +03:00
|
|
|
\param str The string to search for.
|
2006-12-29 03:26:34 +03:00
|
|
|
\param fromOffset The offset where to start the search.
|
|
|
|
\return The offset(zero based) into the data
|
|
|
|
where the given string has been found.
|
2007-02-26 13:34:35 +03:00
|
|
|
\retval B_BAD_VALUE The \c str pointer is invalid.
|
|
|
|
\retval B_ERROR Could not find \c str.
|
|
|
|
\sa IFindFirst(const char *str, int32 fromOffset) const
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn int32 BString::FindFirst(char c) const
|
|
|
|
\brief Find the first occurrence of the given character.
|
|
|
|
\param c The character to search for.
|
|
|
|
\return The offset(zero based) into the data
|
|
|
|
where the given character has been found.
|
2007-02-26 13:34:35 +03:00
|
|
|
\retval B_ERROR Could not find \c c.
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn int32 BString::FindFirst(char c, int32 fromOffset) const
|
|
|
|
\brief Find the first occurrence of the given character,
|
|
|
|
starting from the given offset.
|
|
|
|
\param c The character to search for.
|
|
|
|
\param fromOffset The offset where to start the search.
|
|
|
|
\return The offset(zero based) into the data
|
|
|
|
where the given character has been found.
|
2007-02-26 13:34:35 +03:00
|
|
|
\retval B_ERROR Could not find \c c.
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn int32 BString::FindLast(const BString &string) const
|
|
|
|
\brief Find the last occurrence of the given BString.
|
|
|
|
\param string The BString to search for.
|
|
|
|
\return The offset(zero based) into the data
|
|
|
|
where the given BString has been found.
|
2007-02-26 13:34:35 +03:00
|
|
|
\retval B_ERROR Could not find \c string.
|
|
|
|
\sa IFindLast(const BString &string) const
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
2007-02-26 13:34:35 +03:00
|
|
|
\fn int32 BString::FindLast(const char *str) const
|
2006-12-29 03:26:34 +03:00
|
|
|
\brief Find the last occurrence of the given string.
|
2007-02-26 13:34:35 +03:00
|
|
|
\param str The string to search for.
|
2006-12-29 03:26:34 +03:00
|
|
|
\return The offset(zero based) into the data
|
|
|
|
where the given string has been found.
|
2007-02-26 13:34:35 +03:00
|
|
|
\retval B_BAD_VALUE The \c str pointer is invalid.
|
|
|
|
\retval B_ERROR Could not find \c str.
|
|
|
|
\sa IFindLast(const char *str) const
|
2006-12-29 03:26:34 +03:00
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn int32 BString::FindLast(const BString &string, int32 beforeOffset) const
|
|
|
|
\brief Find the last occurrence of the given BString,
|
|
|
|
starting from the given offset, and going backwards.
|
|
|
|
\param string The BString to search for.
|
|
|
|
\param beforeOffset The offset where to start the search.
|
|
|
|
\return An integer which is the offset(zero based) into the data
|
|
|
|
where the given BString has been found.
|
2007-02-26 13:34:35 +03:00
|
|
|
\retval B_ERROR Could not find \c string.
|
|
|
|
\sa IFindLast(const BString &string, int32 beforeOffset) const
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
2007-02-26 13:34:35 +03:00
|
|
|
\fn int32 BString::FindLast(const char *str, int32 beforeOffset) const
|
2006-12-29 03:26:34 +03:00
|
|
|
\brief Find the last occurrence of the given string,
|
|
|
|
starting from the given offset, and going backwards.
|
2007-02-26 13:34:35 +03:00
|
|
|
\param str The string to search for.
|
2006-12-29 03:26:34 +03:00
|
|
|
\param beforeOffset The offset where to start the search.
|
|
|
|
\return The offset(zero based) into the data
|
|
|
|
where the given string has been found.
|
2007-02-26 13:34:35 +03:00
|
|
|
\retval B_BAD_VALUE The \c str pointer is invalid.
|
|
|
|
\retval B_ERROR Could not find \c str.
|
|
|
|
\sa IFindLast(const char *str, int32 beforeOffset) const
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn int32 BString::FindLast(char c) const
|
|
|
|
\brief Find the last occurrence of the given character.
|
|
|
|
\param c The character to search for.
|
|
|
|
\return The offset(zero based) into the data
|
|
|
|
where the given character has been found.
|
2007-02-26 13:34:35 +03:00
|
|
|
\retval B_ERROR Could not find \c c.
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn int32 BString::FindLast(char c, int32 beforeOffset) const
|
|
|
|
\brief Find the last occurrence of the given character,
|
|
|
|
starting from the given offset and going backwards.
|
|
|
|
\param c The character to search for.
|
|
|
|
\param beforeOffset The offset where to start the search.
|
|
|
|
\return The offset(zero based) into the data
|
|
|
|
where the given character has been found.
|
2007-02-26 13:34:35 +03:00
|
|
|
\retval B_ERROR Could not find \c c.
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn int32 BString::IFindFirst(const BString &string) const
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Find the first occurrence of the given BString case-insensitively.
|
|
|
|
|
|
|
|
\sa FindFirst(const BString &string) const
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
2007-02-26 13:34:35 +03:00
|
|
|
\fn int32 BString::IFindFirst(const char *str) const
|
|
|
|
\brief Find the first occurrence of the given BString case-insensitively.
|
|
|
|
|
|
|
|
\sa FindFirst(const char *str) const
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn int32 BString::IFindFirst(const BString &string, int32 fromOffset) const
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Find the first occurrence of the given BString case-insensitively,
|
|
|
|
starting from the given offset.
|
|
|
|
|
|
|
|
\sa FindFirst(const BString &string, int32 fromOffset) const
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
2007-02-26 13:34:35 +03:00
|
|
|
\fn int32 BString::IFindFirst(const char *str, int32 fromOffset) const
|
|
|
|
\brief Find the first occurrence of the given string case-insensitively,
|
|
|
|
starting from the given offset.
|
|
|
|
|
|
|
|
\sa FindFirst(const char *str, int32 fromOffset) const
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn int32 BString::IFindLast(const BString &string) const
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Find the last occurrence of the given BString case-insensitively.
|
|
|
|
|
|
|
|
\sa FindLast(const BString &string) const
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
2007-02-26 13:34:35 +03:00
|
|
|
\fn int32 BString::IFindLast(const char *str) const
|
|
|
|
\brief Find the last occurrence of the given string case-insensitively.
|
|
|
|
|
|
|
|
\sa FindLast(const char *str) const
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn int32 BString::IFindLast(const BString &string, int32 beforeOffset) const
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Find the last occurrence of the given BString case-insensitively,
|
|
|
|
starting from the given offset, and going backwards.
|
|
|
|
|
|
|
|
\sa FindLast(const BString &string, int32 beforeOffset) const
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
2007-02-26 13:34:35 +03:00
|
|
|
\fn int32 BString::IFindLast(const char *str, int32 beforeOffset) const
|
|
|
|
\brief Find the last occurrence of the given string case-insensitively,
|
|
|
|
starting from the given offset, and going backwards.
|
|
|
|
|
|
|
|
\sa FindLast(const char *str, int32 beforeOffset) const
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
//! @}
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\name Replacing Methods
|
|
|
|
*/
|
|
|
|
|
|
|
|
//! @{
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::ReplaceFirst(char replaceThis, char withThis)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Replace the first occurance of a character with another character.
|
|
|
|
\param replaceThis The character to replace.
|
|
|
|
\param withThis The character to put in that place
|
|
|
|
\return This method always returns \c *this.
|
|
|
|
\sa IReplaceFirst(char replaceThis, char withThis)
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::ReplaceLast(char replaceThis, char withThis)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Replace the last occurance of a character with another character.
|
|
|
|
\param replaceThis The character to replace.
|
|
|
|
\param withThis The character to put in that place
|
|
|
|
\return This method always returns \c *this.
|
|
|
|
\sa ReplaceLast(char replaceThis, char withThis)
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::ReplaceAll(char replaceThis, char withThis, int32 fromOffset)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Replace all occurances of a character with another character.
|
|
|
|
\param replaceThis The character to replace.
|
|
|
|
\param withThis The character to put in that place
|
|
|
|
\param fromOffset The offset where to start looking for the character
|
|
|
|
\return This method always returns \c *this.
|
|
|
|
\sa IReplaceAll(char replaceThis, char withThis, int32 fromOffset)
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::Replace(char replaceThis, char withThis, int32 maxReplaceCount, int32 fromOffset)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Replace a number of occurances of a character with another character.
|
|
|
|
\param replaceThis The character to replace.
|
|
|
|
\param withThis The character to put in that place
|
|
|
|
\param maxReplaceCount The maximum number of characters that should be replaced.
|
|
|
|
\param fromOffset The offset where to start looking for the character
|
|
|
|
\return This method always returns \c *this.
|
|
|
|
\sa IReplace(char replaceThis, char withThis, int32 maxReplaceCount, int32 fromOffset)
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::ReplaceFirst(const char *replaceThis, const char *withThis)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Replace the first occurance of a string with another string.
|
|
|
|
\param replaceThis The C-string to replace.
|
|
|
|
\param withThis The C-string to put in that place
|
|
|
|
\return This method always returns \c *this.
|
|
|
|
\sa IReplaceFirst(const char *replaceThis, const char *withThis)
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::ReplaceLast(const char *replaceThis, const char *withThis)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Replace the last occurance of a string with another string.
|
|
|
|
\param replaceThis The C-string to replace.
|
|
|
|
\param withThis The C-string to put in that place
|
|
|
|
\return This method always returns \c *this.
|
|
|
|
\sa IReplaceLast(const char *replaceThis, const char *withThis)
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::ReplaceAll(const char *replaceThis, const char *withThis, int32 fromOffset)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Replace all occurances of a string with another string.
|
|
|
|
\param replaceThis The string to replace.
|
|
|
|
\param withThis The string to put in that place
|
|
|
|
\param fromOffset The offset where to start looking for the string.
|
|
|
|
\return This method always returns \c *this.
|
|
|
|
\sa IReplaceAll(const char *replaceThis, const char *withThis, int32 fromOffset)
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::Replace(const char *replaceThis, const char *withThis, int32 maxReplaceCount, int32 fromOffset)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Replace a number of occurances of a string with another string.
|
|
|
|
\param replaceThis The string to replace.
|
|
|
|
\param withThis The string to put in that place
|
|
|
|
\param maxReplaceCount The maximum number of occurences that should be replaced.
|
|
|
|
\param fromOffset The offset where to start looking for the string
|
|
|
|
\return This method always returns \c *this.
|
|
|
|
\sa IReplace(const char *replaceThis, const char *withThis, int32 maxReplaceCount, int32 fromOffset)
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::IReplaceFirst(char replaceThis, char withThis)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Replace the first occurance of a character with another character. Case insensitive.
|
|
|
|
\sa ReplaceFirst(char replaceThis, char withThis)
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::IReplaceLast(char replaceThis, char withThis)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Replace the last occurance of a character with another character. Case-insensitive.
|
|
|
|
|
|
|
|
\sa ReplaceLast(char replaceThis, char withThis)
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::IReplaceAll(char replaceThis, char withThis, int32 fromOffset)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Replace all occurances of a character with another character. Case-insensitive.
|
|
|
|
|
|
|
|
\sa ReplaceAll(char replaceThis, char withThis, int32 fromOffset)
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::IReplace(char replaceThis, char withThis, int32 maxReplaceCount, int32 fromOffset)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Replace a number of occurances of a character with another character. Case-insensive.
|
|
|
|
|
|
|
|
\sa Replace(char replaceThis, char withThis, int32 maxReplaceCount, int32 fromOffset)
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::IReplaceFirst(const char *replaceThis, const char *withThis)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Replace the first occurance of a string with another string. Case-insensitive.
|
|
|
|
|
|
|
|
\sa ReplaceFirst(const char *replaceThis, const char *withThis)
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::IReplaceLast(const char *replaceThis, const char *withThis)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Replace the last occurance of a string with another string. Case-insensitive.
|
|
|
|
|
|
|
|
\sa ReplaceLast(const char *replaceThis, const char *withThis)
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::IReplaceAll(const char *replaceThis, const char *withThis, int32 fromOffset)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Replace all occurances of a string with another string. Case-insensitive.
|
|
|
|
|
|
|
|
\sa ReplaceAll(const char *replaceThis, const char *withThis, int32 fromOffset)
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::IReplace(const char *replaceThis, const char *withThis, int32 maxReplaceCount, int32 fromOffset)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Replace a number of occurances of a string with another string. Case-insensitive.
|
|
|
|
|
|
|
|
\sa Replace(const char *replaceThis, const char *withThis, int32 maxReplaceCount, int32 fromOffset)
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::ReplaceSet(const char *setOfChars, char with)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Replaces characters that are in a certain set with a chosen character.
|
|
|
|
\param setOfChars The set of characters that need to be replaced.
|
|
|
|
\param with The character to replace the occurences with.
|
|
|
|
\return This method always returns \c *this.
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::ReplaceSet(const char *setOfChars, const char *with)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Replaces characters that are in a certain set with a chosen string.
|
|
|
|
\param setOfChars The set of characters that need to be replaced.
|
|
|
|
\param with The string to replace the occurences with.
|
|
|
|
\return This method always returns \c *this.
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
// @}
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\name Character Access
|
|
|
|
*/
|
|
|
|
|
|
|
|
//! @{
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn char & BString::operator[](int32 index)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Return a reference to the data at the given offset.
|
2006-12-29 03:26:34 +03:00
|
|
|
|
2007-02-26 13:34:35 +03:00
|
|
|
This function can be used to read a byte.
|
2006-12-29 03:26:34 +03:00
|
|
|
There is no bounds checking though, so make sure the \c index
|
|
|
|
you supply is valid.
|
|
|
|
\param index The index (zero based) of the byte to get.
|
|
|
|
\return Returns a reference to the specified byte.
|
2007-02-26 13:34:35 +03:00
|
|
|
\sa ByteAt(int32 index) for a safer version.
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn char BString::operator[](int32 index) const
|
|
|
|
\brief Returns the character in the string at the given offset.
|
|
|
|
|
|
|
|
This function can be used to read a byte. There is no bound checking
|
|
|
|
though, use ByteAt() if you don't know if the \c index parameter is
|
|
|
|
valid.
|
|
|
|
\param index The index (zero based) of the byte to get.
|
|
|
|
\return Returns a reference to the specified byte.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn char BString::ByteAt(int32 index) const
|
|
|
|
\brief Returns the character in the string at the given offset.
|
|
|
|
|
|
|
|
This function can be used to read a byte.
|
|
|
|
\param index The index (zero based) of the byte to get.
|
2007-02-26 13:34:35 +03:00
|
|
|
\return Returns a reference to the specified byte. If you are out of bounds,
|
|
|
|
it will return 0.
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
//! @}
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\name Low-Level Manipulation
|
|
|
|
*/
|
|
|
|
|
|
|
|
//! @{
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn char* BString::LockBuffer(int32 maxLength)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Locks the buffer and return the internal C-string for manipulation.
|
|
|
|
|
|
|
|
If you want to do any lowlevel string manipulation on the internal buffer,
|
|
|
|
you should call this method. This method includes the possibility to grow the
|
|
|
|
buffer so that you don't have to worry about that yourself.
|
|
|
|
|
|
|
|
Make sure you call UnlockBuffer() when you're done with the manipulation.
|
|
|
|
|
|
|
|
\param maxLength The size of the buffer. If you don't want a bigger buffer, passing
|
|
|
|
anything under the length of the string will simply return it as is.
|
|
|
|
\return A pointer to the buffer you may manipulate.
|
|
|
|
\sa UnlockBuffer()
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::UnlockBuffer(int32 length)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Unlocks the buffer after you are done with lowlevel manipulation.
|
|
|
|
|
|
|
|
\param length The length to trim the string to in order to keep the internal
|
|
|
|
buffer sane. If you don't pass a value in it, a \c strlen call will be used to
|
|
|
|
determine the length.
|
|
|
|
\return This method always returns \c *this.
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
//! @}
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\name Case Manipulation
|
|
|
|
*/
|
|
|
|
|
|
|
|
//! @{
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::ToLower()
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Convert the BString to lowercase.
|
|
|
|
\return This method always returns \c *this .
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::ToUpper()
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Convert the BString to uppercase.
|
|
|
|
\return This method always returns \c *this .
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::Capitalize()
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Convert the first character to uppercase, rest to lowercase
|
|
|
|
\return This method always returns \c *this .
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::CapitalizeEachWord()
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Convert the first character of every word to uppercase, rest to lowercase.
|
2006-12-29 03:26:34 +03:00
|
|
|
|
|
|
|
Converts the first character of every "word" (series of alpabetical characters
|
|
|
|
separated by non alphabetical characters) to uppercase, and the rest to lowercase.
|
2007-02-26 13:34:35 +03:00
|
|
|
\return This method always returns \c *this .
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
//! @}
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\name Escaping and Deescaping Methods
|
2007-02-26 13:34:35 +03:00
|
|
|
|
|
|
|
This class contains some methods to help you with escaping and de-escaping
|
|
|
|
certain characters. Note that this is the C-style of escaping, where you place a character
|
|
|
|
before the character that is to be escaped, and not HTML style escaping,
|
|
|
|
where certain characters are replaced by something else.
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
//! @{
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::CharacterEscape(const char *original, const char *setOfCharsToEscape, char escapeWith)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Escape selected characters on a given string.
|
|
|
|
|
|
|
|
This version sets itself to the string supplied in the \c original paramater, and
|
|
|
|
then escapes the selected characters with a supplied character.
|
|
|
|
|
|
|
|
\param original The string to be escaped.
|
|
|
|
\param setOfCharsToEscape The set of characters that need to be escaped.
|
|
|
|
\param escapeWith The character to escape with.
|
|
|
|
\return This method always returns \c *this.
|
|
|
|
\sa CharacterDeescape(char escapeChar)
|
|
|
|
\sa CharacterDeescape(const char *original, char escapeChar)
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::CharacterEscape(const char *setOfCharsToEscape, char escapeWith)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Escape selected characters of this string.
|
|
|
|
\param setOfCharsToEscape The set of characters that need to be escaped.
|
|
|
|
\param escapeWith The character to escape with.
|
|
|
|
\return This method always returns \c *this.
|
|
|
|
\sa CharacterDeescape(char escapeChar)
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::CharacterDeescape(const char *original, char escapeChar)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Remove the character to escape with from a given string.
|
|
|
|
|
|
|
|
This version sets itself to the string supplied in the \c original parameter, and
|
|
|
|
then removes the escape characters.
|
|
|
|
|
|
|
|
\param original The string to be escaped.
|
|
|
|
\param escapeChar The character that was used to escape with.
|
|
|
|
\return This method always returns \c *this.
|
|
|
|
\sa CharacterEscape(const char *original, const char *setOfCharsToEscape, char escapeWith)
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::CharacterDeescape(char escapeChar)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Remove the character to escape with from this string.
|
|
|
|
\param escapeChar The character that was used to escape with.
|
|
|
|
\return This method always returns \c *this.
|
|
|
|
\sa CharacterEscape(const char *setOfCharsToEscape, char escapeWith)
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
//! @}
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\name Simple sprintf Replacement Methods
|
|
|
|
|
|
|
|
These methods may be slower than sprintf(), but they are overflow safe.
|
|
|
|
*/
|
|
|
|
|
|
|
|
//! @{
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::operator<<(const char *str)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Append the string \c str to the object.
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::operator<<(const BString &string)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Append the string \c string to the object.
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::operator<<(char c)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Append the character \c c to the object.
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::operator<<(int i)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Convert the integer \c i to a string and append it to the object.
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::operator<<(unsigned int i)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Convert the unsigned integer \c i to a string and append it to the object.
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::operator<<(uint32 i)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Convert the unsigned integer \c i to a string and append it to the object.
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::operator<<(int32 i)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Convert the integer \c i to a string and append it to the object.
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::operator<<(uint64 i)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Convert the unsigned integer \c i to a string and append it to the object.
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::operator<<(int64 i)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Convert the integer \c i to a string and append it to the object.
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BString& BString::operator<<(float f)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Convert the float \c f to a string and append it to the object.
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
//! @}
|
|
|
|
|
|
|
|
/************************ end of class BString, start of general operators ************/
|
2007-02-26 13:34:35 +03:00
|
|
|
/*!
|
|
|
|
\addtogroup support_globals
|
|
|
|
@{
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2006-12-29 03:26:34 +03:00
|
|
|
/*!
|
2007-03-02 16:36:32 +03:00
|
|
|
\fn bool operator<(const char *a, const BString &b)
|
|
|
|
\brief Lexographically compare if \c a is less than a given BString.
|
|
|
|
|
|
|
|
From String.h and in libbe.so.
|
|
|
|
|
2007-02-26 13:34:35 +03:00
|
|
|
\sa BString::operator<(const char *string) const
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
2007-03-02 16:36:32 +03:00
|
|
|
\fn bool operator<=(const char *a, const BString &b)
|
|
|
|
\brief Lexographically compare if \c a is less than or equal to a given BString.
|
|
|
|
|
|
|
|
From String.h and in libbe.so.
|
|
|
|
|
2007-02-26 13:34:35 +03:00
|
|
|
\sa BString::operator<=(const char *string) const
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
2007-03-02 16:36:32 +03:00
|
|
|
\fn bool operator==(const char *a, const BString &b)
|
|
|
|
\brief Lexographically compare if \c a is equal to a given BString.
|
|
|
|
|
|
|
|
From String.h and in libbe.so.
|
|
|
|
|
2007-02-26 13:34:35 +03:00
|
|
|
\sa BString::operator==(const char *string) const
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
2007-03-02 16:36:32 +03:00
|
|
|
\fn bool operator>(const char *a, const BString &b)
|
|
|
|
\brief Lexographically compare if \c a is more than a given BString.
|
|
|
|
|
|
|
|
From String.h and in libbe.so.
|
|
|
|
|
2007-02-26 13:34:35 +03:00
|
|
|
\sa BString::operator>(const char *string) const
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
2007-03-02 16:36:32 +03:00
|
|
|
\fn bool operator>=(const char *a, const BString &b)
|
|
|
|
\brief Lexographically compare if \c a is more than or equal to a given BString.
|
|
|
|
|
|
|
|
From String.h and in libbe.so.
|
|
|
|
|
2007-02-26 13:34:35 +03:00
|
|
|
\sa BString::operator>=(const char *string) const
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
2007-03-02 16:36:32 +03:00
|
|
|
\fn bool operator!=(const char *a, const BString &b)
|
|
|
|
\brief Lexographically compare if \c a is not equal to given BString.
|
|
|
|
|
|
|
|
From String.h and in libbe.so.
|
|
|
|
|
2007-02-26 13:34:35 +03:00
|
|
|
\sa BString::operator!=(const char *string) const
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn int Compare(const BString &, const BString &)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Lexographically compare two strings.
|
|
|
|
|
|
|
|
This function is useful if you need a global compare function to feed to
|
|
|
|
BList::SortItems() for example.
|
|
|
|
|
2007-03-02 16:36:32 +03:00
|
|
|
From String.h and in libbe.so.
|
|
|
|
|
2007-02-26 13:34:35 +03:00
|
|
|
\sa BString::Compare(const BString &string) const
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn int ICompare(const BString &, const BString &)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Lexographically compare two strings in a case insensitive way.
|
|
|
|
|
|
|
|
This function is useful if you need a global compare function to feed to
|
|
|
|
BList::SortItems() for example.
|
|
|
|
|
2007-03-02 16:36:32 +03:00
|
|
|
From String.h and in libbe.so.
|
|
|
|
|
2007-02-26 13:34:35 +03:00
|
|
|
\sa BString::Compare(const BString &string) const
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn int Compare(const BString *, const BString *)
|
2007-02-26 13:34:35 +03:00
|
|
|
\brief Lexographically compare two strings.
|
|
|
|
|
|
|
|
This function is useful if you need a global compare function to feed to
|
|
|
|
BList::SortItems() for example.
|
|
|
|
|
2007-03-02 16:36:32 +03:00
|
|
|
From String.h and in libbe.so.
|
|
|
|
|
2007-02-26 13:34:35 +03:00
|
|
|
\sa BString::Compare(const BString &string) const
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn int ICompare(const BString *, const BString *)
|
2007-03-02 16:36:32 +03:00
|
|
|
\brief Lexographically compare two strings in a case insensitive way.
|
2007-02-26 13:34:35 +03:00
|
|
|
|
|
|
|
This function is useful if you need a global compare function to feed to
|
|
|
|
BList::SortItems() for example.
|
|
|
|
|
2007-03-02 16:36:32 +03:00
|
|
|
From String.h and in libbe.so.
|
|
|
|
|
2007-02-26 13:34:35 +03:00
|
|
|
\sa BString::Compare(const BString &string) const
|
2006-12-29 03:26:34 +03:00
|
|
|
*/
|
2007-02-26 13:34:35 +03:00
|
|
|
|
|
|
|
//! @}
|