How to get the basic_path specialization for TCHAR ?
Hello
Is there a nice why to select a basic_path specialization with the
current with of TCHAR ?
I mean like a string or wstring can be selected with
basic_string<TCHAR>, I would like to select path or wpath with something
like basic_path
[Please do not mail me a copy of your followup]
boost-users@lists.boost.org spake the secret code
Is there a nice why to select a basic_path specialization with the current with of TCHAR ?
TCHAR is just a typedef for char or wchar_t. So anyplace you would use char or wchar_t as a template argument you can use TCHAR. -- "The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download http://legalizeadulthood.wordpress.com/the-direct3d-graphics-pipeline/ Legalize Adulthood! http://legalizeadulthood.wordpress.com
Richard wrote:
[Please do not mail me a copy of your followup]
boost-users@lists.boost.org spake the secret code
thusly: Is there a nice why to select a basic_path specialization with the current with of TCHAR ?
TCHAR is just a typedef for char or wchar_t. So anyplace you would use char or wchar_t as a template argument you can use TCHAR.
Ok and how could I specialize basic_path with TCHAR to get a path if TCHAR is char, and a wpath if TCHAR is wchar_t ? Timothy Madden
[Please do not mail me a copy of your followup]
boost-users@lists.boost.org spake the secret code
Richard wrote:
[Please do not mail me a copy of your followup]
boost-users@lists.boost.org spake the secret code
thusly: Is there a nice why to select a basic_path specialization with the current with of TCHAR ?
TCHAR is just a typedef for char or wchar_t. So anyplace you would use char or wchar_t as a template argument you can use TCHAR.
Ok and how could I specialize basic_path with TCHAR to get a path if TCHAR is char, and a wpath if TCHAR is wchar_t ?
Looking at path.hpp in my boost 1.40 distribution, we have for narrow
strings:
struct path_traits;
typedef basic_path< std::string, path_traits > path;
struct path_traits
{
typedef std::string internal_string_type;
typedef std::string external_string_type;
static external_string_type to_external( const path &,
const internal_string_type & src ) { return src; }
static internal_string_type to_internal(
const external_string_type & src ) { return src; }
};
...and for wide strings:
# ifndef BOOST_FILESYSTEM_NARROW_ONLY
struct BOOST_FILESYSTEM_DECL wpath_traits;
typedef basic_path< std::wstring, wpath_traits > wpath;
struct BOOST_FILESYSTEM_DECL wpath_traits
{
typedef std::wstring internal_string_type;
# ifdef BOOST_WINDOWS_API
typedef std::wstring external_string_type;
static external_string_type to_external( const wpath &,
const internal_string_type & src ) { return src; }
static internal_string_type to_internal(
const external_string_type & src ) { return src; }
# else
typedef std::string external_string_type;
static external_string_type to_external( const wpath & ph,
const internal_string_type & src );
static internal_string_type to_internal(
const external_string_type & src );
# endif
static void imbue( const std::locale & loc );
static bool imbue( const std::locale & loc, const std::nothrow_t & );
};
# endif // ifndef BOOST_FILESYSTEM_NARROW_ONLY
Remember that std::string is a typedef for std::basic_string<char> and
std::wstring is a typedef for std::basic_string
participants (2)
-
legalize+jeeves@mail.xmission.com
-
Timothy Madden