bool CJS_GlobalData::DeleteGlobalVariable(const CFX_ByteString& propname) { CFX_ByteString sPropName(propname); if (!TrimPropName(&sPropName)) return false; auto iter = FindGlobalVariable(sPropName); if (iter == m_arrayGlobalData.end()) return false; m_arrayGlobalData.erase(iter); return true; }
FX_BOOL CJS_GlobalData::DeleteGlobalVariable(const CFX_ByteString& propname) { CFX_ByteString sPropName(propname); if (!TrimPropName(&sPropName)) return FALSE; auto iter = FindGlobalVariable(sPropName); if (iter == m_arrayGlobalData.end()) return FALSE; m_arrayGlobalData.erase(iter); return TRUE; }
bool CJS_GlobalData::SetGlobalVariablePersistent(const CFX_ByteString& propname, bool bPersistent) { CFX_ByteString sPropName(propname); if (!TrimPropName(&sPropName)) return false; CJS_GlobalData_Element* pData = GetGlobalVariable(sPropName); if (!pData) return false; pData->bPersistent = bPersistent; return true; }
void CJS_GlobalData::SetGlobalVariableNull(const CFX_ByteString& propname) { CFX_ByteString sPropName(propname); if (!TrimPropName(&sPropName)) return; if (CJS_GlobalData_Element* pData = GetGlobalVariable(sPropName)) { pData->data.nType = JS_GlobalDataType::NULLOBJ; return; } std::unique_ptr<CJS_GlobalData_Element> pNewData(new CJS_GlobalData_Element); pNewData->data.sKey = sPropName; pNewData->data.nType = JS_GlobalDataType::NULLOBJ; m_arrayGlobalData.push_back(std::move(pNewData)); }
FX_BOOL CJS_GlobalData::SetGlobalVariablePersistent( const CFX_ByteString& propname, FX_BOOL bPersistent) { CFX_ByteString sPropName(propname); if (!TrimPropName(&sPropName)) return FALSE; CJS_GlobalData_Element* pData = GetGlobalVariable(sPropName); if (!pData) return FALSE; pData->bPersistent = bPersistent; return TRUE; }
void CJS_GlobalData::SetGlobalVariableObject( const CFX_ByteString& propname, const CJS_GlobalVariableArray& array) { CFX_ByteString sPropName(propname); if (!TrimPropName(&sPropName)) return; if (CJS_GlobalData_Element* pData = GetGlobalVariable(sPropName)) { pData->data.nType = JS_GlobalDataType::OBJECT; pData->data.objData.Copy(array); return; } std::unique_ptr<CJS_GlobalData_Element> pNewData(new CJS_GlobalData_Element); pNewData->data.sKey = sPropName; pNewData->data.nType = JS_GlobalDataType::OBJECT; pNewData->data.objData.Copy(array); m_arrayGlobalData.push_back(std::move(pNewData)); }