2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file FTextGsmEncoding.cpp
20 * @brief This is the implementation file for GSM Encoding class.
23 #include <FTextGsmEncoding.h>
24 #include <FBaseSysLog.h>
25 #include "FText_EncodingImpl.h"
28 #define ENCODING_NAME L"GSM"
30 using namespace Tizen::Base;
32 namespace Tizen { namespace Text
35 GsmEncoding::GsmEncoding(void)
36 : __pGsmEncodingImpl(null)
38 _pEncodingImpl = new (std::nothrow) _EncodingImpl;
41 result r = _pEncodingImpl->Construct(ENCODING_NAME);
44 delete _pEncodingImpl;
45 _pEncodingImpl = null;
49 SysAssert(_pEncodingImpl);
53 GsmEncoding::~GsmEncoding(void)
55 delete _pEncodingImpl;
60 GsmEncoding::GetByteCount(const String& str, int& byteCount) const
62 return _pEncodingImpl->GetByteCount(str, byteCount);
67 GsmEncoding::GetByteCount(const WcharBuffer& chars, int& byteCount) const
69 return _pEncodingImpl->GetByteCount(chars, byteCount);
74 GsmEncoding::GetByteCount(const WcharBuffer& chars, int charIndex, int charCount, int& byteCount) const
76 return _pEncodingImpl->GetByteCount(chars, charIndex, charCount, byteCount);
81 GsmEncoding::GetBytesN(const WcharBuffer& chars) const
83 return _pEncodingImpl->GetBytesN(chars);
88 GsmEncoding::GetBytesN(const String& str) const
90 return _pEncodingImpl->GetBytesN(str);
95 GsmEncoding::GetBytes(const WcharBuffer& chars, int charIndex, int charCount, ByteBuffer& bytes, int byteIndex) const
97 return _pEncodingImpl->GetBytes(chars, charIndex, charCount, bytes, byteIndex);
102 GsmEncoding::GetBytes(const String& str, int charIndex, int charCount, ByteBuffer& bytes, int byteIndex) const
104 return _pEncodingImpl->GetBytes(str, charIndex, charCount, bytes, byteIndex);
109 GsmEncoding::GetCharCount(const ByteBuffer& bytes, int& charCount) const
111 return _pEncodingImpl->GetCharCount(bytes, charCount);
116 GsmEncoding::GetCharCount(const ByteBuffer& bytes, int byteIndex, int byteCount, int& charCount) const
118 return _pEncodingImpl->GetCharCount(bytes, byteIndex, byteCount, charCount);
123 GsmEncoding::GetCharsN(const ByteBuffer& bytes) const
125 return _pEncodingImpl->GetCharsN(bytes);
130 GsmEncoding::GetChars(const ByteBuffer& bytes, int byteIndex, int byteCount, WcharBuffer& chars, int charIndex) const
132 return _pEncodingImpl->GetChars(bytes, byteIndex, byteCount, chars, charIndex);
137 GsmEncoding::GetString(const ByteBuffer& bytes, String& str) const
139 return GetString(bytes, bytes.GetPosition(), bytes.GetRemaining(), str);
144 GsmEncoding::GetString(const ByteBuffer& bytes, int index, int count, String& str) const
146 return _pEncodingImpl->GetString(bytes, index, count, str);
151 GsmEncoding::GetMaxByteCount(int charCount) const
153 return charCount * 2;
158 GsmEncoding::GetMaxCharCount(int byteCount) const
165 GsmEncoding::GetEncoderN(void) const
172 GsmEncoding::GetDecoderN(void) const
179 GsmEncoding::GetEncodingType(void) const
181 return String(ENCODING_NAME);