FX_STRSIZE FX_WideString_GetNormalization(FX_WSTR wsSrc, FX_LPWSTR pDst) { FX_STRSIZE nCount = 0; for (FX_STRSIZE len = 0; len < wsSrc.GetLength(); len ++) { FX_WCHAR wch = wsSrc.GetAt(len); if(pDst) { nCount += FX_Unicode_GetNormalization(wch, pDst + nCount); } else { nCount += FX_Unicode_GetNormalization(wch, pDst); } } return nCount; }
FX_BOOL CFXCRT_FileAccess_CRT::Open(FX_WSTR fileName, FX_DWORD dwMode) { if (m_hFile) { return FALSE; } CFX_WideString strMode; FXCRT_GetFileModeString(dwMode, strMode); m_hFile = FXSYS_wfopen(fileName.GetPtr(), (FX_LPCWSTR)strMode); return m_hFile != NULL; }
void CXML_Parser::InsertContentSegment(FX_BOOL bCDATA, FX_WSTR content, CXML_Element* pElement) { if (content.IsEmpty()) { return; } CXML_Content* pContent; pContent = FX_NEW CXML_Content; if (!pContent) { return; } pContent->Set(bCDATA, content); pElement->m_Children.Add((FX_LPVOID)CXML_Element::Content); pElement->m_Children.Add(pContent); }
CFX_WideString FILESPEC_EncodeFileName(FX_WSTR filepath) { if (filepath.GetLength() <= 1) { return CFX_WideString(); } #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ if (filepath.GetAt(1) == ':') { CFX_WideString result; result = '/'; result += filepath.GetAt(0); if (filepath.GetAt(2) != '\\') { result += '/'; } result += ChangeSlashToPDF(filepath.GetPtr() + 2); return result; } if (filepath.GetAt(0) == '\\' && filepath.GetAt(1) == '\\') { return ChangeSlashToPDF(filepath.GetPtr() + 1); } if (filepath.GetAt(0) == '\\') { CFX_WideString result; result = '/'; result += ChangeSlashToPDF(filepath.GetPtr()); return result; } return ChangeSlashToPDF(filepath.GetPtr()); #elif _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ if (filepath.Left(sizeof("Mac") - 1) == FX_WSTRC(L"Mac")) { CFX_WideString result; result = '/'; result += ChangeSlashToPDF(filepath.GetPtr()); return result; } return ChangeSlashToPDF(filepath.GetPtr()); #else return filepath; #endif }
static CFX_WideString FILESPEC_DecodeFileName(FX_WSTR filepath) { if (filepath.GetLength() <= 1) { return CFX_WideString(); } #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ if (filepath.Left(sizeof("/Mac") - 1) == CFX_WideStringC(L"/Mac")) { return ChangeSlashToPlatform(filepath.GetPtr() + 1); } return ChangeSlashToPlatform(filepath.GetPtr()); #elif _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ if (filepath.GetAt(0) != '/') { return ChangeSlashToPlatform(filepath.GetPtr()); } if (filepath.GetAt(1) == '/') { return ChangeSlashToPlatform(filepath.GetPtr() + 1); } if (filepath.GetAt(2) == '/') { CFX_WideString result; result += filepath.GetAt(1); result += ':'; result += ChangeSlashToPlatform(filepath.GetPtr() + 2); return result; } CFX_WideString result; result += '\\'; result += ChangeSlashToPlatform(filepath.GetPtr()); return result; #else return filepath; #endif }
void CFX_WideTextBuf::operator =(FX_WSTR str) { CopyData(str.GetPtr(), str.GetLength() * sizeof(FX_WCHAR)); }