From: Suchita Date: Thu, 11 Jul 2013 09:25:40 +0000 (+0600) Subject: Beautified source code of appfw/src/base/utility X-Git-Tag: submit/tizen/20131210.080830^2^2~260^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7bf996e45cc97637131fc54a7f1900ad9c563a35;p=platform%2Fframework%2Fnative%2Fappfw.git Beautified source code of appfw/src/base/utility Change-Id: I353a06a20eff2aada84f9c14c9d4966fe3086a68 Signed-off-by: Suchita --- diff --git a/src/base/utility/FBaseUtilScanner.cpp b/src/base/utility/FBaseUtilScanner.cpp index 1dcfd5e..fa2f730 100644 --- a/src/base/utility/FBaseUtilScanner.cpp +++ b/src/base/utility/FBaseUtilScanner.cpp @@ -1,3 +1,23 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the License); +// 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 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +/** + * @file FBaseUtilScanner.cpp + * @brief This is the implementation file for Scanner class. + */ #include #include #include @@ -10,7 +30,6 @@ #include #include "FBaseUtil_ScannerImpl.h" - using namespace Tizen::Base::Collection; using namespace Tizen::Base::Utility; using namespace Tizen::Base; @@ -29,7 +48,8 @@ Scanner::~Scanner() __pScannerImpl = null; } -result Scanner::Construct(const String& inputStr) +result +Scanner::Construct(const String& inputStr) { result r = E_SUCCESS; SysAssertf(__pScannerImpl == null, "Already constructed! Calling Construct() twice or more on a same instance is not allowed for this class."); @@ -41,7 +61,8 @@ result Scanner::Construct(const String& inputStr) return r; } -result Scanner::Construct(const String& inputFilePath, const String& encodingScheme) +result +Scanner::Construct(const String& inputFilePath, const String& encodingScheme) { result r = E_SUCCESS; SysAssertf(__pScannerImpl == null, "Already constructed! Calling Construct() twice or more on a same instance is not allowed for this class."); @@ -55,50 +76,57 @@ result Scanner::Construct(const String& inputFilePath, const String& encodingSch return r; } -bool Scanner::HasNextToken(void) const +bool +Scanner::HasNextToken(void) const { SysAssertf(__pScannerImpl != null, "Not yet constructed! Construct() should be called before use."); return __pScannerImpl->HasNextToken(); } -bool Scanner::HasNextToken(const RegularExpression& pattern) const +bool +Scanner::HasNextToken(const RegularExpression& pattern) const { SysAssertf(__pScannerImpl != null, "Not yet constructed! Construct() should be called before use."); return __pScannerImpl->HasNextToken(pattern); } -bool Scanner::HasNextToken(const String& pattern) const +bool +Scanner::HasNextToken(const String& pattern) const { SysAssertf(__pScannerImpl != null, "Not yet constructed! Construct() should be called before use."); return __pScannerImpl->HasNextToken(pattern); } - -result Scanner::GetNextToken(String& nextTok) const +result +Scanner::GetNextToken(String& nextTok) const { SysAssertf(__pScannerImpl != null, "Not yet constructed! Construct() should be called before use."); return __pScannerImpl->GetNextToken(nextTok); } -result Scanner::GetNextToken(const RegularExpression& pattern, String& nextTok) const +result +Scanner::GetNextToken(const RegularExpression& pattern, String& nextTok) const { SysAssertf(__pScannerImpl != null, "Not yet constructed! Construct() should be called before use."); return __pScannerImpl->GetNextToken(pattern, nextTok); } -result Scanner::GetNextToken(const String& pattern, String& nextTok) const +result +Scanner::GetNextToken(const String& pattern, String& nextTok) const { SysAssertf(__pScannerImpl != null, "Not yet constructed! Construct() should be called before use."); return __pScannerImpl->GetNextToken(pattern, nextTok); } -result Scanner::GetNextSignedChar(signed char& nextSignedChar) const +result +Scanner::GetNextSignedChar(signed char& nextSignedChar) const { SysAssertf(__pScannerImpl != null, "Not yet constructed! Construct() should be called before use."); - return __pScannerImpl->GetNextSignedChar(nextSignedChar ); + return __pScannerImpl->GetNextSignedChar(nextSignedChar); } -result Scanner::GetNextSignedChar(signed char& nextSignedChar, int radix) const +result +Scanner::GetNextSignedChar(signed char& nextSignedChar, int radix) const { SysAssertf(__pScannerImpl != null, "Not yet constructed! Construct() should be called before use."); SysTryReturnResult(NID_BASE_UTIL, ((radix == Character::RADIX_BINARY) || (radix == Character::RADIX_OCTAL) || (radix == Character::RADIX_DECIMAL) || @@ -108,14 +136,16 @@ result Scanner::GetNextSignedChar(signed char& nextSignedChar, int radix) const return __pScannerImpl->GetNextSignedChar(nextSignedChar, radix); } -bool Scanner::IsNextTokenConvertibleToSignedChar(void) const +bool +Scanner::IsNextTokenConvertibleToSignedChar(void) const { SysAssertf(__pScannerImpl != null, "Not yet constructed! Construct() should be called before use."); return __pScannerImpl->IsNextTokenConvertibleToSignedChar(); } -bool Scanner::IsNextTokenConvertibleToSignedChar(int radix) const +bool +Scanner::IsNextTokenConvertibleToSignedChar(int radix) const { SysAssertf(__pScannerImpl != null, "Not yet constructed! Construct() should be called before use."); SysTryReturnResult(NID_BASE_UTIL, ((radix == Character::RADIX_BINARY) || (radix == Character::RADIX_OCTAL) || (radix == Character::RADIX_DECIMAL) || @@ -125,13 +155,15 @@ bool Scanner::IsNextTokenConvertibleToSignedChar(int radix) const return __pScannerImpl->IsNextTokenConvertibleToSignedChar(radix); } -result Scanner::GetNextInt(int& nextInt) const +result +Scanner::GetNextInt(int& nextInt) const { SysAssertf(__pScannerImpl != null, "Not yet constructed! Construct() should be called before use."); return __pScannerImpl->GetNextInt(nextInt); } -result Scanner::GetNextInt(int& nextInt, int radix) const +result +Scanner::GetNextInt(int& nextInt, int radix) const { SysAssertf(__pScannerImpl != null, "Not yet constructed! Construct() should be called before use."); SysTryReturnResult(NID_BASE_UTIL, ((radix == Character::RADIX_BINARY) || (radix == Character::RADIX_OCTAL) || (radix == Character::RADIX_DECIMAL) || @@ -141,13 +173,15 @@ result Scanner::GetNextInt(int& nextInt, int radix) const return __pScannerImpl->GetNextInt(nextInt, radix); } -bool Scanner::IsNextTokenConvertibleToInt(void) const +bool +Scanner::IsNextTokenConvertibleToInt(void) const { SysAssertf(__pScannerImpl != null, "Not yet constructed! Construct() should be called before use."); return __pScannerImpl->IsNextTokenConvertibleToInt(); } -bool Scanner::IsNextTokenConvertibleToInt(int radix) const +bool +Scanner::IsNextTokenConvertibleToInt(int radix) const { SysAssertf(__pScannerImpl != null, "Not yet constructed! Construct() should be called before use."); SysTryReturnResult(NID_BASE_UTIL, ((radix == Character::RADIX_BINARY) || (radix == Character::RADIX_OCTAL) || (radix == Character::RADIX_DECIMAL) || @@ -157,13 +191,15 @@ bool Scanner::IsNextTokenConvertibleToInt(int radix) const return __pScannerImpl->IsNextTokenConvertibleToInt(radix); } -result Scanner::GetNextShort(short& nextShort) const +result +Scanner::GetNextShort(short& nextShort) const { SysAssertf(__pScannerImpl != null, "Not yet constructed! Construct() should be called before use."); return __pScannerImpl->GetNextShort(nextShort); } -result Scanner::GetNextShort(short& nextShort, int radix) const +result +Scanner::GetNextShort(short& nextShort, int radix) const { SysAssertf(__pScannerImpl != null, "Not yet constructed! Construct() should be called before use."); SysTryReturnResult(NID_BASE_UTIL, ((radix == Character::RADIX_BINARY) || (radix == Character::RADIX_OCTAL) || (radix == Character::RADIX_DECIMAL) || @@ -173,30 +209,33 @@ result Scanner::GetNextShort(short& nextShort, int radix) const return __pScannerImpl->GetNextShort(nextShort, radix); } -bool Scanner::IsNextTokenConvertibleToShort(void) const +bool +Scanner::IsNextTokenConvertibleToShort(void) const { SysAssertf(__pScannerImpl != null, "Not yet constructed! Construct() should be called before use."); return __pScannerImpl->IsNextTokenConvertibleToShort(); } -bool Scanner::IsNextTokenConvertibleToShort(int radix) const +bool +Scanner::IsNextTokenConvertibleToShort(int radix) const { SysAssertf(__pScannerImpl != null, "Not yet constructed! Construct() should be called before use."); SysTryReturnResult(NID_BASE_UTIL, ((radix == Character::RADIX_BINARY) || (radix == Character::RADIX_OCTAL) || (radix == Character::RADIX_DECIMAL) || (radix == Character::RADIX_HEXADECIMAL)), E_NUM_FORMAT, "[%s] The radix(%d) MUST be one of 2, 8, 10 and 16.", GetErrorMessage(E_NUM_FORMAT), radix); - return __pScannerImpl->IsNextTokenConvertibleToShort(radix); } -result Scanner::GetNextLongLong(long long& nextLongLong) const +result +Scanner::GetNextLongLong(long long& nextLongLong) const { SysAssertf(__pScannerImpl != null, "Not yet constructed! Construct() should be called before use."); return __pScannerImpl->GetNextLongLong(nextLongLong); } -result Scanner::GetNextLongLong(long long& nextLongLong, int radix) const +result +Scanner::GetNextLongLong(long long& nextLongLong, int radix) const { SysAssertf(__pScannerImpl != null, "Not yet constructed! Construct() should be called before use."); SysTryReturnResult(NID_BASE_UTIL, ((radix == Character::RADIX_BINARY) || (radix == Character::RADIX_OCTAL) || (radix == Character::RADIX_DECIMAL) || @@ -206,71 +245,79 @@ result Scanner::GetNextLongLong(long long& nextLongLong, int radix) const return __pScannerImpl->GetNextLongLong(nextLongLong, radix); } -bool Scanner::IsNextTokenConvertibleToLongLong(void) const +bool +Scanner::IsNextTokenConvertibleToLongLong(void) const { SysAssertf(__pScannerImpl != null, "Not yet constructed! Construct() should be called before use."); return __pScannerImpl->IsNextTokenConvertibleToLongLong(); } -result Scanner::GetNextFloat(float& nextFloat) const +result +Scanner::GetNextFloat(float& nextFloat) const { SysAssertf(__pScannerImpl != null, "Not yet constructed! Construct() should be called before use."); return __pScannerImpl->GetNextFloat(nextFloat); } - -bool Scanner::IsNextTokenConvertibleToFloat(void) const +bool +Scanner::IsNextTokenConvertibleToFloat(void) const { SysAssertf(__pScannerImpl != null, "Not yet constructed! Construct() should be called before use."); return __pScannerImpl->IsNextTokenConvertibleToFloat(); } -result Scanner::GetNextDouble(double& nextDouble) const +result +Scanner::GetNextDouble(double& nextDouble) const { SysAssertf(__pScannerImpl != null, "Not yet constructed! Construct() should be called before use."); return __pScannerImpl->GetNextDouble(nextDouble); } -bool Scanner::IsNextTokenConvertibleToDouble(void) const +bool +Scanner::IsNextTokenConvertibleToDouble(void) const { SysAssertf(__pScannerImpl != null, "Not yet constructed! Construct() should be called before use."); return __pScannerImpl->IsNextTokenConvertibleToDouble(); } -result Scanner::GetNextBool(bool& nextBool) const +result +Scanner::GetNextBool(bool& nextBool) const { SysAssertf(__pScannerImpl != null, "Not yet constructed! Construct() should be called before use."); return __pScannerImpl->GetNextBool(nextBool); } -bool Scanner::IsNextTokenConvertibleToBool(void) const +bool +Scanner::IsNextTokenConvertibleToBool(void) const { SysAssertf(__pScannerImpl != null, "Not yet constructed! Construct() should be called before use."); return __pScannerImpl->IsNextTokenConvertibleToBool(); } -bool Scanner::HasNextLine(void) const +bool +Scanner::HasNextLine(void) const { SysAssertf(__pScannerImpl != null, "Not yet constructed! Construct() should be called before use."); return __pScannerImpl->HasNextLine(); } - -result Scanner::GetNextLine(String& nextLine) const +result +Scanner::GetNextLine(String& nextLine) const { SysAssertf(__pScannerImpl != null, "Not yet constructed! Construct() should be called before use."); return __pScannerImpl->GetNextLine(nextLine); - } -result Scanner::FindInLine(const String& patternStr, String& matchedStr) +result +Scanner::FindInLine(const String& patternStr, String& matchedStr) { SysAssertf(__pScannerImpl != null, "Not yet constructed! Construct() should be called before use."); SysTryReturnResult(NID_BASE_UTIL, !patternStr.IsEmpty(), E_INVALID_ARG, "[%s] The length of the input data is zero.", GetErrorMessage(E_INVALID_ARG)); return __pScannerImpl->FindInLine(patternStr, matchedStr); } -result Scanner::FindInLine(const RegularExpression& pattern, String& matchedStr) +result +Scanner::FindInLine(const RegularExpression& pattern, String& matchedStr) { SysAssertf(__pScannerImpl != null, "Not yet constructed! Construct() should be called before use."); String str(pattern.GetPattern()); @@ -278,57 +325,62 @@ result Scanner::FindInLine(const RegularExpression& pattern, String& matchedStr) return __pScannerImpl->FindInLine(pattern, matchedStr); } -void Scanner::Skip(const String& patternStr) +void +Scanner::Skip(const String& patternStr) { SysAssertf(__pScannerImpl != null, "Not yet constructed! Construct() should be called before use."); SysTryReturn(NID_BASE_UTIL, !patternStr.IsEmpty(), , E_INVALID_ARG, "[%s] The length of the input data is zero.", GetErrorMessage(E_INVALID_ARG)); __pScannerImpl->Skip(patternStr); - } -void Scanner::Skip(const RegularExpression& pattern) +void +Scanner::Skip(const RegularExpression& pattern) { String str(pattern.GetPattern()); SysAssertf(__pScannerImpl != null, "Not yet constructed! Construct() should be called before use."); SysTryReturn(NID_BASE_UTIL, !str.IsEmpty(), , E_INVALID_ARG, "[%s] The length of the input data is zero.", GetErrorMessage(E_INVALID_ARG)); __pScannerImpl->Skip(pattern); - } -int Scanner::GetRadix(void) const +int +Scanner::GetRadix(void) const { SysAssertf(__pScannerImpl != null, "Not yet constructed! Construct() should be called before use."); return __pScannerImpl->GetRadix(); } -String Scanner::GetDelimiter(void) const +String +Scanner::GetDelimiter(void) const { SysAssertf(__pScannerImpl != null, "Not yet constructed! Construct() should be called before use."); return __pScannerImpl->GetDelimiter(); } -void Scanner::SetDelimiter(const String& patternStr) +void +Scanner::SetDelimiter(const String& patternStr) { SysAssertf(__pScannerImpl != null, "Not yet constructed! Construct() should be called before use."); __pScannerImpl->SetDelimiter(patternStr); } -void Scanner::SetDelimiter(const RegularExpression& pattern) +void +Scanner::SetDelimiter(const RegularExpression& pattern) { SysAssertf(__pScannerImpl != null, "Not yet constructed! Construct() should be called before use."); String delimPat(pattern.GetPattern()); __pScannerImpl->SetDelimiter(delimPat); } -void Scanner::SetRadix(int radix) +void +Scanner::SetRadix(int radix) { - if(__pScannerImpl) + if (__pScannerImpl) { - if(((radix == Character::RADIX_BINARY) || (radix == Character::RADIX_OCTAL) || - (radix == Character::RADIX_DECIMAL) || (radix == Character::RADIX_HEXADECIMAL))) + if (((radix == Character::RADIX_BINARY) || (radix == Character::RADIX_OCTAL) || + (radix == Character::RADIX_DECIMAL) || (radix == Character::RADIX_HEXADECIMAL))) { __pScannerImpl->SetRadix(radix); } } } -}}} // Osp::Base::Utility +}}} // Osp::Base::Utility \ No newline at end of file diff --git a/src/base/utility/FBaseUtilStringTokenizer.cpp b/src/base/utility/FBaseUtilStringTokenizer.cpp index c95ae6b..9aa0141 100644 --- a/src/base/utility/FBaseUtilStringTokenizer.cpp +++ b/src/base/utility/FBaseUtilStringTokenizer.cpp @@ -19,18 +19,14 @@ * @brief This is the implementation file for StringTokenizer class. * @see String class */ - -// Includes #include #include #include #include - namespace Tizen { namespace Base { namespace Utility { - ///////////////////////////////////////////////////////////////////////////// // StringTokenizer class lifecycle @@ -48,12 +44,10 @@ StringTokenizer::StringTokenizer(const String& value, const String& delimiters, __maxDelimChar = SetMaxDelimChar(); } - StringTokenizer::~StringTokenizer(void) { } - ///////////////////////////////////////////////////////////////////////////////////// // StringTokenizer class operations @@ -78,7 +72,6 @@ StringTokenizer::GetTokenCount(void) return count; } - bool StringTokenizer::HasMoreTokens(void) { @@ -92,7 +85,6 @@ StringTokenizer::HasMoreTokens(void) return true; } - result StringTokenizer::GetNextToken(String& token) { @@ -137,7 +129,6 @@ CATCH: return r; } - result StringTokenizer::SetDelimiters(const String& delimiters) { @@ -151,7 +142,6 @@ StringTokenizer::SetDelimiters(const String& delimiters) return E_SUCCESS; } - //////////////////////////////////////////////////////////////////////////////////////////////////// // StringTokenizer class private methods @@ -183,7 +173,6 @@ CATCH: return maxChar; } - int StringTokenizer::SkipDelimiters(int position) { @@ -209,7 +198,6 @@ StringTokenizer::SkipDelimiters(int position) return tmpPosition; } - int StringTokenizer::ScanToken(int position) { @@ -245,6 +233,4 @@ StringTokenizer::ScanToken(int position) return tmpPosition; } - - -} } } // Tizen::Base::Utility +}}} // Tizen::Base::Utility \ No newline at end of file diff --git a/src/base/utility/FBaseUtilStringUtil.cpp b/src/base/utility/FBaseUtilStringUtil.cpp index f742fd7..dd88a77 100644 --- a/src/base/utility/FBaseUtilStringUtil.cpp +++ b/src/base/utility/FBaseUtilStringUtil.cpp @@ -18,8 +18,6 @@ * @file FBaseUtilStringUtil.cpp * @brief This is the implementation file for StringUtil class. */ - -// Includes #include #include #include @@ -30,7 +28,6 @@ #include "FBase_StringConverter.h" #include "FBaseUtil_IcuConverter.h" - // Base64 Encoding Table static const char Base64EncodingTable[] = { @@ -44,7 +41,6 @@ static const char Base64EncodingTable[] = '4', '5', '6', '7', '8', '9', '+', '/' }; - // Base64 Decoding Table static int Base64DecodingTable[256] = { @@ -52,7 +48,7 @@ static int Base64DecodingTable[256] = -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 10-1F -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, // 20-2F 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, // 30-3F - -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, // 40-4F + -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, // 40-4F 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, // 50-5F -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, // 60-6F 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1, // 70-7F @@ -66,7 +62,6 @@ static int Base64DecodingTable[256] = -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 // F0-FF }; - namespace Tizen { namespace Base { namespace Utility { @@ -82,7 +77,7 @@ result StringUtil::MbToString(const McharBuffer& mb, String& str) { int length = GetStringLengthInMb(mb); - SysTryReturnResult(NID_BASE_UTIL,length >= 0, E_INVALID_ARG, "Invalid argument is used. null character does not exist between position and limit."); + SysTryReturnResult(NID_BASE_UTIL, length >= 0, E_INVALID_ARG, "Invalid argument is used. null character does not exist between position and limit."); ClearLastResult(); result r = E_SUCCESS; @@ -290,7 +285,6 @@ StringUtil::StringToUtf8N(const String& unicodeString) return pEncodedBuf.release(); } - result StringUtil::Utf8ToString(const char* pUtf8String, String& unicodeString) { @@ -311,7 +305,6 @@ StringUtil::Utf8ToString(const char* pUtf8String, String& unicodeString) return r; } - ByteBuffer* StringUtil::DecodeBase64StringN(const String& base64String) { @@ -404,7 +397,6 @@ StringUtil::DecodeBase64StringN(const String& base64String) return pBuffer.release(); } - result StringUtil::EncodeToBase64String(const ByteBuffer& buffer, String& encodedString) { @@ -462,4 +454,4 @@ StringUtil::EncodeToBase64String(const ByteBuffer& buffer, String& encodedString return r; } -} } } // Tizen::Base::Utility +}}} // Tizen::Base::Utility \ No newline at end of file diff --git a/src/base/utility/FBaseUtilUri.cpp b/src/base/utility/FBaseUtilUri.cpp index 846a016..4dda6df 100644 --- a/src/base/utility/FBaseUtilUri.cpp +++ b/src/base/utility/FBaseUtilUri.cpp @@ -18,8 +18,6 @@ * @file FBaseUtilUri.cpp * @brief This is the implementation file for Uri class. */ - -// Includes #include #include #include @@ -32,13 +30,11 @@ #include #include - namespace Tizen { namespace Base { namespace Utility { static const wchar_t HEX_DIGITS[] = {L'0', L'1', L'2', L'3', L'4', L'5', L'6', L'7', L'8', L'9', L'A', L'B', L'C', L'D', L'E', L'F'}; - ///////////////////////////////////////////////////////////////////////////////// // Life-cycle @@ -50,20 +46,17 @@ Uri::Uri(void) { } - Uri::Uri(const Uri& uri) : __pUriImpl(null) { SetUri(uri); } - Uri::~Uri(void) { Clear(); } - void Uri::SetUri(const Uri& uri) { @@ -90,7 +83,6 @@ Uri::SetUri(const Uri& uri) __ipv6ByteCount = uri.__ipv6ByteCount; } - result Uri::SetUri(const Tizen::Base::String& str) { @@ -107,7 +99,6 @@ Uri::SetUri(const Tizen::Base::String& str) return E_SUCCESS; } - result Uri::SetUri(const Tizen::Base::String& scheme, const Tizen::Base::String& ssp, const Tizen::Base::String& fragment) { @@ -117,7 +108,6 @@ Uri::SetUri(const Tizen::Base::String& scheme, const Tizen::Base::String& ssp, c return SetUri(scheme, ssp, empty, empty, empty, -1, empty, empty, fragment); } - result Uri::SetUri(const Tizen::Base::String& scheme, const Tizen::Base::String& userInfo, const Tizen::Base::String& host, int port, const Tizen::Base::String& path, const Tizen::Base::String& query, @@ -129,7 +119,6 @@ Uri::SetUri(const Tizen::Base::String& scheme, const Tizen::Base::String& userIn return SetUri(scheme, empty, empty, userInfo, host, port, path, query, fragment); } - result Uri::SetUri(const Tizen::Base::String& scheme, const Tizen::Base::String& host, const Tizen::Base::String& path, const Tizen::Base::String& fragment) @@ -140,7 +129,6 @@ Uri::SetUri(const Tizen::Base::String& scheme, const Tizen::Base::String& host, return SetUri(scheme, empty, empty, empty, host, -1, path, L"", fragment); } - result Uri::SetUri(const Tizen::Base::String& scheme, const Tizen::Base::String& authority, const Tizen::Base::String& path, const Tizen::Base::String& query, @@ -152,7 +140,6 @@ Uri::SetUri(const Tizen::Base::String& scheme, const Tizen::Base::String& author return SetUri(scheme, empty, authority, empty, empty, -1, path, query, fragment); } - //////////////////////////////////////////////////////////////////////////////// /// Operator @@ -166,7 +153,6 @@ Uri::operator =(const Uri& rhs) return *this; } - //////////////////////////////////////////////////////////////////////////////// // Accessor @@ -176,105 +162,90 @@ Uri::GetAuthority(void) const return __authority; } - Tizen::Base::String Uri::GetFragment(void) const { return __fragment; } - Tizen::Base::String Uri::GetHost(void) const { return __host; } - Tizen::Base::String Uri::GetPath(void) const { return __path; } - int Uri::GetPort(void) const { return __port; } - Tizen::Base::String Uri::GetQuery(void) const { return __query; } - Tizen::Base::String Uri::GetScheme(void) const { return __scheme; } - Tizen::Base::String Uri::GetSchemeSpecificPart(void) const { return __ssp; } - Tizen::Base::String Uri::GetUserInfo(void) const { return __userInfo; } - Tizen::Base::String Uri::GetEncodedAuthority(void) const { return __encodedAuth; } - Tizen::Base::String Uri::GetEncodedFragment(void) const { return __encodedFragment; } - Tizen::Base::String Uri::GetEncodedPath(void) const { return __encodedPath; } - Tizen::Base::String Uri::GetEncodedQuery(void) const { return __encodedQuery; } - Tizen::Base::String Uri::GetEncodedSchemeSpecificPart(void) const { return __encodedSsp; } - Tizen::Base::String Uri::GetEncodedUserInfo(void) const { return __encodedUserInfo; } - bool Uri::IsAbsolute(void) const { @@ -289,7 +260,6 @@ Uri::IsAbsolute(void) const } } - bool Uri::IsOpaque(void) const { @@ -318,7 +288,6 @@ Uri::IsOpaque(void) const } } - Tizen::Base::String Uri::GetEncodedString(void) const { @@ -331,14 +300,12 @@ Uri::GetEncodedString(void) const strbuf.Append(L':'); } - //AppendSchemeSpecificPart(strbuf, __encodedSsp, __encodedAuth, __encodedUserInfo, __host, __port, __encodedPath, __encodedQuery); if (!__encodedSsp.IsEmpty()) { strbuf.Append(__encodedSsp); } else { - //r = AppendAuthority(strbuf, __authority, __userInfo, __host, __port); if (!__host.IsEmpty()) { // Check the Host @@ -397,7 +364,6 @@ Uri::GetEncodedString(void) const } // AppendAuthority end - if (!__encodedPath.IsEmpty()) { strbuf.Append(__encodedPath); @@ -411,7 +377,6 @@ Uri::GetEncodedString(void) const } // AppendSchemeSpecificPart end - //AppendFragment(strbuf, __encodedFragment); if (!__encodedFragment.IsEmpty()) { @@ -423,7 +388,6 @@ Uri::GetEncodedString(void) const return strbuf; } - //////////////////////////////////////////////////////////////////////////////////////////// // Operations @@ -475,7 +439,6 @@ Uri::CompareTo(const Uri& uri) const return -1; } - ////////////////////////////////////////////////// // Hierarchical // ///////////////////////////////////////////////// @@ -544,12 +507,11 @@ Uri::CompareTo(const Uri& uri) const return ret; } - bool Uri::Equals(const Tizen::Base::Object& obj) const { // Check that obj is an Uri instance. - const Uri* pOther = dynamic_cast (&obj); + const Uri* pOther = dynamic_cast< const Uri* >(&obj); if (pOther == null) { return false; @@ -564,14 +526,12 @@ Uri::Equals(const Tizen::Base::Object& obj) const return true; } - int Uri::GetHashCode(void) const { return ToString().GetHashCode(); } - Uri Uri::Normalize(void) { @@ -636,7 +596,6 @@ Uri::Normalize(void) return resultUri; } - result Uri::ParseAuthority(Uri& uri) { @@ -669,21 +628,18 @@ Uri::ParseAuthority(Uri& uri) return r; } - result Uri::Relativize(const Uri& uri, Uri& resultUri) { return Relativize(*this, uri, resultUri); } - result Uri::Resolve(const Uri& uri, Uri& resultUri) { return Resolve(*this, uri, resultUri); } - result Uri::SetAuthority(const Tizen::Base::String& authority) { @@ -705,7 +661,6 @@ Uri::SetAuthority(const Tizen::Base::String& authority) return E_SUCCESS; } - result Uri::SetFragment(const Tizen::Base::String& fragment) { @@ -727,7 +682,6 @@ Uri::SetFragment(const Tizen::Base::String& fragment) return E_SUCCESS; } - result Uri::SetHost(const Tizen::Base::String& host) { @@ -740,7 +694,6 @@ Uri::SetHost(const Tizen::Base::String& host) return E_SUCCESS; } - result Uri::SetPath(const Tizen::Base::String& path) { @@ -762,7 +715,6 @@ Uri::SetPath(const Tizen::Base::String& path) return E_SUCCESS; } - result Uri::SetPort(int port) { @@ -773,7 +725,6 @@ Uri::SetPort(int port) return E_SUCCESS; } - result Uri::SetQuery(const Tizen::Base::String& query) { @@ -795,7 +746,6 @@ Uri::SetQuery(const Tizen::Base::String& query) return E_SUCCESS; } - result Uri::SetScheme(const Tizen::Base::String& scheme) { @@ -808,7 +758,6 @@ Uri::SetScheme(const Tizen::Base::String& scheme) return E_SUCCESS; } - result Uri::SetSchemeSpecificPart(const Tizen::Base::String& ssp) { @@ -830,7 +779,6 @@ Uri::SetSchemeSpecificPart(const Tizen::Base::String& ssp) return E_SUCCESS; } - result Uri::SetUserInfo(const Tizen::Base::String& userInfo) { @@ -852,7 +800,6 @@ Uri::SetUserInfo(const Tizen::Base::String& userInfo) return E_SUCCESS; } - Tizen::Base::String Uri::ToString(void) const { @@ -865,14 +812,12 @@ Uri::ToString(void) const strbuf.Append(L':'); } - //AppendSchemeSpecificPart(strbuf, __ssp, __authority, __userInfo, __host, __port, __path, __query); if (IsOpaque()) { strbuf.Append(__ssp); } else { - //r = AppendAuthority(strbuf, __authority, __userInfo, __host, __port); if (!__host.IsEmpty()) { // Check the Host @@ -931,7 +876,6 @@ Uri::ToString(void) const } // AppendAuthority end - if (!__path.IsEmpty()) { strbuf.Append(__path); @@ -945,7 +889,6 @@ Uri::ToString(void) const } // AppendSchemeSpecificPart end - //AppendFragment(strbuf, __fragment); if (!__fragment.IsEmpty()) { @@ -957,10 +900,8 @@ Uri::ToString(void) const return strbuf; } - //////////////////////////////////////////////////////////////////////// // Private methods - // // This method constructs an URI instance. // @@ -1022,7 +963,6 @@ CATCH: return r; } - result Uri::AppendSchemeSpecificPart(Tizen::Base::String& strbuf, const Tizen::Base::String& opaque, const Tizen::Base::String& authority, const Tizen::Base::String& userInfo, const Tizen::Base::String& host, int port, @@ -1096,7 +1036,6 @@ CATCH: return r; } - result Uri::AppendFragment(Tizen::Base::String& strbuf, const Tizen::Base::String& fragment) const { @@ -1129,7 +1068,6 @@ CATCH: return r; } - result Uri::AppendAuthority(Tizen::Base::String& strbuf, const Tizen::Base::String& authority, const Tizen::Base::String& userInfo, const Tizen::Base::String& host, @@ -1183,7 +1121,6 @@ Uri::AppendAuthority(Tizen::Base::String& strbuf, const Tizen::Base::String& aut int indexOf = 0; result re = E_SUCCESS; re = host.IndexOf(L':', 0, indexOf); - //if (IsFailed(r)) goto CATCH; String openBracket(L"["); String closeBracket(L"]"); @@ -1277,7 +1214,6 @@ CATCH: return r; } - // // This method breaks a given string into Uri components. // str : [scheme:][#] @@ -1482,7 +1418,7 @@ Uri::ParseUri(const Tizen::Base::String& str) ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Parse an authority component. The authority component is registry_based or server_based authority.// - // Server_based authority consists of user-info, host and port. // + // Server_based authority consists of user-info, host and port.// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if (!authority.IsEmpty()) { @@ -1549,7 +1485,6 @@ Uri::ParseUri(const Tizen::Base::String& str) __encodedFragment = Encode(fragment); } - // curIndex = lengthOfUri; curIndex += fragment.GetLength() + 1; // skip '#' } @@ -1567,7 +1502,6 @@ CATCH: return r; } - void Uri::SetAndEncodeAuthority(const Tizen::Base::String& authority, const Tizen::Base::String& path, const Tizen::Base::String& query) { @@ -1622,7 +1556,6 @@ Uri::SetAndEncodeAuthority(const Tizen::Base::String& authority, const Tizen::Ba } } - result Uri::ParseHierarchicalUri(const Tizen::Base::String& str, int startSsp, Tizen::Base::String& authority, Tizen::Base::String& path, Tizen::Base::String& query, @@ -1740,7 +1673,6 @@ CATCH: return r; } - // // This method parses an authority component. // This component is server based or registrty authority. @@ -1780,7 +1712,6 @@ Uri::ParseAuthority(const Tizen::Base::String& str, int curIndex, Tizen::Base::S return E_SUCCESS; } - // // This method parses a server_based authority componenet. // server_based authority : [user-info@][:port] @@ -1817,39 +1748,6 @@ Uri::ParseServerAuthority(const Tizen::Base::String& str, Tizen::Base::String& u { // IPv6 not supported return E_INVALID_FORMAT; -#if 0 - // IPv6 address - index++; - - if (str[str.GetLength() - 1] == L']') - { - String ip6; - String outIpv6; - - r = str.SubString(1, str.GetLength() - 2, ip6); - if (IsFailed(r)) - { - goto CATCH; - } - - // TODO : Parsing IPv6 is not implemented. - r = ParseIPv6(ip6, outIpv6); - if (IsFailed(r)) - { - goto CATCH; - } - - // TODO : Because IPv6 is hardly used, a member variable for IPv6 stores it directly. - __ipv6 = outIpv6; - - index += str.GetLength(); - } - else - { - r = E_INVALID_FORMAT; // This component has no closing bracket although it is a IPv6 address. - goto CATCH; - } -#endif } else { @@ -1951,7 +1849,6 @@ CATCH: return r; } - // // This method parses a host name and returns a host name as an out-param. // @@ -2007,7 +1904,6 @@ CATCH: return r; } - // // This method parses an IPv6 address. // This method covers all and only the following cases : @@ -2031,7 +1927,6 @@ Uri::ParseIpv6(const Tizen::Base::String& ip6, Tizen::Base::String& outIpv6) return E_SUCCESS; } - result Uri::ParseIpv4(const Tizen::Base::String& str, int start, int& count) { @@ -2058,7 +1953,6 @@ Uri::ParseIpv4(const Tizen::Base::String& str, int start, int& count) if (ch != L'.' && !(Character::IsDigit(ch))) { count = -1; - //r = E_INVALID_FORMAT; goto CATCH; } } @@ -2094,7 +1988,6 @@ CATCH: return r; } - ////////////////////////////////////////////////////////////////////////////////////////// // Verify a component @@ -2125,7 +2018,6 @@ Uri::VerifyScheme(const Tizen::Base::String& str) const return true; } - bool Uri::VerifyAuthority(const Tizen::Base::String& str) const { @@ -2142,7 +2034,6 @@ Uri::VerifyAuthority(const Tizen::Base::String& str) const } } - bool Uri::VerifyHost(const Tizen::Base::String& str) const { @@ -2167,7 +2058,6 @@ Uri::VerifyHost(const Tizen::Base::String& str) const return true; } - bool Uri::VerifyPath(const Tizen::Base::String& str) const { @@ -2201,12 +2091,10 @@ Uri::VerifyPath(const Tizen::Base::String& str) const return false; } } - } return true; } - bool Uri::VerifyUserInfo(const Tizen::Base::String& str) const { @@ -2243,12 +2131,10 @@ Uri::VerifyUserInfo(const Tizen::Base::String& str) const return true; } - bool Uri::VerifyUriChar(const Tizen::Base::String& str) const { result r = E_SUCCESS; -// String reserved(L";/?:@&=+$,[]"); // [ ] removed form "reserved" // RFC 2732: (Format for Literal IPv6 Addresses in URLs) is not supported for now. String reserved(L";/?:@&=+$,"); @@ -2294,7 +2180,6 @@ Uri::VerifyUriChar(const Tizen::Base::String& str) const return true; } - // // This method checks that a given string consists of only server_based characters. // @return True if a string consists of only server_based characters. @@ -2312,11 +2197,7 @@ Uri::VerifyServerAuthority(const Tizen::Base::String& str) const { wchar_t ch = str[i]; r = special.IndexOf(ch, 0, indexOf); - //if (r == E_SUCCESS && indexOf >= 0) - //{ - // return true; - //} - // + if (ch == L'-' || IsUserInfo(ch) || r == E_SUCCESS) { // This string is a server_based authority character @@ -2328,7 +2209,6 @@ Uri::VerifyServerAuthority(const Tizen::Base::String& str) const return false; } } -// return true; } else { @@ -2342,7 +2222,6 @@ Uri::VerifyServerAuthority(const Tizen::Base::String& str) const return true; } - // // This method checks that a given string consists of only registry_based characters. // @return True if a string consists of only registry_based characters. @@ -2380,7 +2259,6 @@ Uri::VerifyRegistryAuthority(const Tizen::Base::String& str) const return true; } - ////////////////////////////////////////////////////////////////////// // Utility methods such as IsUserInfo, IsMark and so on. @@ -2409,7 +2287,6 @@ Uri::IsUserInfo(wchar_t mch) const return false; } - // // This method returns true if a given wchar_t is a mark character. // mark char : -_.!~*'() @@ -2431,7 +2308,6 @@ Uri::IsMark(wchar_t mch) const return false; } - bool Uri::IsControlChar(wchar_t ch) const { @@ -2445,7 +2321,6 @@ Uri::IsControlChar(wchar_t ch) const } } - bool Uri::IsEscapedChar(wchar_t ch1, wchar_t ch2) const { @@ -2460,7 +2335,6 @@ Uri::IsEscapedChar(wchar_t ch1, wchar_t ch2) const return false; } - //////////////////////////////////////////////////////////////////////// // Private operations @@ -2489,7 +2363,6 @@ Uri::Scan(const Tizen::Base::String& str, int start, const Tizen::Base::String& return index; } - // // This method convers a component represented by UTF8 to a component represented by Unicode. // @@ -2545,7 +2418,7 @@ Uri::Decode(const Tizen::Base::String& str) String unicode; r = StringUtil::Utf8ToString((char*) bb.GetPointer(), unicode); -// if (IsFailed(r)) goto CATCH; + if (IsFailed(r)) { decodedBuf.Append(L'?'); @@ -2562,7 +2435,6 @@ CATCH: return str; } - // // This method converts a component represented by Unicode to a component represented by UTF8. // @@ -2664,7 +2536,6 @@ Uri::Encode(const Tizen::Base::String& str) const return strbuf; } - result Uri::AppendEscape(Tizen::Base::String& strbuf, byte b) { @@ -2698,7 +2569,6 @@ CATCH: return r; } - // This method compares str1 and str2 after replacing all uppercase letters with their lowercase letters int Uri::Compare(const Tizen::Base::String& str1, const Tizen::Base::String& str2) const @@ -2736,7 +2606,6 @@ Uri::Compare(const Tizen::Base::String& str1, const Tizen::Base::String& str2) c } - ////////////////////////////////////////////////////////////////////////////////////////// // Normalization @@ -2796,7 +2665,6 @@ Uri::InternalNormalize(const Tizen::Base::String& path) return joinedStr; } - // // This method returns the number of segments from a given path. // @@ -2867,7 +2735,6 @@ Uri::GetNumberOfSegments(const Tizen::Base::String& path) const } } - void Uri::SplitIntoSegments(Tizen::Base::WcharBuffer& mb, int* segments, int segCount) { @@ -2925,7 +2792,6 @@ Uri::SplitIntoSegments(Tizen::Base::WcharBuffer& mb, int* segments, int segCount // index must be equal to the length of segments[] } - void Uri::RemoveDots(const Tizen::Base::WcharBuffer& mb, int* segments, int segCount, int length) { @@ -2997,7 +2863,6 @@ Uri::RemoveDots(const Tizen::Base::WcharBuffer& mb, int* segments, int segCount, } } - void Uri::AddLeadingDot(Tizen::Base::WcharBuffer& mb, int* segments, int segCount) { @@ -3043,7 +2908,6 @@ Uri::AddLeadingDot(Tizen::Base::WcharBuffer& mb, int* segments, int segCount) segments[0] = 0; } - // Join the segments in the given path according to the given segment-index array, // ignoring those segments whose index entries have been set to -1, and inserting slashes as needed. // Return the length of the resulting path. @@ -3058,7 +2922,6 @@ Uri::AddLeadingDot(Tizen::Base::WcharBuffer& mb, int* segments, int segCount) int Uri::Join(Tizen::Base::WcharBuffer& mb, int* segments, int segCount) { - //int end = StringUtil::GetStringLengthInMb(mb); int end = mb.GetLimit() - 1; int p = 0; @@ -3118,7 +2981,6 @@ Uri::Join(Tizen::Base::WcharBuffer& mb, int* segments, int segCount) return p; } - /////////////////////////////////////////////////////////////////////////////////////////////// // Resolution @@ -3137,7 +2999,6 @@ Uri::Resolve(const Uri& baseUri, const Uri& childUri, Uri& resultUri) return E_SUCCESS; } - // 5.2(2) If scheme, authority, path, and query of childUri are null, // the components of baseUri are copied to components of resultUri. if ((childUri.__scheme.IsEmpty()) && (childUri.__authority.IsEmpty()) && (childUri.__path.IsEmpty()) @@ -3217,7 +3078,6 @@ Uri::Resolve(const Uri& baseUri, const Uri& childUri, Uri& resultUri) return E_SUCCESS; } - // 5.2(3) child is an absolute URI if (!childUri.__scheme.IsEmpty()) { @@ -3225,7 +3085,6 @@ Uri::Resolve(const Uri& baseUri, const Uri& childUri, Uri& resultUri) return E_SUCCESS; } - if (!baseUri.__scheme.IsEmpty()) { r = resultUri.SetScheme(baseUri.__scheme); @@ -3363,13 +3222,11 @@ Uri::Resolve(const Uri& baseUri, const Uri& childUri, Uri& resultUri) return r; } } - } return E_SUCCESS; } - // RFC2396 5.2(6) Tizen::Base::String Uri::ResolvePath(const String& basePath, const String& childPath, bool isAbsolute) @@ -3430,7 +3287,6 @@ CATCH: return null; } - ////////////////////////////////////////////////////////////////////////// // Relativize result @@ -3528,7 +3384,6 @@ Uri::Relativize(const Uri& baseUri, const Uri& childUri, Uri& resultUri) return r; } - // // This method compares two components. If a component is encoded, // then its raw component is compared with another component. @@ -3536,7 +3391,7 @@ Uri::Relativize(const Uri& baseUri, const Uri& childUri, Uri& resultUri) bool Uri::EqualsComponent(const Tizen::Base::String& comp1, const Tizen::Base::String& comp2) { - result r = E_SUCCESS; + result r = E_SUCCESS; if (comp1 == comp2) { @@ -3571,7 +3426,6 @@ Uri::EqualsComponent(const Tizen::Base::String& comp1, const Tizen::Base::String } i++; - if (Character::ToLower(comp1[i]) == Character::ToLower(comp2[i])) { return false; @@ -3589,7 +3443,6 @@ Uri::EqualsComponent(const Tizen::Base::String& comp1, const Tizen::Base::String return true; } - bool Uri::IsEncoded(const Tizen::Base::String& str) const { @@ -3605,7 +3458,6 @@ Uri::IsEncoded(const Tizen::Base::String& str) const return true; } - void Uri::Clear(void) { @@ -3629,6 +3481,4 @@ Uri::Clear(void) __encodedQuery.Clear(); __encodedSsp.Clear(); } - - -} } } // Tizen::Base::Utility +}}} // Tizen::Base::Utility \ No newline at end of file diff --git a/src/base/utility/FBaseUtilUrlDecoder.cpp b/src/base/utility/FBaseUtilUrlDecoder.cpp index 6a9677d..c9d1425 100644 --- a/src/base/utility/FBaseUtilUrlDecoder.cpp +++ b/src/base/utility/FBaseUtilUrlDecoder.cpp @@ -18,8 +18,6 @@ * @file FBaseUtilUrlDecoder.cpp * @brief This is the implementation file for UrlDecoder class. */ - -// Includes #include #include #include @@ -36,7 +34,6 @@ #include "FBase_NativeError.h" #include "FBaseUtil_IcuConverter.h" - namespace Tizen { namespace Base { namespace Utility { @@ -45,13 +42,11 @@ UrlDecoder::UrlDecoder(void) } - UrlDecoder::~UrlDecoder(void) { } - result UrlDecoder::Decode(const Tizen::Base::String& str, const Tizen::Base::String& encodingScheme, Tizen::Base::String& decodedStr) { @@ -72,7 +67,7 @@ UrlDecoder::Decode(const Tizen::Base::String& str, const Tizen::Base::String& en numChars = str.GetLength(); pMchar = str.GetPointer(); - pIn = const_cast(&pMchar[0]); + pIn = const_cast< wchar_t* >(&pMchar[0]); std::unique_ptr< char[] > pUrlDecodedBuf(new (std::nothrow) char[numChars + 1]); SysTryReturnResult(NID_BASE_UTIL, pUrlDecodedBuf != null, E_OUT_OF_MEMORY, "Memory allocation failed."); @@ -114,7 +109,7 @@ UrlDecoder::Decode(const Tizen::Base::String& str, const Tizen::Base::String& en found = false; } - (*pIn == '+') ? decodedStr.Append(' '):decodedStr.Append(*pIn); + (*pIn == '+') ? decodedStr.Append(' ') : decodedStr.Append(*pIn); pIn++; charCount--; } @@ -132,4 +127,4 @@ UrlDecoder::Decode(const Tizen::Base::String& str, const Tizen::Base::String& en converter.CloseConverter(); return r; } -} } } // Tizen::Base::Utility +}}} // Tizen::Base::Utility \ No newline at end of file diff --git a/src/base/utility/FBaseUtilUrlEncoder.cpp b/src/base/utility/FBaseUtilUrlEncoder.cpp index 5bb7c7f..72dc509 100644 --- a/src/base/utility/FBaseUtilUrlEncoder.cpp +++ b/src/base/utility/FBaseUtilUrlEncoder.cpp @@ -18,8 +18,6 @@ * @file FBaseUtilUrlEncoder.cpp * @brief This is the implementation file for UrlEncoder class. */ - -// Includes #include #include #include @@ -36,11 +34,9 @@ #include "FBase_NativeError.h" #include "FBaseUtil_IcuConverter.h" - namespace Tizen { namespace Base { namespace Utility { - /////////////////////////////////////////////////////////////////////////////// /// UrlEncoder class lifecycle @@ -48,12 +44,10 @@ UrlEncoder::UrlEncoder(void) { } - UrlEncoder::~UrlEncoder(void) { } - /////////////////////////////////////////////////////////////////////////////// /// UrlEncoder class Operations @@ -88,7 +82,6 @@ UrlEncoder::Encode(const Tizen::Base::String& str, const Tizen::Base::String& en for (int j = 0; j < retLength; j++) { - char hexChar[4]; memset(&hexChar, 0x00, 4); sprintf(hexChar, "%%%02X", (unsigned char) pOutBuf[j]); @@ -98,7 +91,7 @@ UrlEncoder::Encode(const Tizen::Base::String& str, const Tizen::Base::String& en startIndex = -1; } - (pTmpBytePtr[i] == ' ') ? encodedStr.Append('+'):encodedStr.Append(pTmpBytePtr[i]); + (pTmpBytePtr[i] == ' ') ? encodedStr.Append('+') : encodedStr.Append(pTmpBytePtr[i]); } else if (startIndex < 0) { @@ -115,7 +108,6 @@ UrlEncoder::Encode(const Tizen::Base::String& str, const Tizen::Base::String& en for (int j = 0; j < retLength; j++) { - char hexChar[4]; memset(&hexChar, 0x00, 4); sprintf(hexChar, "%%%02X", (unsigned char) pOutBuf[j]); @@ -128,4 +120,4 @@ UrlEncoder::Encode(const Tizen::Base::String& str, const Tizen::Base::String& en converter.CloseConverter(); return r; } -} } } // Tizen::Base::Utility +}}} // Tizen::Base::Utility \ No newline at end of file diff --git a/src/base/utility/FBaseUtilZipEntry.cpp b/src/base/utility/FBaseUtilZipEntry.cpp index a89614a..b48eeda 100644 --- a/src/base/utility/FBaseUtilZipEntry.cpp +++ b/src/base/utility/FBaseUtilZipEntry.cpp @@ -19,7 +19,6 @@ * @brief This is the implementation file for ZipEntry class. */ -//Includes #include #include "FBaseUtil_ZipEntryInfo.h" @@ -27,7 +26,6 @@ namespace Tizen { namespace Base { namespace Utility { - ZipEntry::ZipEntry(void) : __unzFile(null) , __compressionLevel(DEFAULT_COMPRESSION) @@ -35,67 +33,59 @@ ZipEntry::ZipEntry(void) { } - ZipEntry::~ZipEntry(void) { if (__unzFile) { - delete static_cast <_ZipEntryInfo*>(__unzFile); + delete static_cast< _ZipEntryInfo* >(__unzFile); __unzFile = null; } } - String ZipEntry::GetName(void) const { return __name; } - CompressionLevel ZipEntry::GetCompressionLevel(void) const { return __compressionLevel; } - bool ZipEntry::IsDirectory(void) const { - _ZipEntryInfo* pZipEntryInfo = static_cast <_ZipEntryInfo*>(__unzFile); + _ZipEntryInfo* pZipEntryInfo = static_cast< _ZipEntryInfo* >(__unzFile); return pZipEntryInfo->__isDirectory; } - unsigned long ZipEntry::GetCompressedSize(void) const { - _ZipEntryInfo* pZipEntryInfo = static_cast <_ZipEntryInfo*>(__unzFile); + _ZipEntryInfo* pZipEntryInfo = static_cast< _ZipEntryInfo* >(__unzFile); return pZipEntryInfo->__compressedSize; } - unsigned long ZipEntry::GetUncompressedSize(void) const { - _ZipEntryInfo* pZipEntryInfo = static_cast <_ZipEntryInfo*>(__unzFile); + _ZipEntryInfo* pZipEntryInfo = static_cast< _ZipEntryInfo* >(__unzFile); return pZipEntryInfo->__uncompressedSize; } - String ZipEntry::GetArchiveName(void) const { - _ZipEntryInfo* pZipEntryInfo = static_cast <_ZipEntryInfo*>(__unzFile); + _ZipEntryInfo* pZipEntryInfo = static_cast< _ZipEntryInfo* >(__unzFile); return pZipEntryInfo->__archiveName; } - bool ZipEntry::Equals(const Tizen::Base::Object& obj) const { - const ZipEntry* pOther = dynamic_cast (&obj); + const ZipEntry* pOther = dynamic_cast< const ZipEntry* >(&obj); if (pOther != null) { @@ -115,25 +105,20 @@ ZipEntry::Equals(const Tizen::Base::Object& obj) const } } return true; - } - int ZipEntry::GetHashCode(void) const { return (int) this; } - void ZipEntry::Set(void* unzFile) { - _ZipEntryInfo* pZipEntryInfo = static_cast <_ZipEntryInfo*>(unzFile); + _ZipEntryInfo* pZipEntryInfo = static_cast< _ZipEntryInfo* >(unzFile); __name = pZipEntryInfo->__name; __unzFile = pZipEntryInfo; __compressionLevel = pZipEntryInfo->__compressionLevel; } - - -} } } // Tizen::Base::Utility +}}} // Tizen::Base::Utility \ No newline at end of file diff --git a/src/base/utility/FBaseUtil_ZipEntryInfo.h b/src/base/utility/FBaseUtil_ZipEntryInfo.h index 08845ca..a162f5d 100644 --- a/src/base/utility/FBaseUtil_ZipEntryInfo.h +++ b/src/base/utility/FBaseUtil_ZipEntryInfo.h @@ -26,7 +26,6 @@ #include #include - namespace Tizen { namespace Base { namespace Utility { @@ -61,9 +60,7 @@ public: private: friend class _FileUnzipperImpl; - -}; // _ZipEntryInfo +}; // _ZipEntryInfo }}} // Tizen::Base::Utility - -#endif // _FBASE_UTIL_ZIP_ENTRY_INFO_H_ +#endif // _FBASE_UTIL_ZIP_ENTRY_INFO_H_ \ No newline at end of file