www.digitalmars.com         C & C++   DMDScript  

c++.stlsoft - platformstl::path on MinGW on Windows - uses Unicode

reply Adi Shavit <adishavit_thisDoesNotBelongHere_ gmail.com> writes:
Hi,

  I'm using platformstl::path on MinGW on Windows (via the Qt Creator IDE).
It redirects to using winstl::path. However, it seems to define path to use
wide-char/Unicode encoding by default (for the file names for example).

How can I change this default?

As a workaround I changed to explicitly using winstl::path_a, but this is not
portable to Unix/Linux.

Please advise,
Thanks,
Adi
Nov 05 2010
parent reply "Matt Wilson" <matthewwilson acm.org> writes:
IIRC it defines winstl::path as winstl::basic_path<TCHAR>, so it depends on 
the defin. of UNICODE.

Checking now ... yes, that's right.

  typedef basic_path<TCHAR, filesystem_traits<TCHAR> > path;

unixstl::path is defined as char, since the definition of UNICODE is not a 
done practice on UNIX. (Or if it is, that's a new one on me.)

I recognise that this is a little odd, but it was the best choice I could 
come up with. Have an open ear to other ideas ...


"Adi Shavit" <adishavit_thisDoesNotBelongHere_ gmail.com> wrote in message 
news:ib1o23$h5$1 digitalmars.com...
 Hi,

  I'm using platformstl::path on MinGW on Windows (via the Qt Creator IDE).
 It redirects to using winstl::path. However, it seems to define path to 
 use wide-char/Unicode encoding by default (for the file names for 
 example).

 How can I change this default?

 As a workaround I changed to explicitly using winstl::path_a, but this is 
 not portable to Unix/Linux.

 Please advise,
 Thanks,
 Adi
 

Nov 05 2010
parent reply Adi Shavit <adishavit_thisDoesNotBelongHere_ gmail.com> writes:
So let me see if I get you correctly:

1. I want to use platformstl (and not winstl) for portability (to Linux).
2. I want to always work with chars
3. There seems to be no platformstl::path_a

I ended up doing this:

#ifdef UNICODE
#undef UNICODE
#include "3rdParty/stlsoft-1.9.101/include/platformstl/filesystem/path.hpp"
#define UNICODE
#endif
 
and use platformstl::path

Is this the right approach?

Suggestion: If platformstl::path_a was available it would have been simpler...

Thanks,
Adi

Matt Wilson Wrote:

 IIRC it defines winstl::path as winstl::basic_path<TCHAR>, so it depends on 
 the defin. of UNICODE.
 
 Checking now ... yes, that's right.
 
   typedef basic_path<TCHAR, filesystem_traits<TCHAR> > path;
 
 unixstl::path is defined as char, since the definition of UNICODE is not a 
 done practice on UNIX. (Or if it is, that's a new one on me.)
 
 I recognise that this is a little odd, but it was the best choice I could 
 come up with. Have an open ear to other ideas ...
 
 
 "Adi Shavit" <adishavit_thisDoesNotBelongHere_ gmail.com> wrote in message 
 news:ib1o23$h5$1 digitalmars.com...
 Hi,

  I'm using platformstl::path on MinGW on Windows (via the Qt Creator IDE).
 It redirects to using winstl::path. However, it seems to define path to 
 use wide-char/Unicode encoding by default (for the file names for 
 example).

 How can I change this default?

 As a workaround I changed to explicitly using winstl::path_a, but this is 
 not portable to Unix/Linux.

 Please advise,
 Thanks,
 Adi
 


Nov 08 2010
next sibling parent Matt Wilson <matthewwilson acm.org> writes:
Adi Shavit Wrote:

 So let me see if I get you correctly:
 
 1. I want to use platformstl (and not winstl) for portability (to Linux).
 2. I want to always work with chars
 3. There seems to be no platformstl::path_a
 
 I ended up doing this:
 
 #ifdef UNICODE
 #undef UNICODE
 #include "3rdParty/stlsoft-1.9.101/include/platformstl/filesystem/path.hpp"
 #define UNICODE
 #endif
  
 and use platformstl::path
 
 Is this the right approach?
 
 Suggestion: If platformstl::path_a was available it would have been simpler...

Yuck! That's not good. Point taken.
Nov 08 2010
prev sibling parent "Matt Wilson" <matthewwilson acm.org> writes:
This is now done as you suggest.

Matt

"Adi Shavit" <adishavit_thisDoesNotBelongHere_ gmail.com> wrote in message 
news:ib9n4e$2m6l$1 digitalmars.com...
 So let me see if I get you correctly:

 1. I want to use platformstl (and not winstl) for portability (to Linux).
 2. I want to always work with chars
 3. There seems to be no platformstl::path_a

 I ended up doing this:

 #ifdef UNICODE
 #undef UNICODE
 #include 
 "3rdParty/stlsoft-1.9.101/include/platformstl/filesystem/path.hpp"
 #define UNICODE
 #endif

 and use platformstl::path

 Is this the right approach?

 Suggestion: If platformstl::path_a was available it would have been 
 simpler...

 Thanks,
 Adi

 Matt Wilson Wrote:

 IIRC it defines winstl::path as winstl::basic_path<TCHAR>, so it depends 
 on
 the defin. of UNICODE.

 Checking now ... yes, that's right.

   typedef basic_path<TCHAR, filesystem_traits<TCHAR> > path;

 unixstl::path is defined as char, since the definition of UNICODE is not 
 a
 done practice on UNIX. (Or if it is, that's a new one on me.)

 I recognise that this is a little odd, but it was the best choice I could
 come up with. Have an open ear to other ideas ...


 "Adi Shavit" <adishavit_thisDoesNotBelongHere_ gmail.com> wrote in 
 message
 news:ib1o23$h5$1 digitalmars.com...
 Hi,

  I'm using platformstl::path on MinGW on Windows (via the Qt Creator 
 IDE).
 It redirects to using winstl::path. However, it seems to define path to
 use wide-char/Unicode encoding by default (for the file names for
 example).

 How can I change this default?

 As a workaround I changed to explicitly using winstl::path_a, but this 
 is
 not portable to Unix/Linux.

 Please advise,
 Thanks,
 Adi



Nov 21 2010