bool CACFArray::Get4CC(UInt32 inIndex, UInt32& outValue) const { bool theAnswer = false; CFTypeRef theValue = NULL; if(GetCFType(inIndex, theValue)) { if((theValue != NULL) && (CFGetTypeID(theValue) == CFNumberGetTypeID())) { CFNumberGetValue(static_cast<CFNumberRef>(theValue), kCFNumberSInt32Type, &outValue); theAnswer = true; } else if((theValue != NULL) && (CFGetTypeID(theValue) == CFStringGetTypeID())) { CFStringRef theString = static_cast<CFStringRef>(theValue); if(CFStringGetLength(theString) == 4) { char theCString[5]; CFStringGetCString(theString, theCString, 5, kCFStringEncodingASCII); outValue = CFSwapInt32BigToHost(*reinterpret_cast<UInt32*>(theCString)); } } } return theAnswer; }
void CACFArray::GetCACFDictionary(UInt32 inIndex, CACFDictionary& outItem) const { outItem = static_cast<CFDictionaryRef>(NULL); CFTypeRef theItem = NULL; if(GetCFType(inIndex, theItem)) { if((theItem != NULL) && (CFGetTypeID(theItem) == CFDictionaryGetTypeID())) { outItem = static_cast<CFDictionaryRef>(theItem); } } }
bool CACFDictionary::GetCFTypeWithCStringKey(const char* inKey, CFTypeRef& outValue) const { bool theAnswer = false; if(mCFDictionary != NULL) { CACFString theKey(inKey); if(theKey.IsValid()) { theAnswer = GetCFType(theKey.GetCFString(), outValue); } } return theAnswer; }
bool CACFArray::GetUUID(UInt32 inIndex, CFUUIDRef& outItem) const { bool theAnswer = false; CFTypeRef theItem = NULL; if(GetCFType(inIndex, theItem)) { if((theItem != NULL) && (CFGetTypeID(theItem) == CFUUIDGetTypeID())) { outItem = static_cast<CFUUIDRef>(theItem); theAnswer = true; } } return theAnswer; }
bool CACFArray::GetFloat64(UInt32 inIndex, Float64& outItem) const { bool theAnswer = false; CFTypeRef theItem = NULL; if(GetCFType(inIndex, theItem)) { if((theItem != NULL) && (CFGetTypeID(theItem) == CFNumberGetTypeID())) { CFNumberGetValue(static_cast<CFNumberRef>(theItem), kCFNumberFloat64Type, &outItem); theAnswer = true; } } return theAnswer; }
bool CACFDictionary::GetFloat64(const CFStringRef inKey, Float64& outValue) const { bool theAnswer = false; CFTypeRef theValue = NULL; if(GetCFType(inKey, theValue)) { if((theValue != NULL) && (CFGetTypeID(theValue) == CFNumberGetTypeID())) { CFNumberGetValue(static_cast<CFNumberRef>(theValue), kCFNumberFloat64Type, &outValue); theAnswer = true; } } return theAnswer; }
bool CACFDictionary::GetData(const CFStringRef inKey, CFDataRef& outValue) const { bool theAnswer = false; CFTypeRef theValue = NULL; if(GetCFType(inKey, theValue)) { if((theValue != NULL) && (CFGetTypeID(theValue) == CFDataGetTypeID())) { outValue = static_cast<CFDataRef>(theValue); theAnswer = true; } } return theAnswer; }
bool CACFArray::GetBool(UInt32 inIndex, bool& outValue) const { bool theAnswer = false; CFTypeRef theValue = NULL; if(GetCFType(inIndex, theValue)) { if((theValue != NULL) && (CFGetTypeID(theValue) == CFBooleanGetTypeID())) { outValue = CFBooleanGetValue(static_cast<CFBooleanRef>(theValue)); theAnswer = true; } else if((theValue != NULL) && (CFGetTypeID(theValue) == CFNumberGetTypeID())) { SInt32 theNumericValue = 0; CFNumberGetValue(static_cast<CFNumberRef>(theValue), kCFNumberSInt32Type, &theNumericValue); outValue = theNumericValue != 0; theAnswer = true; } } return theAnswer; }