From: dahyeong.kim Date: Tue, 23 Jul 2013 09:50:23 +0000 (+0900) Subject: [2.2.1] Update examples and doxygen comments of RegularExpression X-Git-Tag: submit/tizen/20131210.080830^2^2~235^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3589461f969e295a3eaf985d7930baa27667b389;p=platform%2Fframework%2Fnative%2Fappfw.git [2.2.1] Update examples and doxygen comments of RegularExpression Change-Id: If5ca5cc4e93178cf3e3912b958e32ef104f7ab16 Signed-off-by: dahyeong.kim --- diff --git a/inc/FBaseUtilRegularExpression.h b/inc/FBaseUtilRegularExpression.h index ede79d9..6231517 100644 --- a/inc/FBaseUtilRegularExpression.h +++ b/inc/FBaseUtilRegularExpression.h @@ -79,16 +79,14 @@ enum RegularExpressionOptions * void * MyClass:RegularExpressionSample(void) * { - * bool ret = false; - * * String pattern(L"the quick brown fox"); * String text(L"What do you know about the quick brown fox?"); - * String out; * * RegularExpression regex; * regex.Construct(pattern, REGEX_CASELESS); * - * ret = regex.Match(text, false); // This returns true value + * bool ret = regex.Match(text, false); // This returns true value + * ... * } * * @endcode @@ -127,14 +125,13 @@ public: * The following example demonstrates how to use the %Construct() method. * @code * - * bool ret = false; - * * String pattern(L"^CRUEL$"); * String text(L"Hello\ncruel\nworld"); * * RegularExpression regex; * regex.Construct(pattern, REGEX_CASELESS | REGEX_MULTI_LINE); - * ret = regex.Match(text, false); // This returns true value + * bool ret = regex.Match(text, false); // This returns true value + * ... * * @endcode */ @@ -149,46 +146,46 @@ public: * else @c false * @param[in] text The text to match * @param[in] fullMatch Set to @c true to match exactly, @n - * else @c false to match any substring of the text + * else @c false to match any substring of the text * @param[out] pMatchedString A list of the matched string instances @n - The count of the matched items is acquired from IList::GetCount() and + * The count of the matched items is acquired from IList::GetCount() and * the maximum count of the items is @c 16. * @exception E_SUCCESS The method is successful. * @exception E_INVALID_STATE This instance has not been constructed as yet. * @exception E_INVALID_ARG The length of the specified @c text parameter is @c 0. - * @remarks The specific error code can be accessed using the GetLastResult() method. - * @remarks If the grouping subpatterns are used in a pattern, - * the @c pMatchedString list will contain the grouping data. @n + * @remarks + * - The specific error code can be accessed using the GetLastResult() method. + * - If the grouping subpatterns are used in a pattern, + * the @c pMatchedString list will contain the grouping data. @n * For example, if the pattern has two grouping subpatterns, - * there will be three data sets in the @c pMatchedString list. @n + * there will be three data sets in the @c pMatchedString list. @n * The first data set will be a full grouping data and the second - * and the third data sets will contain individual grouping data. + * and the third data sets will contain individual grouping data. + * - Because this method returns a new instance through an out-parameter @c pMatchedString, + * the caller needs to delete it after use. @n + * Setting the element deleter of @c pMatchedString to SingleObjectDeleter is recommended. * * The following example demonstrates how to use the %Match() method. * * @code * - * bool ret = false; - * * String pattern(L"(\\d\\d)-(\\d\\d)-(\\d\\d\\d\\d)"); * String text(L"04-12-1979"); - * String out; * * RegularExpression regex; * regex.Construct(pattern); * - * ArrayList list; + * ArrayList list(SingleObjectDeleter); * list.Construct(); * * // Match - * ret = regex.Match(text, true, &list); // The list will contain four string instances + * bool ret = regex.Match(text, true, &list); // The list will contain four string instances * - * out = *(String *)list.GetAt(0); // L"04-12-1979" - * out = *(String *)list.GetAt(1); // L"04" - * out = *(String *)list.GetAt(2); // L"12" - * out = *(String *)list.GetAt(3); // L"1979" + * String out = *(dynamic_cast< String* >(list.GetAt(0))); // L"04-12-1979" + * out = *(dynamic_cast< String* >(list.GetAt(1))); // L"04" + * out = *(dynamic_cast< String* >(list.GetAt(2))); // L"12" + * out = *(dynamic_cast< String* >(list.GetAt(3))); // L"1979" * - * list.RemoveAll(true); * @endcode */ bool Match(const Tizen::Base::String& text, bool fullMatch, Tizen::Base::Collection::IList* pMatchedString = null) const; @@ -215,29 +212,25 @@ public: * there will be three data sets in the @c pMatchedString list. @n * The first data set will be a full grouping data and the second * and the third data sets will contain individual grouping data. - * * The following example demonstrates how to use the %Consume() method. * @code * - * bool ret = false; - * String out; - * * String pattern(L"(\\s+)([a-z]+)(\\d+)"); * String text(L" abcd1234test"); - * ArrayList list; + * + * ArrayList list(SingleObjectDeleter); * list.Construct(); * * RegularExpression regex; * regex.Construct(pattern); - * ret = regex.Consume(text, &list); // The list will contain four string instances - * // and the text instance will be changed to L"test" - * out = *(String *)list.GetAt(0); // L" abcd1234" - * out = *(String *)list.GetAt(1); // L" " - * out = *(String *)list.GetAt(2); // L"abcd" - * out = *(String *)list.GetAt(3); // L"1234" - * - * list.RemoveAll(true); + * bool ret = regex.Consume(text, &list); // The list will contain four string instances + * // and the text instance will be changed to L"test" + * String out = *(dynamic_cast< String* >(list.GetAt(0))); // L" abcd1234" + * out = *(dynamic_cast< String* >(list.GetAt(1))); // L" " + * out = *(dynamic_cast< String* >(list.GetAt(2))); // L"abcd" + * out = *(dynamic_cast< String* >(list.GetAt(3))); // L"1234" + * * @endcode */ bool Consume(Tizen::Base::String& text, Tizen::Base::Collection::IList* pMatchedString = null) const; @@ -269,24 +262,21 @@ public: * * @code * - * bool ret = false; - * String out; - * * String pattern(L"(\\s+)([a-z]+)(\\d+)"); * String text(L"test abcd1234test"); - * ArrayList list; + * + * ArrayList list(SingleObjectDeleter); * list.Construct(); * * RegularExpression regex; * regex.Construct(pattern); - * ret = regex.FindAndConsume(text, &list); // The list will contain four String instances - * // and text instance will be changed to L"test" - * out = *(String *)list.GetAt(0); // L" abcd1234" - * out = *(String *)list.GetAt(1); // L" " - * out = *(String *)list.GetAt(2); // L"abcd" - * out = *(String *)list.GetAt(3); // L"1234" - * - * list.RemoveAll(true); + * bool ret = regex.FindAndConsume(text, &list); // The list will contain four String instances + * // and text instance will be changed to L"test" + * String out = *(dynamic_cast< String* >(list.GetAt(0))); // L" abcd1234" + * out = *(dynamic_cast< String* >(list.GetAt(1))); // L" " + * out = *(dynamic_cast< String* >(list.GetAt(2))); // L"abcd" + * out = *(dynamic_cast< String* >(list.GetAt(3))); // L"1234" + * * @endcode */ bool FindAndConsume(Tizen::Base::String& text, Tizen::Base::Collection::IList* pMatchedString = null) const; @@ -314,15 +304,13 @@ public: * * @code * - * bool ret = false; - * * String pattern(L"replace"); * String text(L"test replace method"); * String rewrite(L"REPLACE"); * * RegularExpression regex; * regex.Construct(pattern); - * ret = regex.Replace(text, rewrite, false); // text = L"test REPLACE method" + * bool ret = regex.Replace(text, rewrite, false); // text = L"test REPLACE method" * * @endcode */ @@ -349,16 +337,15 @@ public: * * @code * - * bool ret = false; - * String out; - * * String pattern(L"(.*)@([^.]*)"); * String text(L"test@email.com"); * String rewrite(L"\\2!\\1"); * * RegularExpression regex; * regex.Construct(pattern); - * ret = regex.Extract(text, rewrite, out); // out = L"email!test" + * + * String out; + * bool ret = regex.Extract(text, rewrite, out); // out = L"email!test" * * @endcode */ @@ -394,7 +381,6 @@ public: */ Tizen::Base::String GetPattern(void) const; - /** * Sets the value of the regular expression options. * @@ -406,7 +392,6 @@ public: */ result SetOptions(unsigned long options); - /** * Gets the value of the regular expression options. *