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>
23 #define _WINSOCKAPI_ // the dance of the windows headers.
26 // #define FD_SETSIZE 1000
27 // if you don't set this, you can only select on a default of 64 sockets.
30 #ifndef __GNU_WINDOWS__
37 class _bstr_t; // ATL (Active Template Library) string type.
39 //! A collection of conversions between popular string types.
41 namespace string_convert
45 //! conversion from MFC CString to astring.
46 inline astring to_astring(const CString &original)
47 { return astring(from_unicode_temp(original)); }
49 //! conversion from astring to MFC CString.
50 inline CString to_CString(const astring &original)
51 { return CString(to_unicode_temp(original)); }
56 #ifndef __GNU_WINDOWS__
57 //! conversion from ATL's _bstr_t object to astring.
58 inline basis::astring to_astring(const _bstr_t &original) {
59 return basis::astring(basis::astring::UNTERMINATED, (const char *)original,
63 //! conversion from astring to the ATL _bstr_t object.
64 inline _bstr_t to_bstr_t(const basis::astring &original)
65 { return _bstr_t(original.s()); }