0

ICUでライブラリがデフォルトとして使用されていることを読みbackendましたboost::locale。もしそうならUnicodeString、ブーストでICUのタイプを使用できますか?誰かが例を教えてください..

編集:これは私が最後に試したことです..ここでは、wstring に保存する代わりに、UnicodeString が必要です。

#include <boost/locale.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/fstream.hpp>
#include <fcntl.h>
#include <io.h>
int main()
{

    boost::locale::localization_backend_manager my = boost::locale::localization_backend_manager::global();
    my.select("icu");



    _setmode(_fileno(stdout), _O_WTEXT); // for output

    std::locale::global(boost::locale::generator(my).generate(""));


    boost::filesystem::path::imbue(std::locale());
    boost::filesystem::wifstream hello("I:\\a.txt");//Contents of this file can be strings in regional language

    if (hello.is_open())
    {

        for (std::wstring s; getline(hello, s); )
        {
            std::wcout << s;//need a UnicodeString instead of s.
            std::wstring cmd = L"I:\\";
            cmd += s;
            boost::filesystem::wifstream hello1(cmd);
            if (hello1.is_open())
            {
                std::wstring i;
                while(getline(hello1,i))
                    std::wcout << i;
            }
            hello1.close();

        }
    }
    hello.close();
}
4

0 に答える 0