OpenEnroth 73e68f7
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
UnicodeCrt Class Reference

#include <UnicodeCrt.h>

Public Member Functions

 UnicodeCrt (int &argc, char **&argv)
 

Static Public Member Functions

static bool isInitialized ()
 

Private Attributes

std::vector< char * > _argv
 
std::vector< std::string > _storage
 

Detailed Description

Utility class that turns on UTF-8 for most of CRT, and converts command-line arguments to UTF-8. This is really only needed on Windows, and this class does nothing on POSIX.

Use it like this:

int main(int argc, char **argv) {
try {
UnicodeCrt _(argc, argv);
// Use argc & argv here.
} catch (...) {
// Your error processing here.
}
}
int main(int argc, char **argv)
Definition: LodTool.cpp:131
Definition: UnicodeCrt.h:29

Note that for this to work on older Windows versions, CRT should be statically linked. This is how OE releases are built right now.

Also note that while UnicodeCrt constructor shouldn't normally throw, it can throw in theory.

See also
https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/setlocale-wsetlocale?view=msvc-170#utf-8-support

Constructor & Destructor Documentation

◆ UnicodeCrt()

UnicodeCrt::UnicodeCrt ( int &  argc,
char **&  argv 
)

Member Function Documentation

◆ isInitialized()

bool UnicodeCrt::isInitialized ( )
static
Returns
Whether a UnicodeCrt was created, and thus CRT now uses UTF-8.

Member Data Documentation

◆ _argv

std::vector<char *> UnicodeCrt::_argv
private

◆ _storage

std::vector<std::string> UnicodeCrt::_storage
private

The documentation for this class was generated from the following files: