13 #pragma managed( push, off )    17 #pragma comment( lib, "shlwapi.lib" )    63             m_hFile = ::CreateFileW( pszPath, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, 
nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_ARCHIVE, 
nullptr );
    64             if ( INVALID_HANDLE_VALUE == 
m_hFile ) {
    88     bool CFile::Open( 
wchar_t const* pszPath, 
bool bWrite ) noexcept {
   101                 m_hFile = ::CreateFileW( pszPath, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, 
nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_ARCHIVE, 
nullptr );
   105                 m_hFile = ::CreateFileW( pszPath, GENERIC_READ, FILE_SHARE_READ, 
nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_ARCHIVE, 
nullptr );
   109             if ( INVALID_HANDLE_VALUE == 
m_hFile ) {
   145             if ( 0 != ::PathFileExistsW( pszPath ) ) {
   151             m_hFile = ::CreateFileW( pszPath, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, 
nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_ARCHIVE, 
nullptr );
   154             if ( INVALID_HANDLE_VALUE == 
m_hFile ) {
   212             if ( 
nullptr == pBuffer ) {
   217             else if ( 0 > nSize ) {
   227             BYTE*&   rpByte = 
reinterpret_cast< BYTE*& 
>( pBuffer );
   237                 DWORD dwRead = 
static_cast< DWORD 
>( nSize );
   238                 if ( UINT_MAX < nSize ) {
   244                 if ( 0 == ::ReadFile( 
m_hFile, rpByte, dwRead, &dwCount, 
nullptr ) ) {
   249                 else if ( dwRead != dwCount ) {
   273     LONGLONG 
CFile::Write( 
void const* pBuffer, LONGLONG nSize ) noexcept {
   278             if ( 
nullptr == pBuffer ) {
   283             else if ( 0 > nSize ) {
   293             BYTE 
const*& rpByte = 
reinterpret_cast< BYTE const*& 
>( pBuffer );
   303                 DWORD dwWrite = 
static_cast< DWORD 
>( nSize );
   304                 if ( UINT_MAX < nSize ) {
   310                 if ( 0 == ::WriteFile( 
m_hFile, rpByte, dwWrite, &dwCount, 
nullptr ) ) {
   315                 else if ( dwWrite != dwCount ) {
   345             if ( 0 == ::GetFileSizeEx( 
m_hFile, &sSize ) ) {
   351             result = sSize.QuadPart;
   365             static LARGE_INTEGER 
const sMove = {};
   366             LARGE_INTEGER              sPoint;
   367             if ( 0 == ::SetFilePointerEx( 
m_hFile, sMove, &sPoint, FILE_CURRENT ) ) {
   373             result = sPoint.QuadPart;
   387             LARGE_INTEGER sPoint;
   388             sPoint.QuadPart = nPoint;
   389             if ( 0 == ::SetFilePointerEx( 
m_hFile, sPoint, 
nullptr, FILE_BEGIN ) ) {
   409             if ( 0 == ::SetEndOfFile( 
m_hFile ) ) {
   429             if ( nCount < nSize ) {
   431                 nCount += 
static_cast< int >( 
Read( &pBuffer[ nCount ], nSize - nCount ) );
   432                 if ( nSize > nCount ) {
   463             unsigned char pBuffer[ MB_LEN_MAX ];
   469                 if ( 
nullptr != pBom ) {
   476                     else if ( 0 != ::memcmp( pBom, pBuffer, nSize ) ) {
   488                 if ( 
nullptr != pBom ) {
   495                     else if ( 0 != ::memcmp( pBom, pBuffer, nSize ) ) {
   509                 if ( nSize < nPoint ) {
   523             for ( 
bool bContinue = 
false;; bContinue = true ) {
   529                         if ( 0 < --nCount ) {
   531                             if ( 0 != ::memmove_s( pBuffer, 
sizeof pBuffer, &pBuffer[ 1 ], nCount ) ) {
   545                 else if ( 
IsAscii( pBuffer[ 0 ] ) ) {
   591                     else if ( 4 <= nSize ) {
   596                     else if ( bIsSJis ) {
   622                         ruCodePage     = CP_UTF8;
   649                 int nSeemTotal = ( nSeemUtf8 + nSeemSJis );
   650                 if ( 0 < nSeemTotal ) {
   651                     rnUtf8 = 
static_cast< int >( 100.0 * nSeemUtf8 / nSeemTotal );
   652                     rnSJis = 
static_cast< int >( 100.0 * nSeemSJis / nSeemTotal );
   671             void const* pBom = 
nullptr;
   673             if ( CP_ACP == uCodePage ) {
   682             else if ( CP_UTF8 == uCodePage ) {
   688             if ( 
nullptr == pBom ) {
   700             if ( nSize == static_cast< int >( 
Write( pBom, nSize ) ) ) {
   705                 if ( nSize >= static_cast< int >( nPoint ) ) {
   725         char unsigned const* result = 
nullptr;
   728             static char unsigned const BOM_UTF16[] = { 0xFF, 0xFE };
   729             static char unsigned const BOM_UTF8[]  = { 0xEF, 0xBB, 0xBF };
   732                 nSize   = 
sizeof BOM_UTF16;
   735             else if ( CP_UTF8 == uCodePage ) {
   737                 nSize   = 
sizeof BOM_UTF8;
   753             result = ( 0x7F >= ch );
   767             result = ( 0 != ::_ismbblead( ch ) );
   781             result = ( 0 != ::_ismbbtrail( ch ) );
   795             result = ( ( 0x80 <= ch ) && ( 0x9F >= ch ) );
   809             result = ( 0 != ::_ismbbkana( ch ) );
   823             result = ( ( 0xA0 <= ch ) && ( 0xC1 >= ch ) );
   837             result = ( ( ch <= 0xFF61 ) && ( ch >= 0xFF9F ) );
   854             else if ( 0xC0 == ( 0xE0 & ch ) ) {
   858             else if ( 0xE0 == ( 0xF0 & ch ) ) {
   862             else if ( 0xF0 == ( 0xF8 & ch ) ) {
   866             else if ( 0xF8 == ( 0xFC & ch ) ) {
   870             else if ( 0xFC == ( 0xFE & ch ) ) {
   887 #pragma managed( pop ) virtual bool SetFileEnd() noexcept
ファイル終端設定関数 
static bool IsConfirmedFirstByteSjis(char unsigned ch) noexcept
S-JIS確定第1バイト判定関数 
virtual LONGLONG GetFilePoint() const  noexcept
ファイルポインタ取得関数 
virtual bool ReadCodeBytes(unsigned char pBuffer[MB_LEN_MAX], int &nCount, int nSize) noexcept
コードバイトリード関数 
virtual LONGLONG Read(void *pBuffer, LONGLONG nSize) noexcept
リード関数 
static char unsigned const * GetBomData(UINT uCodePage, int &nSize) noexcept
BOMデータ取得関数 
virtual bool SetFilePoint(LONGLONG nPoint) noexcept
ファイルポインタ設定関数 
virtual bool OutputBom(UINT uCodePage) noexcept
BOM出力関数 
#define CP_UTF16
UTF-16コードページ 
static bool IsConfirmedKanaSjis(char unsigned ch) noexcept
S-JIS確定半角カナ判定関数 
static bool IsKanaUnicode(wchar_t ch) noexcept
Unicode半角カナ判定関数 
virtual bool OpenAppend(wchar_t const *pszPath, UINT uCodePage=CP_UTF16) noexcept
追記モードオープン関数 
static bool IsKanaSjis(char unsigned ch) noexcept
S-JIS半角カナ判定関数 
virtual bool Open(wchar_t const *pszPath, bool bWrite=false) noexcept
オープン関数 
virtual LONGLONG Write(void const *pBuffer, LONGLONG nSize) noexcept
ライト関数 
virtual void Close() noexcept
クローズ関数 
virtual LONGLONG GetFileSize() const  noexcept
ファイルサイズ取得関数 
virtual ~CFile() noexcept
デストラクタ 
static bool IsFirstByteSjis(char unsigned ch) noexcept
S-JIS第1バイト判定関数 
static bool IsSecondByteSjis(char unsigned ch) noexcept
S-JIS第2バイト判定関数 
virtual bool Create(wchar_t const *pszPath, UINT uCodePage=CP_UTF16) noexcept
作成関数 
static bool GetCodeSizeUtf8(char unsigned ch, int &nSize) noexcept
UTF-8コードサイズ取得関数 
static bool IsAscii(char unsigned ch) noexcept
ASCIIコード判定関数 
virtual bool InputCodePage(UINT &ruCodePage, int &rnUtf8, int &rnSJis) noexcept
コードページ入力関数