+//
+// 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 <sys/stat.h>
#include <stdio.h>
#include <errno.h>
#include <FBaseSysLog.h>
#include "FBaseUtil_ScannerImpl.h"
-
using namespace Tizen::Base::Collection;
using namespace Tizen::Base::Utility;
using namespace Tizen::Base;
__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.");
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.");
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) ||
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) ||
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) ||
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) ||
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) ||
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) ||
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());
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
* @brief This is the implementation file for StringTokenizer class.
* @see String class
*/
-
-// Includes
#include <FBaseUtilStringTokenizer.h>
#include <FBaseString.h>
#include <FBaseResult.h>
#include <FBaseSysLog.h>
-
namespace Tizen { namespace Base { namespace Utility
{
-
/////////////////////////////////////////////////////////////////////////////
// StringTokenizer class lifecycle
__maxDelimChar = SetMaxDelimChar();
}
-
StringTokenizer::~StringTokenizer(void)
{
}
-
/////////////////////////////////////////////////////////////////////////////////////
// StringTokenizer class operations
return count;
}
-
bool
StringTokenizer::HasMoreTokens(void)
{
return true;
}
-
result
StringTokenizer::GetNextToken(String& token)
{
return r;
}
-
result
StringTokenizer::SetDelimiters(const String& delimiters)
{
return E_SUCCESS;
}
-
////////////////////////////////////////////////////////////////////////////////////////////////////
// StringTokenizer class private methods
return maxChar;
}
-
int
StringTokenizer::SkipDelimiters(int position)
{
return tmpPosition;
}
-
int
StringTokenizer::ScanToken(int position)
{
return tmpPosition;
}
-
-
-} } } // Tizen::Base::Utility
+}}} // Tizen::Base::Utility
\ No newline at end of file
* @file FBaseUtilStringUtil.cpp
* @brief This is the implementation file for StringUtil class.
*/
-
-// Includes
#include <stdlib.h>
#include <new>
#include <unique_ptr.h>
#include "FBase_StringConverter.h"
#include "FBaseUtil_IcuConverter.h"
-
// Base64 Encoding Table
static const char Base64EncodingTable[] =
{
'4', '5', '6', '7', '8', '9', '+', '/'
};
-
// Base64 Decoding Table
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
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 // F0-FF
};
-
namespace Tizen { namespace Base { namespace Utility
{
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;
return pEncodedBuf.release();
}
-
result
StringUtil::Utf8ToString(const char* pUtf8String, String& unicodeString)
{
return r;
}
-
ByteBuffer*
StringUtil::DecodeBase64StringN(const String& base64String)
{
return pBuffer.release();
}
-
result
StringUtil::EncodeToBase64String(const ByteBuffer& buffer, String& encodedString)
{
return r;
}
-} } } // Tizen::Base::Utility
+}}} // Tizen::Base::Utility
\ No newline at end of file
* @file FBaseUtilUri.cpp
* @brief This is the implementation file for Uri class.
*/
-
-// Includes
#include <stdlib.h>
#include <stdio.h>
#include <new>
#include <FBaseUtilStringUtil.h>
#include <FBaseSysLog.h>
-
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
{
}
-
Uri::Uri(const Uri& uri)
: __pUriImpl(null)
{
SetUri(uri);
}
-
Uri::~Uri(void)
{
Clear();
}
-
void
Uri::SetUri(const Uri& uri)
{
__ipv6ByteCount = uri.__ipv6ByteCount;
}
-
result
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)
{
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,
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)
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,
return SetUri(scheme, empty, authority, empty, empty, -1, path, query, fragment);
}
-
////////////////////////////////////////////////////////////////////////////////
/// Operator
return *this;
}
-
////////////////////////////////////////////////////////////////////////////////
// Accessor
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
{
}
}
-
bool
Uri::IsOpaque(void) const
{
}
}
-
Tizen::Base::String
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
}
// AppendAuthority end
-
if (!__encodedPath.IsEmpty())
{
strbuf.Append(__encodedPath);
}
// AppendSchemeSpecificPart end
-
//AppendFragment(strbuf, __encodedFragment);
if (!__encodedFragment.IsEmpty())
{
return strbuf;
}
-
////////////////////////////////////////////////////////////////////////////////////////////
// Operations
return -1;
}
-
//////////////////////////////////////////////////
// Hierarchical //
/////////////////////////////////////////////////
return ret;
}
-
bool
Uri::Equals(const Tizen::Base::Object& obj) const
{
// Check that obj is an Uri instance.
- const Uri* pOther = dynamic_cast <const Uri*>(&obj);
+ const Uri* pOther = dynamic_cast< const Uri* >(&obj);
if (pOther == null)
{
return false;
return true;
}
-
int
Uri::GetHashCode(void) const
{
return ToString().GetHashCode();
}
-
Uri
Uri::Normalize(void)
{
return resultUri;
}
-
result
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)
{
return E_SUCCESS;
}
-
result
Uri::SetFragment(const Tizen::Base::String& fragment)
{
return E_SUCCESS;
}
-
result
Uri::SetHost(const Tizen::Base::String& host)
{
return E_SUCCESS;
}
-
result
Uri::SetPath(const Tizen::Base::String& path)
{
return E_SUCCESS;
}
-
result
Uri::SetPort(int port)
{
return E_SUCCESS;
}
-
result
Uri::SetQuery(const Tizen::Base::String& query)
{
return E_SUCCESS;
}
-
result
Uri::SetScheme(const Tizen::Base::String& scheme)
{
return E_SUCCESS;
}
-
result
Uri::SetSchemeSpecificPart(const Tizen::Base::String& ssp)
{
return E_SUCCESS;
}
-
result
Uri::SetUserInfo(const Tizen::Base::String& userInfo)
{
return E_SUCCESS;
}
-
Tizen::Base::String
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
}
// AppendAuthority end
-
if (!__path.IsEmpty())
{
strbuf.Append(__path);
}
// AppendSchemeSpecificPart end
-
//AppendFragment(strbuf, __fragment);
if (!__fragment.IsEmpty())
{
return strbuf;
}
-
////////////////////////////////////////////////////////////////////////
// Private methods
-
//
// This method constructs an URI instance.
//
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,
return r;
}
-
result
Uri::AppendFragment(Tizen::Base::String& strbuf, const Tizen::Base::String& fragment) const
{
return r;
}
-
result
Uri::AppendAuthority(Tizen::Base::String& strbuf, const Tizen::Base::String& authority, const Tizen::Base::String& userInfo,
const Tizen::Base::String& host,
int indexOf = 0;
result re = E_SUCCESS;
re = host.IndexOf(L':', 0, indexOf);
- //if (IsFailed(r)) goto CATCH;
String openBracket(L"[");
String closeBracket(L"]");
return r;
}
-
//
// This method breaks a given string into Uri components.
// str : [scheme:]<scheme-specific-part>[#<fragment>]
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 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())
{
__encodedFragment = Encode(fragment);
}
- // curIndex = lengthOfUri;
curIndex += fragment.GetLength() + 1; // skip '#'
}
return r;
}
-
void
Uri::SetAndEncodeAuthority(const Tizen::Base::String& authority, const Tizen::Base::String& path, const Tizen::Base::String& query)
{
}
}
-
result
Uri::ParseHierarchicalUri(const Tizen::Base::String& str, int startSsp, Tizen::Base::String& authority, Tizen::Base::String& path,
Tizen::Base::String& query,
return r;
}
-
//
// This method parses an authority component.
// This component is server based or registrty authority.
return E_SUCCESS;
}
-
//
// This method parses a server_based authority componenet.
// server_based authority : [user-info@]<host>[:port]
{
// 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
{
return r;
}
-
//
// This method parses a host name and returns a host name as an out-param.
//
return r;
}
-
//
// This method parses an IPv6 address.
// This method covers all and only the following cases :
return E_SUCCESS;
}
-
result
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;
}
}
return r;
}
-
//////////////////////////////////////////////////////////////////////////////////////////
// Verify a component
return true;
}
-
bool
Uri::VerifyAuthority(const Tizen::Base::String& str) const
{
}
}
-
bool
Uri::VerifyHost(const Tizen::Base::String& str) const
{
return true;
}
-
bool
Uri::VerifyPath(const Tizen::Base::String& str) const
{
return false;
}
}
-
}
return true;
}
-
bool
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";/?:@&=+$,");
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.
{
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
return false;
}
}
-// return true;
}
else
{
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.
return true;
}
-
//////////////////////////////////////////////////////////////////////
// Utility methods such as IsUserInfo, IsMark and so on.
return false;
}
-
//
// This method returns true if a given wchar_t is a mark character.
// mark char : -_.!~*'()
return false;
}
-
bool
Uri::IsControlChar(wchar_t ch) const
{
}
}
-
bool
Uri::IsEscapedChar(wchar_t ch1, wchar_t ch2) const
{
return false;
}
-
////////////////////////////////////////////////////////////////////////
// Private operations
return index;
}
-
//
// This method convers a component represented by UTF8 to a component represented by Unicode.
//
String unicode;
r = StringUtil::Utf8ToString((char*) bb.GetPointer(), unicode);
-// if (IsFailed(r)) goto CATCH;
+
if (IsFailed(r))
{
decodedBuf.Append(L'?');
return str;
}
-
//
// This method converts a component represented by Unicode to a component represented by UTF8.
//
return strbuf;
}
-
result
Uri::AppendEscape(Tizen::Base::String& strbuf, byte b)
{
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
}
-
//////////////////////////////////////////////////////////////////////////////////////////
// Normalization
return joinedStr;
}
-
//
// This method returns the number of segments from a given path.
//
}
}
-
void
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)
{
}
}
-
void
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.
int
Uri::Join(Tizen::Base::WcharBuffer& mb, int* segments, int segCount)
{
- //int end = StringUtil::GetStringLengthInMb(mb);
int end = mb.GetLimit() - 1;
int p = 0;
return p;
}
-
///////////////////////////////////////////////////////////////////////////////////////////////
// Resolution
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())
return E_SUCCESS;
}
-
// 5.2(3) child is an absolute URI
if (!childUri.__scheme.IsEmpty())
{
return E_SUCCESS;
}
-
if (!baseUri.__scheme.IsEmpty())
{
r = resultUri.SetScheme(baseUri.__scheme);
return r;
}
}
-
}
return E_SUCCESS;
}
-
// RFC2396 5.2(6)
Tizen::Base::String
Uri::ResolvePath(const String& basePath, const String& childPath, bool isAbsolute)
return null;
}
-
//////////////////////////////////////////////////////////////////////////
// Relativize
result
return r;
}
-
//
// This method compares two components. If a component is encoded,
// then its raw component is compared with another component.
bool
Uri::EqualsComponent(const Tizen::Base::String& comp1, const Tizen::Base::String& comp2)
{
- result r = E_SUCCESS;
+ result r = E_SUCCESS;
if (comp1 == comp2)
{
}
i++;
-
if (Character::ToLower(comp1[i]) == Character::ToLower(comp2[i]))
{
return false;
return true;
}
-
bool
Uri::IsEncoded(const Tizen::Base::String& str) const
{
return true;
}
-
void
Uri::Clear(void)
{
__encodedQuery.Clear();
__encodedSsp.Clear();
}
-
-
-} } } // Tizen::Base::Utility
+}}} // Tizen::Base::Utility
\ No newline at end of file
* @file FBaseUtilUrlDecoder.cpp
* @brief This is the implementation file for UrlDecoder class.
*/
-
-// Includes
#include <stdio.h>
#include <stdlib.h>
#include <wchar.h>
#include "FBase_NativeError.h"
#include "FBaseUtil_IcuConverter.h"
-
namespace Tizen { namespace Base { namespace Utility
{
}
-
UrlDecoder::~UrlDecoder(void)
{
}
-
result
UrlDecoder::Decode(const Tizen::Base::String& str, const Tizen::Base::String& encodingScheme, Tizen::Base::String& decodedStr)
{
numChars = str.GetLength();
pMchar = str.GetPointer();
- pIn = const_cast<wchar_t*>(&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.");
found = false;
}
- (*pIn == '+') ? decodedStr.Append(' '):decodedStr.Append(*pIn);
+ (*pIn == '+') ? decodedStr.Append(' ') : decodedStr.Append(*pIn);
pIn++;
charCount--;
}
converter.CloseConverter();
return r;
}
-} } } // Tizen::Base::Utility
+}}} // Tizen::Base::Utility
\ No newline at end of file
* @file FBaseUtilUrlEncoder.cpp
* @brief This is the implementation file for UrlEncoder class.
*/
-
-// Includes
#include <stdio.h>
#include <stdlib.h>
#include <wchar.h>
#include "FBase_NativeError.h"
#include "FBaseUtil_IcuConverter.h"
-
namespace Tizen { namespace Base { namespace Utility
{
-
///////////////////////////////////////////////////////////////////////////////
/// UrlEncoder class lifecycle
{
}
-
UrlEncoder::~UrlEncoder(void)
{
}
-
///////////////////////////////////////////////////////////////////////////////
/// UrlEncoder class Operations
for (int j = 0; j < retLength; j++)
{
-
char hexChar[4];
memset(&hexChar, 0x00, 4);
sprintf(hexChar, "%%%02X", (unsigned char) pOutBuf[j]);
startIndex = -1;
}
- (pTmpBytePtr[i] == ' ') ? encodedStr.Append('+'):encodedStr.Append(pTmpBytePtr[i]);
+ (pTmpBytePtr[i] == ' ') ? encodedStr.Append('+') : encodedStr.Append(pTmpBytePtr[i]);
}
else if (startIndex < 0)
{
for (int j = 0; j < retLength; j++)
{
-
char hexChar[4];
memset(&hexChar, 0x00, 4);
sprintf(hexChar, "%%%02X", (unsigned char) pOutBuf[j]);
converter.CloseConverter();
return r;
}
-} } } // Tizen::Base::Utility
+}}} // Tizen::Base::Utility
\ No newline at end of file
* @brief This is the implementation file for ZipEntry class.
*/
-//Includes
#include <FBaseUtilZipEntry.h>
#include "FBaseUtil_ZipEntryInfo.h"
namespace Tizen { namespace Base { namespace Utility
{
-
ZipEntry::ZipEntry(void)
: __unzFile(null)
, __compressionLevel(DEFAULT_COMPRESSION)
{
}
-
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 <const ZipEntry*>(&obj);
+ const ZipEntry* pOther = dynamic_cast< const ZipEntry* >(&obj);
if (pOther != null)
{
}
}
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
#include <FBaseUtilTypes.h>
#include <FBaseString.h>
-
namespace Tizen { namespace Base { namespace Utility
{
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