// filesystem windows_file_codecvt.cpp -----------------------------------------//

     // Copyright Beman Dawes 2009

     // Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt // Library home page: http://www.boost.org/libs/filesystem //--------------------------------------------------------------------------------------// // define BOOST_FILESYSTEM_SOURCE so that <boost/system/config.hpp> knows
// the library is being built (possibly exporting rather than importing code)
#define BOOST_FILESYSTEM_SOURCE #ifndef BOOST_SYSTEM_NO_DEPRECATED
# define BOOST_SYSTEM_NO_DEPRECATED
#endif #include <boost/filesystem/config.hpp>
#include <cwchar> // for mbstate_t #ifdef BOOST_WINDOWS_API #include "windows_file_codecvt.hpp" // Versions of MinGW prior to GCC 4.6 requires this
#ifndef WINVER
# define WINVER 0x0500
#endif #include <windows.h> std::codecvt_base::result windows_file_codecvt::do_in(
std::mbstate_t &,
const char* from, const char* from_end, const char*& from_next,
wchar_t* to, wchar_t* to_end, wchar_t*& to_next) const
{
UINT codepage = AreFileApisANSI() ? CP_ACP : CP_OEMCP; int count;
if ((count = ::MultiByteToWideChar(codepage, MB_PRECOMPOSED, from,
from_end - from, to, to_end - to)) == )
{
return error; // conversion failed
} from_next = from_end;
to_next = to + count;
*to_next = L'\0';
return ok;
} std::codecvt_base::result windows_file_codecvt::do_out(
std::mbstate_t &,
const wchar_t* from, const wchar_t* from_end, const wchar_t* & from_next,
char* to, char* to_end, char* & to_next) const
{
UINT codepage = AreFileApisANSI() ? CP_ACP : CP_OEMCP; int count;
if ((count = ::WideCharToMultiByte(codepage, WC_NO_BEST_FIT_CHARS, from,
from_end - from, to, to_end - to, , )) == )
{
return error; // conversion failed
} from_next = from_end;
to_next = to + count;
*to_next = '\0';
return ok;
} # endif // BOOST_WINDOWS_API

https://github.com/chigraph/chigraph/blob/master/third_party/boost/filesystem/windows_file_codecvt.cpp

CP_ACP : CP_OEMCP的更多相关文章

  1. VC中支持中文的字符串比较函数

    VS2008开发环境,多字符集和UNICODE字符集都可用. WCHAR * mbcsToUnicode(const char *zStr) { int nByte; WCHAR *zMbcsStr; ...

  2. unicode字符和多字节字符的相互转换接口

    作者:朱金灿 来源:http://blog.csdn.net/clever101 发现开源代码的可利用资源真多,从sqlite3的源码中抠出了几个字符转换接口,稍微改造下了发现还挺好用的.下面是实现代 ...

  3. sqlite学习笔记之sqlite3_open函数的使用

    作者:朱金灿 来源:http://blog.csdn.net/clever101 打开sqlite数据库需要用到sqlite3_open函数,但是sqlite3_open函数的第一个参数是数据库文件的 ...

  4. Windows上的字符转换之CP_ACP和CP_OEMCP

    原文地址:http://blog.sina.com.cn/s/blog_53c1950a010158mw.html Windows API函数MultiByteToWideChar用于多字节编码字符串 ...

  5. CP_THREAD_ACP与CP_ACP

    在使用MultiByteToWideChar的时候,大部分都知道上述两个参数,MSDN上的解释也是简单到极致.通常我们会选择使用CP_ACP,但是总有人会在没有真正明白它们之间的区别前使用CP_THR ...

  6. 关于多字节、宽字节、WideCharToMultiByte和MultiByteToWideChar函数的详解

    所谓的短字符,就是用8bit来表示的字符,典型的应用是ASCII码. 而宽字符,顾名思义,就是用16bit表示的字符,典型的有UNICODE. **************************** ...

  7. C#封装好的Win32API

    Kernel.cs using System; using System.Runtime.InteropServices; using System.Text; using HANDLE = Syst ...

  8. C#和VC++字符集和编码

    C# char 关键字用于声明 .NET framework 使用 Unicode 字符表示 System.Char 结构的实例. Char 对象的值是 16 位数字 (序号值.)将字符表示为 UTF ...

  9. VC++编程中常用的字符串转换函数

    VC++编程中经常遇到不同编码编码的字符串之间需要转换的情况,以下简单提供几个不同编码字符串之间的转换函数: ANSI 字符串和Unicode字符串之间的转换 //Convert wide char ...

随机推荐

  1. 判断是iphone或是ipad 和 系统版本

    //判断是iphone或是ipad等 NSLog(@"Device -- %@",[UIDevice currentDevice].model); //系统版本 NSLog(@&q ...

  2. Android多线程研究(9)——读写锁

    一.什么是锁 在Java的util.concurrent.locks包下有关于锁的接口和类如下: 先看一段代码: package com.codeing.snail.test; public clas ...

  3. TrustedBSD Mandatory Access Control Framework分析

    本文为CoryXie原创译文,转载及有任何问题请联系cory.xie#gmail.com. 本文分析FreeBSD 10.0[ http://xrefs.info/freebsd-10.0/ ]的MA ...

  4. Cocos2d-x学习笔记(16)(常见22种特效)

    1.CCShaky3D::create(int range.bool shakeZ,const ccGridSize& gridSize,float duration)//创建一个3D晃动的特 ...

  5. [Node.js] Create a model to persist data in a Node.js LoopBack API

    In this lesson you will learn what a LoopBack model is, you will create a Product model using the Lo ...

  6. poj 2689 Prime Distance(大区间筛素数)

    http://poj.org/problem?id=2689 题意:给出一个大区间[L,U],分别求出该区间内连续的相差最小和相差最大的素数对. 由于L<U<=2147483647,直接筛 ...

  7. js进阶 11-7 jquery如何获取和改变元素的位置

    js进阶 11-7  jquery如何获取和改变元素的位置 一.总结 一句话总结:jquery中匿名函数中的index参数是什么意思.jquery对象多集合,故index为所选元素的下标. 1.jqu ...

  8. [Angular] @ViewChild and template #refs to get Element Ref

    We can use @ViewChild with component: @ViewChild(AuthMessageComponent) message: AuthMessageComponent ...

  9. Xcode编译Undefined symbols for architecture xxx 错误总结

    可能会遇到这几种错误:Undefined symbols for architecture armv7Undefined symbols for architecture armv7sUndefine ...

  10. 虚拟机的ip网络设置的选择

    首先看一下vm的这几个设置 通过截图可以基本看到几个网络设置的区别,具体体现在虚拟机装好以后,网络设置会多出两个适配器,不同模式会分配不同区段的ip,需要固定时主要区段要求 所以总结一下 1.桥连,适 ...