X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=inc%2FFBaseImmutableString.h;h=a66324b173f5f64c9d5885741943f9f1f062cf37;hb=07a771d39ebf4c7f26a04aeb3e06f9d7eb1c6dc2;hp=f6819157b7fbd7d03068619b9c1dbb98e3144d32;hpb=1cd3dd8676a15dd244910315b6003ba814e9f967;p=platform%2Fframework%2Fnative%2Fappfw.git diff --git a/inc/FBaseImmutableString.h b/inc/FBaseImmutableString.h index f681915..a66324b 100644 --- a/inc/FBaseImmutableString.h +++ b/inc/FBaseImmutableString.h @@ -5,7 +5,7 @@ // 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, @@ -31,6 +31,9 @@ namespace Tizen { namespace Base { + +class _StringBuffer; + /** * @class ImmutableString * @brief This class represents a immutable sequence of Unicode characters. @@ -75,7 +78,7 @@ public: * @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); @@ -85,7 +88,7 @@ public: * @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); @@ -161,8 +164,7 @@ public: * @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; @@ -176,6 +178,7 @@ public: * @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; @@ -219,9 +222,13 @@ public: * @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 @@ -249,7 +256,7 @@ public: * * @endcode */ - static ImmutableString Format(int length, const wchar_t* pFormat, ...) const; + static ImmutableString Format(int length, const wchar_t* pFormat, ...); /** * Gets the character at the specified position. @@ -262,8 +269,8 @@ public: * @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 less than @c 0. - * @remark This method does not guarantee a usable value of out-parameter when an error occurs. + * - The specified @c indexAt is less than @c 0. + * @remarks This method does not guarantee a usable value of out-parameter when an error occurs. */ result GetCharAt(int indexAt, wchar_t& ch) const; @@ -310,8 +317,8 @@ public: * @exception E_OBJ_NOT_FOUND The specified character is not found. * @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. + * - The specified @c startIndex is less than @c 0. + * @remarks Do not use the @c indexOf when the method returns an error. */ result IndexOf(wchar_t ch, int startIndex, int& indexOf) const; @@ -329,8 +336,8 @@ public: * @exception E_OBJ_NOT_FOUND The specified string is not found. * @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. + * - The specified @c startIndex is less than @c 0. + * @remarks Do not use the @c indexOf when the method returns an error. */ result IndexOf(const ImmutableString& str, int startIndex, int& indexOf) const; @@ -344,9 +351,11 @@ public: * @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 less than @c 0. - * @remark This method returns an empty string when an exception occurs. + * - The specified @c indexAt is greater than the length of the current instance. + * - The specified @c indexAt is less than @c 0. + * @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; @@ -374,8 +383,8 @@ public: * @exception E_OBJ_NOT_FOUND The specified character is not found. * @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. + * - The specified @c startIndex is less than @c 0. + * @remarks Do not use the @c indexOf when the method returns an error. * @code * * int indexOf; @@ -402,11 +411,11 @@ public: * @exception E_OBJ_NOT_FOUND The specified character is not found. * @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. + * - The specified @c startIndex is less than @c 0. * * @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; @@ -432,10 +441,12 @@ public: * @exception E_SUCCESS The method is successful. * @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. + * - 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. + * - The specified @c length is less than @c 0. + * @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; @@ -464,7 +475,9 @@ public: * @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; @@ -483,8 +496,11 @@ public: * @exception E_INVALID_ARG The specified @c original is an empty string. * @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 specified @c startIndex is less than @c 0. + * - 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; @@ -510,8 +526,10 @@ public: * @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 less than @c 0. - * @remark This method returns an empty string when an exception occurs. + * - The specified @c indexAt is less than @c 0. + * @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; @@ -528,7 +546,10 @@ public: * @exception E_SUCCESS The method is successful. * @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. + * - 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; @@ -556,8 +577,10 @@ public: * @exception E_SUCCESS The method is successful. * @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 specified @c startIndex is less than @c 0. + * @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; @@ -574,10 +597,12 @@ public: * @exception E_SUCCESS The method is successful. * @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. + * - 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. + * - The specified @c length is less than @c 0. + * @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; @@ -630,14 +655,12 @@ private: // // Overloaded constructor // - explicit ImmutableString(int capacity); + ImmutableString(_StringBuffer* pBuf); private: - class _StringBuffer* __pImpl; + _StringBuffer* __pImpl; friend class _StringBuffer; - - class _ImmutableStringImpl* __pImmutableStringImpl; }; /**