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 FTextAsciiEncoding.cpp
20 * @brief This is the implementation file for ASCII Encoding class.
23 #include <FTextAsciiEncoding.h>
24 #include <FBaseSysLog.h>
25 #include "FText_EncodingImpl.h"
28 #define ENCODING_NAME L"ASCII"
30 using namespace Tizen::Base;
32 namespace Tizen { namespace Text
36 AsciiEncoding::AsciiEncoding(void)
37 : __pAsciiEncodingImpl(null)
39 _pEncodingImpl = new (std::nothrow) _EncodingImpl;
42 result r = _pEncodingImpl->Construct(ENCODING_NAME);
45 delete _pEncodingImpl;
46 _pEncodingImpl = null;
50 SysAssert(_pEncodingImpl);
54 AsciiEncoding::~AsciiEncoding(void)
56 delete _pEncodingImpl;
61 AsciiEncoding::GetBytesN(const WcharBuffer& chars) const
63 return _pEncodingImpl->GetBytesN(chars);
67 AsciiEncoding::GetBytesN(const String& str) const
69 return _pEncodingImpl->GetBytesN(str);
74 AsciiEncoding::GetBytes(const WcharBuffer& chars, int charIndex, int charCount, ByteBuffer& bytes, int byteIndex) const
76 return _pEncodingImpl->GetBytes(chars, charIndex, charCount, bytes, byteIndex);
81 AsciiEncoding::GetBytes(const String& str, int charIndex, int charCount, ByteBuffer& bytes, int byteIndex) const
83 return _pEncodingImpl->GetBytes(str, charIndex, charCount, bytes, byteIndex);
88 AsciiEncoding::GetCharsN(const ByteBuffer& bytes) const
90 return _pEncodingImpl->GetCharsN(bytes);
95 AsciiEncoding::GetChars(const ByteBuffer& bytes, int byteIndex, int byteCount, WcharBuffer& chars, int charIndex) const
97 return _pEncodingImpl->GetChars(bytes, byteIndex, byteCount, chars, charIndex);
102 AsciiEncoding::GetString(const ByteBuffer& bytes, String& str) const
104 return _pEncodingImpl->GetString(bytes, str);
109 AsciiEncoding::GetString(const ByteBuffer& bytes, int byteIndex, int byteCount, String& str) const
111 return _pEncodingImpl->GetString(bytes, byteIndex, byteCount, str);
116 AsciiEncoding::GetMaxByteCount(int charCount) const
123 AsciiEncoding::GetMaxCharCount(int byteCount) const
130 AsciiEncoding::GetEncoderN(void) const
137 AsciiEncoding::GetDecoderN(void) const
144 AsciiEncoding::GetEncodingType(void) const
146 return String(ENCODING_NAME);