bool RegHelper::DeleteKeyValue(HKEY hKeyRoot, LPCTSTR lpSubKey, LPCTSTR lpValue) { HKEY hKey; LONG lResult; DWORD dwp = REG_OPENED_EXISTING_KEY; lResult = ::RegCreateKeyEx(hKeyRoot, lpSubKey, 0, NULL,\ REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &dwp); if (lResult!=ERROR_SUCCESS) return false; if (!IsKeyExists(hKey, lpValue)) return true; lResult = ::RegDeleteValue(hKey, lpValue); if (lResult!=ERROR_SUCCESS) { ::RegCloseKey(hKey); return false; } ::RegCloseKey(hKey); return true; }
VariantType * KeyedArchive::GetVariant(const String & key) { if(IsKeyExists(key)) return objectMap[key]; return NULL; }
void CIFXMetaData::AppendX(IFXMetaDataX* pSource) { IFXString sKey, sEncodedKey, sValue; U32 srcCount, srcIndex, srcSize, dstIndex; IFXMetaDataAttribute srcType; U8* pBuffer; IFXRESULT rc; BOOL Persistance = true; IFXCHECKX_RESULT( pSource, IFX_E_NOT_INITIALIZED ); pSource->GetCountX(srcCount); for (srcIndex = 0; srcIndex < srcCount; srcIndex++) { pSource->GetKeyX(srcIndex, sKey); pSource->GetEncodedKeyX(srcIndex, sEncodedKey); pSource->GetAttributeX(srcIndex, srcType); if (IsKeyExists(sKey)) { rc = GetIndex(sKey, dstIndex); IFXCHECKX_RESULT( IFXSUCCESS( rc ), IFX_E_NO_METADATA ); DeleteX(dstIndex); } if (srcType & IFXMETADATAATTRIBUTE_BINARY) { pSource->GetBinarySizeX(srcIndex, srcSize); pBuffer = (U8*)new U8[srcSize]; IFXCHECKX_RESULT( pBuffer, IFX_E_NOT_INITIALIZED ); pSource->GetBinaryX(srcIndex, pBuffer); SetBinaryValueX(sEncodedKey, srcSize, pBuffer); delete [] pBuffer; } else { pSource->GetStringX(srcIndex, sValue); SetStringValueX(sEncodedKey, sValue); } GetIndex(sKey, dstIndex); SetAttributeX(dstIndex, srcType); pSource->GetPersistenceX(srcIndex, Persistance); rc = GetIndex(sKey, dstIndex); IFXCHECKX_RESULT(IFXSUCCESS( rc ), IFX_E_NO_METADATA); SetPersistenceX(dstIndex, Persistance); } }
Matrix4 KeyedArchive::GetMatrix4(const String & key, const Matrix4 & defaultValue ) { if (IsKeyExists(key)) return objectMap[key]->AsMatrix4(); return defaultValue; }
Vector3 KeyedArchive::GetVector3(const String & key, const Vector3 & defaultValue ) { if (IsKeyExists(key)) return objectMap[key]->AsVector3(); return defaultValue; }
uint64 KeyedArchive::GetUInt64(const String & key, uint64 defaultValue) { if (IsKeyExists(key)) return objectMap[key]->AsUInt64(); return defaultValue; }
KeyedArchive * KeyedArchive::GetArchive(const String & key, KeyedArchive * defaultValue) { if (IsKeyExists(key)) return objectMap[key]->AsKeyedArchive(); return defaultValue; }
int32 KeyedArchive::GetByteArraySize(const String & key, int32 defaultValue) { if (IsKeyExists(key)) return objectMap[key]->AsByteArraySize(); return defaultValue; }
const uint8 *KeyedArchive::GetByteArray(const String & key, const uint8 *defaultValue) { if (IsKeyExists(key)) return objectMap[key]->AsByteArray(); return defaultValue; }
FastName KeyedArchive::GetFastName(const String & key, const FastName & defaultValue) { if (IsKeyExists(key)) return objectMap[key]->AsFastName(); return defaultValue; }
WideString KeyedArchive::GetWideString(const String & key, const WideString & defaultValue) { if (IsKeyExists(key)) return objectMap[key]->AsWideString(); return defaultValue; }
float32 KeyedArchive::GetFloat(const String & key, float32 defaultValue) { if (IsKeyExists(key)) return objectMap[key]->AsFloat(); return defaultValue; }
int32 KeyedArchive::GetInt32(const String & key, int32 defaultValue) { if (IsKeyExists(key)) return objectMap[key]->AsInt32(); return defaultValue; }
bool KeyedArchive::GetBool(const String & key, bool defaultValue) { if (IsKeyExists(key)) return objectMap[key]->AsBool(); return defaultValue; }