haiku/docs/user/support/string.dox
Niels Sascha Reedijk 089b7ad4c6 Some more work on the Doxygen version of the haiku_book.
I will keep working on the Docbook version, but as I'm still not completely comfortable with that as final choice, I'm playing around with this as well.

The String.cpp file contained doxygen documentation for almost all methods, I copied those to a new file (string.dox) and grouped them accordingly. (Done because Axel is absolutely against in-header or in-source docs)

Integrated the BMidiConsumer and BMidiLocalConsumer class into the same file (like I did now to the producers), since I think it's better to keep a 1:1 relation with the headers. 

Removed the mididefs.dox file and replaced it with the midi2/Midi2Defs.dox file which actually documents the Midi2Defs.h file, rather than contain a custom page that was somewhat hard to find.

Please see http://www.myhouserules.nl/haiku_book/index.html for a generated book from the current source. I actually quite like the output so far, though I'm aware of the fact that I needed to perform some tricks to let Doxygen get to this point.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19651 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-12-29 00:26:34 +00:00

996 lines
24 KiB
Plaintext

/*!
\file String.h
\ingroup libbe
\ingroup support
\brief Implements the BString class.
*/
/*!
\class BString
\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\>
*/
/*!
\var char* BString::_privateData
\brief BString's storage for data
*/
/*!
\fn BString::BString()
\brief Creates an uninitialized BString.
*/
/*!
\fn BString::BString(const char* str)
\brief Creates a BString and initializes it to the given string.
\param str Pointer to a NULL terminated string.
*/
/*!
\fn BString::BString(const BString &string)
\brief Creates a BString and makes it a copy of the supplied one.
\param string the BString object to be copied.
*/
/*!
\fn BString::BString(const char *str, int32 maxLength)
\brief Creates a BString and initializes it to the given string.
\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()
\brief Frees all resources associated with the object.
Frees the memory allocated by the BString object.
*/
/*!
\name Access Methods
*/
//! @{
/*!
\fn const char* BString::String() const
\brief Returns a pointer to the object string, NULL terminated.
Returns a pointer to the object string, guaranteed to be NULL
terminated. You can't modify or free the pointer. Once the BString
object is deleted, the pointer becomes invalid.
\return A pointer to the object string.
*/
/*!
\fn int32 BString::Length() const
\brief Returns the length of the string, measured in bytes.
\return The length of the string, measured in bytes.
*/
/*!
\fn int32 BString::CountChars() const
\brief Returns the length of the object measured in characters.
Counts the number of UTF8 characters contained in the string.
\return An integer which is the number of characters in the string.
*/
//! @}
/*!
\name Assignment Methods
*/
//! @{
/*!
\fn BString& BString::operator=(const BString &string)
\brief Makes a copy of the given BString object.
\param string The string object to copy.
\return The function always returns \c *this .
*/
/*!
\fn BString& BString::operator=(const char *str)
\brief Re-initializes the object to the given string.
\param str Pointer to a string.
\return The function always returns \c *this .
*/
/*!
\fn BString& BString::operator=(char c)
\brief Re-initializes the object to the given character.
\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)
\brief Re-initializes the object to the given string.
\param str Pointer to a string.
\param maxLength Amount of characters to copy from the original string.
\return The function always returns \c *this .
*/
/*!
\fn BString& BString::SetTo(const BString &from)
\brief Makes a copy of the given BString object.
\param from The string object to copy.
\return The function always returns \c *this .
*/
/*!
\fn BString& BString::Adopt(BString &from)
\brief Adopt's data of the given BString object, freeing the original object.
\param from The string object to adopt.
\return The function always returns \c *this .
*/
/*!
\fn BString& BString::SetTo(const BString &string, int32 length)
\brief Makes a copy of the given BString object.
\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 .
*/
/*!
\fn BString& BString::Adopt(BString &from, int32 length)
\brief Adopt's data of the given BString object, freeing the original object.
\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 .
*/
/*!
\fn BString& BString::SetTo(char c, int32 count)
\brief Initializes the object to a string composed by a character you specify.
\param c The character you want to initialize the BString.
\param count The number of characters you want the BString to be composed by.
\return The function always returns \c *this .
*/
/*!
\fn BString &BString::SetTo(const char *str)
*/
//! @}
/*!
\name Substring Copying
*/
//! @{
/*!
\fn BString &BString::CopyInto(BString &into, int32 fromOffset, int32 length) const
\brief Copy the BString data (or part of it) into another BString.
\param into The BString where to copy the object.
\param fromOffset The offset (zero based) where to begin the copy
\param length The amount of bytes to copy.
\return This function always returns *this .
*/
/*!
\fn void BString::CopyInto(char *into, int32 fromOffset, int32 length) const
\brief Copy the BString data (or part of it) into the supplied buffer.
\param into The buffer where to copy the object.
\param fromOffset The offset (zero based) where to begin the copy
\param length The amount of bytes to copy.
*/
//! @}
/*!
\name Appending Methods
*/
//! @{
/*!
\fn BString& BString::operator+=(const char *str)
\brief Appends the given string to the object.
\param str A pointer to the string to append.
\return This function always returns *this .
*/
/*!
\fn BString& BString::operator+=(char c)
\brief Appends the given character to the object.
\param c The character to append.
\return This function always returns *this .
*/
/*!
\fn BString & BString::operator+=(const BString &string)
*/
/*!
\fn BString &BString::Append(const BString &string)
*/
/*!
\fn BString &BString::Append(const char *str)
*/
/*!
\fn BString& BString::Append(const BString &string, int32 length)
\brief Appends the given BString to the object.
\param string The BString to append.
\param length The maximum bytes to get from the original object.
\return This function always returns *this .
*/
/*!
\fn BString& BString::Append(const char *str, int32 length)
\brief Appends the given string to the object.
\param str A pointer to the string to append.
\param length The maximum bytes to get from the original string.
\return This function always returns *this .
*/
/*!
\fn BString& BString::Append(char c, int32 count)
\brief Appends the given character to the object.
\param c The character to append.
\param count The number of characters to append.
\return This function always returns *this .
*/
//! @}
/*!
\name Prepending Methods
*/
//! @{
/*!
\fn BString& BString::Prepend(const char *str)
\brief Prepends the given string to the object.
\param str A pointer to the string to prepend.
\return This function always returns *this .
*/
/*!
\fn BString& BString::Prepend(const BString &string)
\brief Prepends the given BString to the object.
\param string The BString object to prepend.
\return This function always returns *this .
*/
/*!
\fn BString& BString::Prepend(const char *str, int32 length)
\brief Prepends the given string to the object.
\param str A pointer to the string to prepend.
\param length The maximum amount of bytes to get from the string.
\return This function always returns *this .
*/
/*!
\fn BString& BString::Prepend(const BString &string, int32 len)
\brief Prepends the given BString to the object.
\param string The BString object to prepend.
\param len The maximum amount of bytes to get from the BString.
\return This function always returns *this .
*/
/*!
\fn BString& BString::Prepend(char c, int32 count)
\brief Prepends the given character to the object.
\param c The character to prepend.
\param count The amount of characters to prepend.
\return This function always returns *this .
*/
//! @}
/*!
\name Inserting Methods
*/
//! @{
/*!
\fn BString& BString::Insert(const char *str, 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 pos The offset into the BString's data where to insert the string.
\return This function always returns *this .
*/
/*!
\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.
\param pos The offset into the BString's data where to insert the string.
\return This function always returns *this .
*/
/*!
\fn BString& BString::Insert(const char *str, int32 fromOffset, 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 fromOffset
\param length The amount of bytes to insert.
\param pos The offset into the BString's data where to insert the string.
\return This function always returns *this .
*/
/*!
\fn BString& BString::Insert(const BString &string, int32 pos)
\brief Inserts the given BString at the given position into the object's data.
\param string The BString object to insert.
\param pos The offset into the BString's data where to insert the string.
\return This function always returns *this .
*/
/*!
\fn BString& BString::Insert(const BString &string, int32 length, int32 pos)
\brief Inserts the given BString at the given position into the object's data.
\param string The BString object to insert.
\param length The amount of bytes to insert.
\param pos The offset into the BString's data where to insert the string.
\return This function always returns *this .
*/
/*!
\fn BString& BString::Insert(const BString &string, int32 fromOffset, int32 length, int32 pos)
\brief Inserts the given string at the given position into the object's data.
\param string The BString object to insert.
\param fromOffset
\param length The amount of bytes to insert.
\param pos The offset into the BString's data where to insert the string.
\return This function always returns *this .
*/
/*!
\fn BString& BString::Insert(char c, int32 count, int32 pos)
\brief Inserts the given character at the given position into the object's data.
\param c The character to insert.
\param count The amount of bytes to insert.
\param pos The offset into the BString's data where to insert the string.
\return This function always returns *this .
*/
//! @}
/*!
\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
\return This function always returns *this .
*/
/*!
\fn BString& BString::Remove(int32 from, int32 length)
\brief Removes some bytes, starting at the given offset
\param from The offset from which you want to start removing
\param length The number of bytes to remove
\return This function always returns *this .
*/
/*!
\fn BString& BString::RemoveFirst(const BString &string)
\brief Removes the first occurrence of the given BString.
\param string The BString to remove.
\return This function always returns *this .
*/
/*!
\fn BString& BString::RemoveLast(const BString &string)
\brief Removes the last occurrence of the given BString.
\param string The BString to remove.
\return This function always returns *this .
*/
/*!
\fn BString& BString::RemoveAll(const BString &string)
\brief Removes all occurrences of the given BString.
\param string The BString to remove.
\return This function always returns *this .
*/
/*!
\fn BString& BString::RemoveFirst(const char *string)
\brief Removes the first occurrence of the given string.
\param string A pointer to the string to remove.
\return This function always returns *this .
*/
/*!
\fn BString& BString::RemoveLast(const char *string)
\brief Removes the last occurrence of the given string.
\param string A pointer to the string to remove.
\return This function always returns *this .
*/
/*!
\fn BString& BString::RemoveAll(const char *str)
\brief Removes all occurrences of the given string.
\param str A pointer to the string to remove.
\return This function always returns *this .
*/
/*!
\fn BString& BString::RemoveSet(const char *setOfCharsToRemove)
\brief Removes all the characters specified.
\param setOfCharsToRemove The set of characters to remove.
\return This function always returns *this .
*/
/*!
\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.
\return This function always returns into.
*/
/*!
\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.
\param from The offset (zero based) where to begin the move
\param length The amount of bytes to move.
*/
//! @}
/*!
\name Comparison Methods
*/
//! @{
/*!
\fn bool BString::operator<(const char *string) const
*/
/*!
\fn bool BString::operator<(const BString &string) const
*/
/*!
\fn bool BString::operator<=(const char *string) const
*/
/*!
\fn bool BString::operator<=(const BString &string) const
*/
/*!
\fn bool BString::operator==(const char *string) const
*/
/*!
\fn bool BString::operator==(const BString &string) const
*/
/*!
\fn bool BString::operator>=(const char *string) const
*/
/*!
\fn bool BString::operator>=(const BString &string) const
*/
/*!
\fn bool BString::operator>(const char *string) const
*/
/*!
\fn bool BString::operator>(const BString &string) const
*/
/*!
\fn bool BString::operator!=(const BString &string) const
*/
/*!
\fn bool BString::operator!=(const char *str) const
*/
/*!
\fn int BString::Compare(const BString &string) const
*/
/*!
\fn int BString::Compare(const char *string) const
*/
/*!
\fn int BString::Compare(const BString &string, int32 n) const
*/
/*!
\fn int BString::Compare(const char *string, int32 n) const
*/
/*!
\fn int BString::ICompare(const BString &string) const
*/
/*!
\fn int BString::ICompare(const char *str) const
*/
/*!
\fn int BString::ICompare(const BString &string, int32 n) const
*/
/*!
\fn int BString::ICompare(const char *str, int32 n) const
*/
//! @}
/*!
\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.
\return The offset(zero based) into the data
where the given BString has been found.
*/
/*!
\fn int32 BString::FindFirst(const char *string) const
\brief Find the first occurrence of the given string.
\param string The string to search for.
\return The offset(zero based) into the data
where the given string has been found.
*/
/*!
\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.
*/
/*!
\fn int32 BString::FindFirst(const char *string, int32 fromOffset) const
\brief Find the first occurrence of the given string,
starting from the given offset.
\param string The string to search for.
\param fromOffset The offset where to start the search.
\return The offset(zero based) into the data
where the given string has been found.
*/
/*!
\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.
*/
/*!
\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.
*/
/*!
\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.
*/
/*!
\fn int32 BString::FindLast(const char *string) const
\brief Find the last occurrence of the given string.
\param string The string to search for.
\return The offset(zero based) into the data
where the given string has been found.
*/
/*!
\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.
*/
/*!
\fn int32 BString::FindLast(const char *string, int32 beforeOffset) const
\brief Find the last occurrence of the given string,
starting from the given offset, and going backwards.
\param string The string to search for.
\param beforeOffset The offset where to start the search.
\return The offset(zero based) into the data
where the given string has been found.
*/
/*!
\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.
*/
/*!
\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.
*/
/*!
\fn int32 BString::IFindFirst(const BString &string) const
*/
/*!
\fn int32 BString::IFindFirst(const char *string) const
*/
/*!
\fn int32 BString::IFindFirst(const BString &string, int32 fromOffset) const
*/
/*!
\fn int32 BString::IFindFirst(const char *string, int32 fromOffset) const
*/
/*!
\fn int32 BString::IFindLast(const BString &string) const
*/
/*!
\fn int32 BString::IFindLast(const char *string) const
*/
/*!
\fn int32 BString::IFindLast(const BString &string, int32 beforeOffset) const
*/
/*!
\fn int32 BString::IFindLast(const char *string, int32 beforeOffset) const
*/
//! @}
/*!
\name Replacing Methods
*/
//! @{
/*!
\fn BString& BString::ReplaceFirst(char replaceThis, char withThis)
*/
/*!
\fn BString& BString::ReplaceLast(char replaceThis, char withThis)
*/
/*!
\fn BString& BString::ReplaceAll(char replaceThis, char withThis, int32 fromOffset)
*/
/*!
\fn BString& BString::Replace(char replaceThis, char withThis, int32 maxReplaceCount, int32 fromOffset)
*/
/*!
\fn BString& BString::ReplaceFirst(const char *replaceThis, const char *withThis)
*/
/*!
\fn BString& BString::ReplaceLast(const char *replaceThis, const char *withThis)
*/
/*!
\fn BString& BString::ReplaceAll(const char *replaceThis, const char *withThis, int32 fromOffset)
*/
/*!
\fn BString& BString::Replace(const char *replaceThis, const char *withThis, int32 maxReplaceCount, int32 fromOffset)
*/
/*!
\fn BString& BString::IReplaceFirst(char replaceThis, char withThis)
*/
/*!
\fn BString& BString::IReplaceLast(char replaceThis, char withThis)
*/
/*!
\fn BString& BString::IReplaceAll(char replaceThis, char withThis, int32 fromOffset)
*/
/*!
\fn BString& BString::IReplace(char replaceThis, char withThis, int32 maxReplaceCount, int32 fromOffset)
*/
/*!
\fn BString& BString::IReplaceFirst(const char *replaceThis, const char *withThis)
*/
/*!
\fn BString& BString::IReplaceLast(const char *replaceThis, const char *withThis)
*/
/*!
\fn BString& BString::IReplaceAll(const char *replaceThis, const char *withThis, int32 fromOffset)
*/
/*!
\fn BString& BString::IReplace(const char *replaceThis, const char *withThis, int32 maxReplaceCount, int32 fromOffset)
*/
/*!
\fn BString& BString::ReplaceSet(const char *setOfChars, char with)
*/
/*!
\fn BString& BString::ReplaceSet(const char *setOfChars, const char *with)
*/
// @}
/*!
\name Character Access
*/
//! @{
/*!
\fn char & BString::operator[](int32 index)
\brief Returns a reference to the data at the given offset.
This function can be used to read a byte or to change its value.
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.
*/
/*!
\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.
\return Returns a reference to the specified byte.
*/
//! @}
/*!
\name Low-Level Manipulation
*/
//! @{
/*!
\fn char* BString::LockBuffer(int32 maxLength)
*/
/*!
\fn BString& BString::UnlockBuffer(int32 length)
*/
//! @}
/*!
\name Case Manipulation
*/
//! @{
/*!
\fn BString& BString::ToLower()
\brief Converts the BString to lowercase
\return This function always returns *this .
*/
/*!
\fn BString& BString::ToUpper()
\brief Converts the BString to uppercase
\return This function always returns *this .
*/
/*!
\fn BString& BString::Capitalize()
\brief Converts the first character to uppercase, rest to lowercase
\return This function always returns *this .
*/
/*!
\fn BString& BString::CapitalizeEachWord()
\brief Converts the first character of every word to uppercase, rest to lowercase.
Converts the first character of every "word" (series of alpabetical characters
separated by non alphabetical characters) to uppercase, and the rest to lowercase.
\return This function always returns *this .
*/
//! @}
/*!
\name Escaping and Deescaping Methods
*/
//! @{
/*!
\fn BString& BString::CharacterEscape(const char *original, const char *setOfCharsToEscape, char escapeWith)
*/
/*!
\fn BString& BString::CharacterEscape(const char *setOfCharsToEscape, char escapeWith)
*/
/*!
\fn BString& BString::CharacterDeescape(const char *original, char escapeChar)
*/
/*!
\fn BString& BString::CharacterDeescape(char escapeChar)
*/
//! @}
/*!
\name Simple sprintf Replacement Methods
These methods may be slower than sprintf(), but they are overflow safe.
*/
//! @{
/*!
\fn BString& BString::operator<<(const char *str)
*/
/*!
\fn BString& BString::operator<<(const BString &string)
*/
/*!
\fn BString& BString::operator<<(char c)
*/
/*!
\fn BString& BString::operator<<(int i)
*/
/*!
\fn BString& BString::operator<<(unsigned int i)
*/
/*!
\fn BString& BString::operator<<(uint32 i)
*/
/*!
\fn BString& BString::operator<<(int32 i)
*/
/*!
\fn BString& BString::operator<<(uint64 i)
*/
/*!
\fn BString& BString::operator<<(int64 i)
*/
/*!
\fn BString& BString::operator<<(float f)
*/
//! @}
/************************ end of class BString, start of general operators ************/
/*!
\fn bool operator<(const char *str, const BString &string)
*/
/*!
\fn bool operator<=(const char *str, const BString &string)
*/
/*!
\fn bool operator==(const char *str, const BString &string)
*/
/*!
\fn bool operator>(const char *str, const BString &string)
*/
/*!
\fn bool operator>=(const char *str, const BString &string)
*/
/*!
\fn bool operator!=(const char *str, const BString &string)
*/
/*!
\fn int Compare(const BString &, const BString &)
*/
/*!
\fn int ICompare(const BString &, const BString &)
*/
/*!
\fn int Compare(const BString *, const BString *)
*/
/*!
\fn int ICompare(const BString *, const BString *)
*/