/// \brief Copy constructor. Constructs a copy of the string \e str.
/// \brief Copy constructor.
///
/// Constructs a copy of the string \e str.
///
/// \par Example
/// \code
Stringstr1("Something");
Stringstr2(str1);
/// \endcode
/// \par Output
/// str1 = Something \n str2 = Something
String(constString&str);
/// \brief Converts anything to a string.
...
...
@@ -72,103 +93,175 @@ class String
/// Returns size of allocated storage for given string.
intgetAllocatedSize()const;
/// Reserves space for given number of characters (\e size).
/// Requests to allocate storage for given \e size (number of characters).
/////
/// Reserves space for given \e size.
/// Requests to allocate storage for given \e size.
/// @param size Number of characters.
voidsetSize(intsize);
/////
/// Sets string from given char pointer \e c.
/// @param prefix_cut_off determines the length of the prefix that is going to be omitted from the string \e c
/// @param sufix_cut_off determines the length of the sufix that is going to be omitted from the string \e c
/// \brief Sets string from given char pointer \e c.
///
/// @param prefix_cut_off determines the length of the prefix that is
/// going to be omitted from the string \e c
/// @param sufix_cut_off determines the length of the sufix that is going
/// to be omitted from the string \e c
voidsetString(constchar*c,
intprefix_cut_off=0,
intsufix_cut_off=0);
/// Returns pointer to data. It returns the content of the given string.
/////
/// \brief Returns pointer to data.
///
/// It returns the content of the given string. The content can not be
/// changed by user.
constchar*getString()const;
/// Returns pointer to data.
/// \brief Returns pointer to data.
///
/// It returns the content of the given string. The content can be changed
/// by user.
char*getString();
/// \brief Operator for accesing particular chars of the string. This function overloads operator[](). It returns a reference to the character at position \e i in given string.
/////
/// \brief Operator for accesing particular chars of the string.
///
/// This function overloads operator[](). It returns a reference to
/// the character at position \e i in given string.
/// The character can not be changed be user.
constchar&operator[](inti)const;
/// \brief Operator for accesing particular chars of the string. It returns the character at the position \e i in given string as a modifiable reference.
/// \brief Operator for accesing particular chars of the string.
///
/// It returns the character at the position \e i in given string as
/// a modifiable reference.
char&operator[](inti);
/////
/// \brief Operators for C strings.
/// This function overloads operator=(). It assigns \e str to this string, replacing its current contents.
// Operators for C strings.
/// \brief This function overloads operator=().
///
/// It assigns C string \e str to this string, replacing its current contents.
String&operator=(constchar*str);
/// This function overloads operator+=(). It appends the string \e str to this string.
/// \brief This function overloads operator+=().
///
/// It appends the C string \e str to this string.
String&operator+=(constchar*str);
/// This function concatenates strings and returns a newly constructed string object.
/// \brief This function concatenates C strings \e str and returns a newly
/// constructed string object.
Stringoperator+(constchar*str)const;
/// This function overloads operator==().
/// \brief This function overloads operator==().
booloperator==(constchar*str)const;
/// This function overloads operator!=().
/// \brief This function overloads operator!=().
booloperator!=(constchar*str)const;
/////
/// \brief Operators for Strings.
/// This function assigns \e str to this string and returns a reference to this string.
// Operators for Strings.
/// This function assigns \e str to this string and returns a reference to
/// this string.
String&operator=(constString&str);
/// This function appends the string \e str onto the end of this string and returns a reference to this string.
/// This function appends the string \e str onto the end of this string
/// and returns a reference to this string.
String&operator+=(constString&str);
/// This function concatenates strings and returns a newly constructed string object.
/// This function concatenates strings \e str and returns a newly
/// constructed string object.
Stringoperator+(constString&str)const;
/// This function overloads operator==(). It returns \c true if this string is equal to \e str, otherwise returns \c false.
/// \brief This function overloads operator==().
///
/// It returns \c true if this string is equal to \e str, otherwise returns
/// \c false.
booloperator==(constString&str)const;
/// This function overloads operator!=(). It returns \c true if this string is not equal to \e str, otherwise returns \c false.
/// \brief This function overloads operator!=().
///
/// It returns \c true if this string is not equal to \e str, otherwise
/// returns \c false.
booloperator!=(constString&str)const;
/////
/// \brief Operators for single characters.
/// This function overloads operator=(). It assigns character /e str to this string.
// Operators for single characters.
/// \brief This function overloads operator=().
///
/// It assigns character /e str to this string.
String&operator=(charstr);
/// This function overloads operator+=(). It appends character /e str to this string.
/// \brief This function overloads operator+=().
///
/// It appends character /e str to this string.
String&operator+=(charstr);
// This function concatenates strings and returns a newly constructed string object.
Stringoperator+(charstr)const;
// This function concatenates strings and returns a newly constructed string object.
booloperator==(charstr)const;
/// This function overloads operator!=().
/// \brief This function overloads operator!=().
booloperator!=(charstr)const;
/// \brief Cast to bool operator. Converts string to boolean expression (true or false).
/// \brief Cast to bool operator.
///
/// This function overloads operator bool(). It converts string to boolean
/// expression (true or false).
operatorbool()const;
/// \brief Cast to bool with negation operator.
///
/// This function overloads operator!(). It converts string to boolean
/// expression (false or true).
booloperator!()const;
/////
/// \brief Replaces portion of string.
///It replaces section \e pattern from this string with new piece of string \e replaceWith.
///If parameter \e count is defined, the function makes replacement several times, every time when it finds the same pattern in this string.
///
/// Replaces section \e pattern from this string with new piece of string \e replaceWith.
/// If parameter \e count is defined, the function makes replacement several times,
/// every time when it finds the same pattern in this string.
/// @param pattern Section of given string that will be replaced.
/// @param replaceWith New piece of string that will be used to replace \e pattern.
/// @param count A whole number that specifies how many replacements should be done.
Stringreplace(constString&pattern,
constString&replaceWith,
intcount=0)const;
/// \brief Trims/strips given string. It removes all spaces from string except for single spaces between words.
/////
/// \brief Trims/strips given string.
///
/// Removes all spaces from given string except for single spaces between words.
Stringstrip(charstrip=' ')const;
/// \brief Splits string into list of strings with respect to given \e separator.
/// It splits the string into list of substrings wherever \e separator occurs, and returs list of those strings.
/// When \e separator does not appear anywhere in the given string, this function returns a single-element list containing given sting.
/// @param separator Character, which separates substrings in given string. Empty character can not be used.
///
/// Splits the string into list of substrings wherever \e separator occurs,
/// and returs list of those strings. When \e separator does not appear
/// anywhere in the given string, this function returns a single-element list
/// containing given sting.
/// @param list Name of list.
/// @param separator Character, which separates substrings in given string.