-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support wmain and wchar_t* argv #8
Comments
This can be done by converting it all into a a template on the char type. |
hmm would probably be better to construct from the wchar_t and then convert to utf8 instead? |
Maybe, but remember that there are a lot of I never actually needed this nor seem a compelling use case. As far as I can see it is very low priority. |
I would like to implement a wmain/wchar_t/wstring solution--it looks like #15 might go hand-in-hand for Windows developers and/or anyone using Unicode. Thoughts on a good way to implement without stepping on toes? For #15, I thought a preprocessor definition at the start allowing Windows developers to indicate as such might be appropriate, and then expose a Windows-specific parse() function (parse(mode)?) that would automatically use Window's ArgC/ArgV with the specified mode. As for this issue, supporting wmain/wchar_t, what do we think about making a second preprocessor directive that specifies string (ANSI) or wstring (UNICODE)? I suppose we could get fancy and overload each method to support string or wstring, and then convert if/as necessary, too. That would eliminate the need for preprocessor directives, but would increase Argh!'s length quite a bit. |
As I said above it could be templated on Regardless, please, no macros (preprocessor flags). Try a few approaches, see what works and what feels minimal yet expressive. |
This is my first time writing templated code, and I'm struggling with it. I made an attempt here, but wasn't very successful. I know you're opposed to macros, but it's what I know, so I made a second fork for a proof-of-concept here. UNICODE is generally already defined for Windows devs, but I thought it'd be easy enough to specify and/or change the gates so the dev who wants to use Argh! can select either. As a side discussion (but related), with respect to #15, when the default constructor(s) are modified to support unicode, Windows devs can simply pass the "__wargv" macro. For example:
|
I've made a draft solution by changing the parser class to a template class, like this:
and then
The solution thus allows existing code to pass unaltered (as Note: I had to change code layout and move function implementation into the class, sorry for that. I also patched the code to support both My files zipped: argh_wide.zip |
On Windows, support
wmain
andwchar_t* argv[]
The text was updated successfully, but these errors were encountered: