Fixed .la dependency tracking for -lpthread
[barry.git] / src / iconvwin.cc
blob8d734b28a0174627a2682875741e2feed8e8bb58
1 ///
2 /// \file iconvwin.cc
3 /// iconv wrapper class for Windows
4 ///
6 /*
7 Copyright (C) 2008-2011, Net Direct Inc. (http://www.netdirect.ca/)
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU General Public License in the COPYING file at the
19 root directory of this project for more details.
22 #include "iconv.h"
23 #include "common.h"
24 #include "error.h"
25 #include <errno.h>
26 #include <string>
28 using namespace std;
30 namespace Barry {
32 //////////////////////////////////////////////////////////////////////////////
33 // IConvHandlePrivate class
34 class IConvHandlePrivate
36 public:
39 //////////////////////////////////////////////////////////////////////////////
40 // IConvHandle class
42 IConvHandle::IConvHandle(const char *fromcode,
43 const char *tocode,
44 bool throw_on_conv_err)
45 : m_priv( new IConvHandlePrivate )
46 , m_throw_on_conv_err(throw_on_conv_err)
50 IConvHandle::IConvHandle(const char *fromcode,
51 const IConverter &ic,
52 bool throw_on_conv_err)
53 : m_priv( new IConvHandlePrivate )
54 , m_throw_on_conv_err(throw_on_conv_err)
58 IConvHandle::IConvHandle(const IConverter &ic,
59 const char *tocode,
60 bool throw_on_conv_err)
61 : m_priv( new IConvHandlePrivate )
62 , m_throw_on_conv_err(throw_on_conv_err)
66 IConvHandle::~IConvHandle()
70 std::string IConvHandle::Convert(Data &tmp, const std::string &str) const
72 // FIXME - need to add Windows support
73 return str;
77 //////////////////////////////////////////////////////////////////////////////
78 // IConvHandle class
80 IConverter::IConverter(const char *tocode, bool throw_on_conv_err)
81 : m_from(BLACKBERRY_CHARSET, tocode, throw_on_conv_err)
82 , m_to(tocode, BLACKBERRY_CHARSET, throw_on_conv_err)
83 , m_tocode(tocode)
87 IConverter::~IConverter()
91 std::string IConverter::FromBB(const std::string &str) const
93 return m_from.Convert(m_buffer, str);
96 std::string IConverter::ToBB(const std::string &str) const
98 return m_to.Convert(m_buffer, str);
101 std::string IConverter::Convert(const IConvHandle &custom, const std::string &str) const
103 return custom.Convert(m_buffer, str);
106 } // namespace Barry