2012-12-02 22:14:24 +01:00
|
|
|
// Copyright (c) 2012, Thomas Goyne <plorkyeran@aegisub.org>
|
|
|
|
//
|
|
|
|
// Permission to use, copy, modify, and distribute this software for any
|
|
|
|
// purpose with or without fee is hereby granted, provided that the above
|
|
|
|
// copyright notice and this permission notice appear in all copies.
|
|
|
|
//
|
|
|
|
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
|
|
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
|
|
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
|
|
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
2009-07-14 23:28:49 +02:00
|
|
|
//
|
2009-07-29 07:43:02 +02:00
|
|
|
// Aegisub Project http://www.aegisub.org/
|
|
|
|
|
|
|
|
/// @file charset_conv.h
|
|
|
|
/// @see charset_conv.cpp
|
|
|
|
/// @ingroup utility
|
|
|
|
///
|
2009-07-14 23:28:49 +02:00
|
|
|
|
2009-07-18 02:58:13 +02:00
|
|
|
#include <wx/string.h>
|
|
|
|
#include <wx/strconv.h>
|
2009-09-11 04:36:34 +02:00
|
|
|
#include <wx/thread.h>
|
2009-07-14 23:28:49 +02:00
|
|
|
|
2010-06-03 22:32:25 +02:00
|
|
|
#include <libaegisub/charset_conv.h>
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @class AegisubCSConv
|
2010-01-24 19:56:51 +01:00
|
|
|
/// @brief wxMBConv implementation for converting to and from unicode
|
2009-07-14 23:28:49 +02:00
|
|
|
class AegisubCSConv : public wxMBConv {
|
|
|
|
public:
|
|
|
|
|
|
|
|
// wxMBConv implementation; see strconv.h for usage details
|
2010-01-24 19:56:51 +01:00
|
|
|
size_t ToWChar(wchar_t *dst, size_t dstLen, const char *src, size_t srcLen = wxNO_LEN) const;
|
|
|
|
size_t FromWChar(char *dst, size_t dstLen, const wchar_t *src, size_t srcLen = wxNO_LEN) const;
|
2012-11-13 17:51:01 +01:00
|
|
|
wxMBConv *Clone() const { return nullptr; };
|
2009-07-14 23:28:49 +02:00
|
|
|
|
2010-06-03 22:32:25 +02:00
|
|
|
protected:
|
|
|
|
AegisubCSConv();
|
2009-07-14 23:28:49 +02:00
|
|
|
private:
|
2010-06-03 22:32:25 +02:00
|
|
|
AegisubCSConv(const AegisubCSConv&);
|
|
|
|
AegisubCSConv& operator=(const AegisubCSConv&);
|
|
|
|
wxString localCharset;
|
2009-07-14 23:28:49 +02:00
|
|
|
|
2010-01-24 19:56:51 +01:00
|
|
|
mutable wxMutex iconvMutex;
|
|
|
|
|
2010-06-03 22:32:25 +02:00
|
|
|
// ToWChar and FromWChar are const in wxMBConv, but iconv can't be used
|
|
|
|
// immutably
|
|
|
|
mutable agi::charset::IconvWrapper conv;
|
2009-07-14 23:28:49 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
extern AegisubCSConv& csConvLocal;
|