void CFX_CMapByteStringToPtr::SetAt(const CFX_ByteStringC& key, void* value) { ASSERT(value != NULL); int index, key_len = key.GetLength(); int size = m_Buffer.GetSize(); for (index = 0; index < size; index++) { _CompactString* pKey = (_CompactString*)m_Buffer.GetAt(index); if (!_CompactStringSame(pKey, key.GetPtr(), key_len)) { continue; } *(void**)(pKey + 1) = value; return; } for (index = 0; index < size; index++) { _CompactString* pKey = (_CompactString*)m_Buffer.GetAt(index); if (pKey->m_CompactLen) { continue; } _CompactStringStore(pKey, key.GetPtr(), key_len); *(void**)(pKey + 1) = value; return; } _CompactString* pKey = (_CompactString*)m_Buffer.Add(); _CompactStringStore(pKey, key.GetPtr(), key_len); *(void**)(pKey + 1) = value; }
static void FXJSE_DynPropGetterAdapter(const FXJSE_CLASS* lpClass, FXJSE_HOBJECT hObject, const CFX_ByteStringC& szPropName, FXJSE_HVALUE hValue) { ASSERT(lpClass); int32_t nPropType = lpClass->dynPropTypeGetter == nullptr ? FXJSE_ClassPropType_Property : lpClass->dynPropTypeGetter(hObject, szPropName, FALSE); if (nPropType == FXJSE_ClassPropType_Property) { if (lpClass->dynPropGetter) { lpClass->dynPropGetter(hObject, szPropName, hValue); } } else if (nPropType == FXJSE_ClassPropType_Method) { if (lpClass->dynMethodCall && hValue) { CFXJSE_Value* lpValue = reinterpret_cast<CFXJSE_Value*>(hValue); v8::Isolate* pIsolate = lpValue->GetIsolate(); v8::HandleScope hscope(pIsolate); v8::Local<v8::ObjectTemplate> hCallBackInfoTemplate = v8::ObjectTemplate::New(); hCallBackInfoTemplate->SetInternalFieldCount(2); v8::Local<v8::Object> hCallBackInfo = hCallBackInfoTemplate->NewInstance(); hCallBackInfo->SetAlignedPointerInInternalField( 0, const_cast<FXJSE_CLASS*>(lpClass)); hCallBackInfo->SetInternalField( 1, v8::String::NewFromUtf8( pIsolate, reinterpret_cast<const char*>(szPropName.GetPtr()), v8::String::kNormalString, szPropName.GetLength())); lpValue->ForceSetValue(v8::Function::New( lpValue->GetIsolate(), FXJSE_DynPropGetterAdapter_MethodCallback, hCallBackInfo)); } } }
void CFX_CMapByteStringToPtr::AddValue(const CFX_ByteStringC& key, void* value) { ASSERT(value != NULL); _CompactString* pKey = (_CompactString*)m_Buffer.Add(); _CompactStringStore(pKey, key.GetPtr(), key.GetLength()); *(void**)(pKey + 1) = value; }
void CFX_CMapByteStringToPtr::RemoveKey(const CFX_ByteStringC& key) { int key_len = key.GetLength(); int size = m_Buffer.GetSize(); for (int index = 0; index < size; index++) { _CompactString* pKey = (_CompactString*)m_Buffer.GetAt(index); if (!_CompactStringSame(pKey, key.GetPtr(), key_len)) { continue; } _CompactStringRelease(pKey); pKey->m_CompactLen = 0xfe; return; } }
FX_BOOL CPDF_SimpleParser::SearchToken(const CFX_ByteStringC& token) { int token_len = token.GetLength(); while (m_dwCurPos < m_dwSize - token_len) { if (FXSYS_memcmp(m_pData + m_dwCurPos, token.GetPtr(), token_len) == 0) { break; } m_dwCurPos++; } if (m_dwCurPos == m_dwSize - token_len) { return FALSE; } m_dwCurPos += token_len; return TRUE; }
void CFX_ByteTextBuf::operator=(const CFX_ByteStringC& str) { CopyData(str.GetPtr(), str.GetLength()); }
CPDF_SimpleParser::CPDF_SimpleParser(const CFX_ByteStringC& str) { m_pData = str.GetPtr(); m_dwSize = str.GetLength(); m_dwCurPos = 0; }