1 #ifndef STRING_CONVERSION_GROUP
2 #define STRING_CONVERSION_GROUP
4 /*****************************************************************************\
6 * Name : string_convert *
7 * Author : Chris Koeritz *
9 *******************************************************************************
10 * Copyright (c) 2007-$now By Author. This program is free software; you can *
11 * redistribute it and/or modify it under the terms of the GNU General Public *
12 * License as published by the Free Software Foundation; either version 2 of *
13 * the License or (at your option) any later version. This is online at: *
14 * http://www.fsf.org/copyleft/gpl.html *
15 * Please send any updates to: fred@gruntose.com *
16 \*****************************************************************************/
18 #include <basis/astring.h>
19 #include <basis/utf_conversion.h>
24 #define _WINSOCKAPI_ // the dance of the windows headers.
27 // #define FD_SETSIZE 1000
28 // if you don't set this, you can only select on a default of 64 sockets.
31 #ifndef __GNU_WINDOWS__
39 class _bstr_t; // ATL (Active Template Library) string type.
41 //! A collection of conversions between popular string types.
43 namespace string_convert
47 //! conversion from MFC CString to astring.
48 inline astring to_astring(const CString &original)
49 { return astring(from_unicode_temp(original)); }
51 //! conversion from astring to MFC CString.
52 inline CString to_CString(const astring &original)
53 { return CString(to_unicode_temp(original)); }
58 #ifndef __GNU_WINDOWS__
59 //! conversion from ATL's _bstr_t object to astring.
60 inline basis::astring to_astring(const _bstr_t &original) {
61 return basis::astring(basis::astring::UNTERMINATED, (const char *)original,
65 //! conversion from astring to the ATL _bstr_t object.
66 inline _bstr_t to_bstr_t(const basis::astring &original)
67 { return _bstr_t(original.s()); }