2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Apache License, Version 2.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
18 * @file FTextAsciiEncoding.cpp
19 * @brief This is the implementation file for ASCII Encoding class.
22 #include <FTextAsciiEncoding.h>
23 #include <FBaseSysLog.h>
24 #include "FText_EncodingImpl.h"
27 #define ENCODING_NAME L"ASCII"
29 using namespace Tizen::Base;
31 namespace Tizen { namespace Text
35 AsciiEncoding::AsciiEncoding(void)
36 : __pAsciiEncodingImpl(null)
38 _pEncodingImpl = new (std::nothrow) _EncodingImpl;
41 result r = _pEncodingImpl->Construct(ENCODING_NAME);
44 delete _pEncodingImpl;
45 _pEncodingImpl = null;
49 SysAssert(_pEncodingImpl);
53 AsciiEncoding::~AsciiEncoding(void)
55 delete _pEncodingImpl;
60 AsciiEncoding::GetBytesN(const WcharBuffer& chars) const
62 return _pEncodingImpl->GetBytesN(chars);
66 AsciiEncoding::GetBytesN(const String& str) const
68 return _pEncodingImpl->GetBytesN(str);
73 AsciiEncoding::GetBytes(const WcharBuffer& chars, int charIndex, int charCount, ByteBuffer& bytes, int byteIndex) const
75 return _pEncodingImpl->GetBytes(chars, charIndex, charCount, bytes, byteIndex);
80 AsciiEncoding::GetBytes(const String& str, int charIndex, int charCount, ByteBuffer& bytes, int byteIndex) const
82 return _pEncodingImpl->GetBytes(str, charIndex, charCount, bytes, byteIndex);
87 AsciiEncoding::GetCharsN(const ByteBuffer& bytes) const
89 return _pEncodingImpl->GetCharsN(bytes);
94 AsciiEncoding::GetChars(const ByteBuffer& bytes, int byteIndex, int byteCount, WcharBuffer& chars, int charIndex) const
96 return _pEncodingImpl->GetChars(bytes, byteIndex, byteCount, chars, charIndex);
101 AsciiEncoding::GetString(const ByteBuffer& bytes, String& str) const
103 return _pEncodingImpl->GetString(bytes, str);
108 AsciiEncoding::GetString(const ByteBuffer& bytes, int byteIndex, int byteCount, String& str) const
110 return _pEncodingImpl->GetString(bytes, byteIndex, byteCount, str);
115 AsciiEncoding::GetMaxByteCount(int charCount) const
122 AsciiEncoding::GetMaxCharCount(int byteCount) const
129 AsciiEncoding::GetEncoderN(void) const
136 AsciiEncoding::GetDecoderN(void) const
143 AsciiEncoding::GetEncodingType(void) const
145 return String(ENCODING_NAME);