void CXML_AttrMap::RemoveAt(const CFX_ByteStringC& space, const CFX_ByteStringC& name) { if (m_pMap == NULL) { return; } for (int i = 0; i < m_pMap->GetSize(); i ++) { CXML_AttrItem& item = GetAt(i); if ((space.IsEmpty() || item.m_QSpaceName == space) && item.m_AttrName == name) { m_pMap->RemoveAt(i); return; } } }
FX_BOOL CFXCRT_FileAccess_Win64::Open(const CFX_ByteStringC& fileName, uint32_t dwMode) { if (m_hFile) { return FALSE; } uint32_t dwAccess, dwShare, dwCreation; FXCRT_Windows_GetFileMode(dwMode, dwAccess, dwShare, dwCreation); m_hFile = ::CreateFileA(fileName.c_str(), dwAccess, dwShare, nullptr, dwCreation, FILE_ATTRIBUTE_NORMAL, nullptr); if (m_hFile == INVALID_HANDLE_VALUE) m_hFile = nullptr; return !!m_hFile; }
FX_BOOL CFXCRT_FileAccess_Win64::Open(const CFX_ByteStringC& fileName, FX_DWORD dwMode) { if (m_hFile) { return FALSE; } FX_DWORD dwAccess, dwShare, dwCreation; FXCRT_Windows_GetFileMode(dwMode, dwAccess, dwShare, dwCreation); m_hFile = ::CreateFileA(fileName.GetCStr(), dwAccess, dwShare, NULL, dwCreation, FILE_ATTRIBUTE_NORMAL, NULL); if (m_hFile == INVALID_HANDLE_VALUE) { m_hFile = NULL; } return m_hFile != NULL; }
uint32_t CXML_Element::CountElements(const CFX_ByteStringC& space, const CFX_ByteStringC& tag) const { int count = 0; for (const ChildRecord& record : m_Children) { if (record.type != Element) continue; CXML_Element* pKid = static_cast<CXML_Element*>(record.child); if ((space.IsEmpty() || pKid->m_QSpaceName == space) && pKid->m_TagName == tag) { count++; } } return count; }
FX_DWORD CXML_Element::CountElements(const CFX_ByteStringC& space, const CFX_ByteStringC& tag) const { int count = 0; for (int i = 0; i < m_Children.GetSize(); i += 2) { ChildType type = (ChildType)(uintptr_t)m_Children.GetAt(i); if (type != Element) { continue; } CXML_Element* pKid = (CXML_Element*)m_Children.GetAt(i + 1); if ((space.IsEmpty() || pKid->m_QSpaceName == space) && pKid->m_TagName == tag) { count ++; } } return count; }
CFX_ByteString CXML_Element::GetNamespaceURI(const CFX_ByteStringC& qName) const { const CFX_WideString* pwsSpace; const CXML_Element *pElement = this; do { if (qName.IsEmpty()) { pwsSpace = pElement->m_AttrMap.Lookup(FX_BSTRC(""), FX_BSTRC("xmlns")); } else { pwsSpace = pElement->m_AttrMap.Lookup(FX_BSTRC("xmlns"), qName); } if (pwsSpace) { break; } pElement = pElement->GetParent(); } while(pElement); return pwsSpace ? FX_UTF8Encode(*pwsSpace) : CFX_ByteString(); }
void CXML_AttrMap::SetAt(const CFX_ByteStringC& space, const CFX_ByteStringC& name, const CFX_WideStringC& value) { for (int i = 0; i < GetSize(); i++) { CXML_AttrItem& item = GetAt(i); if ((space.IsEmpty() || item.m_QSpaceName == space) && item.m_AttrName == name) { item.m_Value = value; return; } } if (!m_pMap) { m_pMap = new CFX_ObjectArray<CXML_AttrItem>; } CXML_AttrItem* pItem = (CXML_AttrItem*)m_pMap->AddSpace(); if (!pItem) { return; } pItem->m_QSpaceName = space; pItem->m_AttrName = name; pItem->m_Value = value; }
void FX_XML_SplitQualifiedName(const CFX_ByteStringC& bsFullName, CFX_ByteStringC& bsSpace, CFX_ByteStringC& bsName) { if (bsFullName.IsEmpty()) { return; } int32_t iStart = 0; for (; iStart < bsFullName.GetLength(); iStart++) { if (bsFullName.GetAt(iStart) == ':') { break; } } if (iStart >= bsFullName.GetLength()) { bsName = bsFullName; } else { bsSpace = CFX_ByteStringC(bsFullName.GetCStr(), iStart); iStart++; bsName = CFX_ByteStringC(bsFullName.GetCStr() + iStart, bsFullName.GetLength() - iStart); } }
FX_BOOL FX_File_Move(const CFX_ByteStringC& fileNameSrc, const CFX_ByteStringC& fileNameDst) { return ::MoveFileA(fileNameSrc.GetCStr(), fileNameDst.GetCStr()); }
FX_BOOL FX_File_Copy(const CFX_ByteStringC& fileNameSrc, const CFX_ByteStringC& fileNameDst) { return ::CopyFileA(fileNameSrc.GetCStr(), fileNameDst.GetCStr(), FALSE); }
FX_BOOL FX_File_Delete(const CFX_ByteStringC& fileName) { return ::DeleteFileA(fileName.GetCStr()); }
FX_DOUBLE XFA_ByteStringToDouble(const CFX_ByteStringC& szStringVal) { CFX_WideString wsValue = CFX_WideString::FromUTF8(szStringVal.GetCStr(), szStringVal.GetLength()); return XFA_WideStringToDouble(wsValue); }
bool CXFA_FFTextEdit::CheckWord(const CFX_ByteStringC& sWord) { if (sWord.IsEmpty() || m_pDataAcc->GetUIType() != XFA_Element::TextEdit) return true; return false; }
FX_BOOL CXFA_FFTextEdit::CheckWord(const CFX_ByteStringC& sWord) { if (sWord.IsEmpty() || m_pDataAcc->GetUIType() != XFA_ELEMENT_TextEdit) { return TRUE; } return GetDoc()->GetDocProvider()->CheckWord(GetDoc(), sWord); }
void CFX_ByteTextBuf::operator =(const CFX_ByteStringC& str) { CopyData((FX_LPCBYTE)str, str.GetLength()); }
CPDF_SimpleParser::CPDF_SimpleParser(const CFX_ByteStringC& str) { m_pData = str.GetPtr(); m_dwSize = str.GetLength(); m_dwCurPos = 0; }
void CFX_ByteTextBuf::operator=(const CFX_ByteStringC& str) { CopyData(str.GetPtr(), str.GetLength()); }
CFX_ByteString::CFX_ByteString(const CFX_ByteStringC& stringSrc) { if (!stringSrc.IsEmpty()) m_pData.Reset(StringData::Create(stringSrc.c_str(), stringSrc.GetLength())); }