// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
-// http://www.apache.org/licenses/LICENSE-2.0
+// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
namespace Tizen { namespace Base
{
+
+class _StringBuffer;
+
/**
* @class ImmutableString
* @brief This class represents a immutable sequence of Unicode characters.
* @since 3.0
*
* @param[in] pStr A pointer to an array of Unicode characters
- * @remark If whcar_t* type null pointer is entered on parameter, the empty string is set.
+ * @remarks If whcar_t* type null pointer is entered on parameter, the empty string is set.
*/
explicit ImmutableString(const wchar_t* pStr);
* @since 3.0
*
* @param[in] pStr A pointer to an array of UTF-8 characters
- * @remark If char* type null pointer is entered on parameter, the empty string is set.
+ * @remarks If char* type null pointer is entered on parameter, the empty string is set.
*/
explicit ImmutableString(const char* pStr);
* @return @c true if this instance contains the specified substring, @n
* else @c false
* @param[in] str The string to match
- * @exception E_SUCCESS The method is successful.
- * @exception E_INVALID_ARG The specified @c str is an empty string.
+ * @remarks This method returns @c true when an empty string is entered on parameter.
*/
bool Contains(const ImmutableString& str) const;
* @param[in] str An instance to match
* @exception E_SUCCESS The method is successful.
* @exception E_INVALID_ARG The specified @c str is an empty string.
+ * @remarks The specific error code can be accessed by using GetLastResult() method.
*/
bool EndsWith(const ImmutableString& str) const;
* @exception E_INVALID_ARG Either of the following conditions has occurred:
* - The specified @c length is negative.
* - The specified @c pFormat is @c null.
+ * - The specified @c pFormat includes "%n" or "%hn" which may cause format string vulnerability.
* @remarks
* - If an "l" modifier is present in @c pFormat (for example, L"@%ls"), it is a pointer to an array of wide characters.
* - A pointer to an array of UTF-8 characters is not allowed in the Format() method (for example, Format(20, L"@%s", pUTF8Str)).
+ * - This method is locale-dependent.
+ * - This method returns an empty string when an exception occurs.
+ * - The specific error code can be accessed by using the GetLastResult() method.
* The following format specifiers are supported in this method:
* @code
* specifier Output
* @exception E_OUT_OF_RANGE Either of the following conditions has occurred:
* - The specified @c indexAt is either greater than or equal to the length of the current instance.
* - The specified @c indexAt is less than @c 0.
- * @remark This method does not guarantee a usable value of out-parameter when an error occurs.
+ * @remarks This method does not guarantee a usable value of out-parameter when an error occurs.
*/
result GetCharAt(int indexAt, wchar_t& ch) const;
* @exception E_OUT_OF_RANGE Either of the following conditions has occurred:
* - The specified @c startIndex is either greater than or equal to the length of the current instance.
* - The specified @c startIndex is less than @c 0.
- * @remark This method does not guarantee a usable value of out-parameter when an error occurs.
+ * @remarks Do not use the @c indexOf when the method returns an error.
*/
result IndexOf(wchar_t ch, int startIndex, int& indexOf) const;
* @exception E_OUT_OF_RANGE Either of the following conditions has occurred:
* - The specified @c startIndex is either greater than or equal to the length of the current instance.
* - The specified @c startIndex is less than @c 0.
- * @remark This method does not guarantee a usable value of out-parameter when an error occurs.
+ * @remarks Do not use the @c indexOf when the method returns an error.
*/
result IndexOf(const ImmutableString& str, int startIndex, int& indexOf) const;
* @param[in] indexAt The position to insert @c str
* @exception E_SUCCESS The method is successful.
* @exception E_OUT_OF_RANGE Either of the following conditions has occurred:
- * - The specified @c indexAt is either greater than or equal to the length of the current instance.
+ * - The specified @c indexAt is greater than the length of the current instance.
* - The specified @c indexAt is less than @c 0.
- * @remark This method returns an empty string when an exception occurs.
+ * @remarks
+ * - This method returns an empty string when an exception occurs.
+ * - The specific error code can be accessed by using GetLastResult() method.
*/
ImmutableString Insert(const ImmutableString& str, int indexAt) const;
* @exception E_OUT_OF_RANGE Either of the following conditions has occurred:
* - The specified @c startIndex is either greater than or equal to the length of the current instance.
* - The specified @c startIndex is less than @c 0.
- * @remark This method does not guarantee a usable value of out-parameter when an error occurs.
+ * @remarks Do not use the @c indexOf when the method returns an error.
* @code
*
* int indexOf;
*
* @remarks
* - If the substring is empty, E_SUCCESS is returned and the value of @c indexOf is set to @c startIndex.
- * - This method does not guarantee a usable value of out-parameter when an error occurs.
+ * - Do not use the @c indexOf when the method returns an error.
* @code
*
* int indexOf;
* - The specified @c startIndex is less than @c 0.
* - The specified @c length is greater than the length of the substring starting from @c startIndex.
* - The specified @c length is less than @c 0.
- * @remark This method returns an empty string when an exception occurs.
+ * @remarks
+ * - This method returns an empty string when an exception occurs.
+ * - The specific error code can be accessed by using GetLastResult() method.
*/
ImmutableString Remove(int startIndex, int length) const;
* @param[in] replace An instance to replace all occurrences of @c original by
* @exception E_SUCCESS The method is successful.
* @exception E_INVALID_ARG The specified @c original is an empty string.
- * @remark This method returns an empty string when an exception occurs.
+ * @remarks
+ * - This method returns an empty string when an exception occurs.
+ * - The specific error code can be accessed by using GetLastResult() method.
*/
ImmutableString Replace(const ImmutableString& original, const ImmutableString& replace) const;
* @exception E_OUT_OF_RANGE Either of the following conditions has occurred:
* - The specified @c startIndex is either greater than or equal to the length of the current instance.
* - The specified @c startIndex is less than @c 0.
- * @remark This method returns an empty string when an exception occurs.
+ * - The length of the specified @c original is greater than the length of the substring starting from @c startIndex.
+ * @remarks
+ * - This method returns an empty string when an exception occurs.
+ * - The specific error code can be accessed by using GetLastResult() method.
*/
ImmutableString Replace(const ImmutableString& original, const ImmutableString& replace, int startIndex) const;
* @exception E_OUT_OF_RANGE Either of the following conditions has occurred:
* - The specified @c indexAt is either greater than or equal to the length of the current instance.
* - The specified @c indexAt is less than @c 0.
- * @remark This method returns an empty string when an exception occurs.
+ * @remarks
+ * - This method returns an empty string when an exception occurs.
+ * - The specific error code can be accessed by using GetLastResult() method.
*/
ImmutableString SetCharAt(wchar_t ch, int indexAt) const;
* @exception E_OUT_OF_RANGE Either of the following conditions has occurred:
* - The specified @c startIndex is either greater than or equal to the length of the current instance.
* - The specified @c startIndex is less than @c 0.
+ * @remarks
+ * - The specific error code can be accessed by using GetLastResult() method.
+ * - This method returns @c true when an empty string is entered on parameter.
*/
bool StartsWith(const ImmutableString& str, int startIndex) const;
* @exception E_OUT_OF_RANGE Either of the following conditions has occurred:
* - The specified @c startIndex is either greater than or equal to the length of the current instance.
* - The specified @c startIndex is less than @c 0.
- * @remark This method returns an empty string when an exception occurs.
+ * @remarks
+ * - This method returns an empty string when an exception occurs.
+ * - The specific error code can be accessed by using GetLastResult() method.
*/
ImmutableString SubString(int startIndex) const;
* - The specified @c startIndex is less than @c 0.
* - The specified @c length is greater than the length of the substring starting from @c startIndex.
* - The specified @c length is less than @c 0.
- * @remark This method returns an empty string when an exception occurs.
+ * @remarks
+ * - This method returns an empty string when an exception occurs.
+ * - The specific error code can be accessed by using GetLastResult() method.
*/
ImmutableString SubString(int startIndex, int length) const;
//
// Overloaded constructor
//
- explicit ImmutableString(int capacity);
+ ImmutableString(_StringBuffer* pBuf);
private:
- class _StringBuffer* __pImpl;
+ _StringBuffer* __pImpl;
friend class _StringBuffer;
-
- class _ImmutableStringImpl* __pImmutableStringImpl;
};
/**