本文整理匯總了C++中CFDictionaryRemoveValue函數的典型用法代碼示例。如果您正苦於以下問題:C++ CFDictionaryRemoveValue函數的具體用法?C++ CFDictionaryRemoveValue怎麽用?C++ CFDictionaryRemoveValue使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了CFDictionaryRemoveValue函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: interface_update_status
static void
interface_update_status(const char *if_name, CFBooleanRef active,
boolean_t attach)
{
CFStringRef key = NULL;
CFMutableDictionaryRef newDict = NULL;
key = create_interface_key(if_name);
newDict = copy_entity(key);
/* if new status available, update cache */
if (active == NULL) {
CFDictionaryRemoveValue(newDict, kSCPropNetLinkActive);
} else {
CFDictionarySetValue(newDict, kSCPropNetLinkActive, active);
}
if (attach == TRUE) {
/* the interface was attached, remove stale state */
CFDictionaryRemoveValue(newDict, kSCPropNetLinkDetaching);
}
/* update status */
if (CFDictionaryGetCount(newDict) > 0) {
cache_SCDynamicStoreSetValue(store, key, newDict);
} else {
cache_SCDynamicStoreRemoveValue(store, key);
}
CFRelease(key);
CFRelease(newDict);
return;
}
示例2: find_class_path
static VALUE
find_class_path(VALUE klass)
{
struct fc_result arg;
arg.name = 0;
arg.path = 0;
arg.klass = klass;
arg.track = rb_cObject;
arg.prev = 0;
CFMutableDictionaryRef iv_dict = rb_class_ivar_dict(rb_cObject);
if (iv_dict != NULL) {
ivar_dict_foreach(iv_dict, fc_i, (VALUE)&arg);
}
if (arg.path == 0) {
st_foreach_safe(rb_class_tbl, fc_i, (st_data_t)&arg);
}
if (arg.path) {
iv_dict = rb_class_ivar_dict_or_create(klass);
CFDictionarySetValue(iv_dict, (const void *)id_classpath,
(const void *)arg.path);
CFDictionaryRemoveValue(iv_dict, (const void *)id_tmp_classpath);
return arg.path;
}
if (!RCLASS_RUBY(klass)) {
VALUE name = rb_str_new2(class_getName((Class)klass));
iv_dict = rb_class_ivar_dict_or_create(klass);
CFDictionarySetValue(iv_dict, (const void *)id_classpath,
(const void *)name);
CFDictionaryRemoveValue(iv_dict, (const void *)id_tmp_classpath);
return name;
}
return Qnil;
}
示例3: _CFBundlePlugInLoaded
__private_extern__ void _CFBundlePlugInLoaded(CFBundleRef bundle) {
CFDictionaryRef infoDict = CFBundleGetInfoDictionary(bundle);
CFStringRef tempStr;
CFPlugInDynamicRegisterFunction func = NULL;
if (!__CFBundleGetPlugInData(bundle)->_isPlugIn || __CFBundleGetPlugInData(bundle)->_isDoingDynamicRegistration || !infoDict || !CFBundleIsExecutableLoaded(bundle)) return;
tempStr = (CFStringRef)CFDictionaryGetValue(infoDict, CFSTR("CFPlugInNeedsDynamicRegistration"));
if (tempStr && CFGetTypeID(tempStr) == CFStringGetTypeID() && CFStringCompare(tempStr, CFSTR("YES"), kCFCompareCaseInsensitive) == kCFCompareEqualTo) {
CFDictionaryRemoveValue((CFMutableDictionaryRef)infoDict, CFSTR("CFPlugInNeedsDynamicRegistration"));
tempStr = (CFStringRef)CFDictionaryGetValue(infoDict, kCFPlugInDynamicRegisterFunctionKey);
if (!tempStr || CFGetTypeID(tempStr) != CFStringGetTypeID() || CFStringGetLength(tempStr) <= 0) tempStr = CFSTR("CFPlugInDynamicRegister");
__CFBundleGetPlugInData(bundle)->_loadOnDemand = false;
__CFBundleGetPlugInData(bundle)->_isDoingDynamicRegistration = true;
/* Find the symbol and call it. */
func = (CFPlugInDynamicRegisterFunction)CFBundleGetFunctionPointerForName(bundle, tempStr);
if (func) {
func(bundle);
// MF:!!! Unload function is never called. Need to deal with this!
}
__CFBundleGetPlugInData(bundle)->_isDoingDynamicRegistration = false;
if (__CFBundleGetPlugInData(bundle)->_loadOnDemand && __CFBundleGetPlugInData(bundle)->_instanceCount == 0) CFBundleUnloadExecutable(bundle); // Unload now if we can/should.
} else {
CFDictionaryRemoveValue((CFMutableDictionaryRef)infoDict, CFSTR("CFPlugInNeedsDynamicRegistration"));
}
}
示例4: copyIF
static CFMutableDictionaryRef
copyIF(CFStringRef key, CFMutableDictionaryRef oldIFs, CFMutableDictionaryRef newIFs)
{
CFDictionaryRef dict = NULL;
CFMutableDictionaryRef newDict = NULL;
if (CFDictionaryGetValueIfPresent(newIFs, key, (const void **)&dict)) {
newDict = CFDictionaryCreateMutableCopy(NULL, 0, dict);
} else {
dict = cache_SCDynamicStoreCopyValue(store, key);
if (dict) {
CFDictionarySetValue(oldIFs, key, dict);
if (isA_CFDictionary(dict)) {
newDict = CFDictionaryCreateMutableCopy(NULL, 0, dict);
CFDictionaryRemoveValue(newDict, kSCPropNetIPv6Addresses);
CFDictionaryRemoveValue(newDict, kSCPropNetIPv6DestAddresses);
CFDictionaryRemoveValue(newDict, kSCPropNetIPv6Flags);
CFDictionaryRemoveValue(newDict, kSCPropNetIPv6PrefixLength);
#ifdef NOTYET
CFDictionaryRemoveValue(newDict, kSCPropNetIPv6ScopeID);
#endif /* NOTYET */
}
CFRelease(dict);
}
}
if (!newDict) {
newDict = CFDictionaryCreateMutable(NULL,
0,
&kCFTypeDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks);
}
return newDict;
}
示例5: CFDictionarySetValue
void SFB::Audio::Metadata::SetValue(CFStringRef key, CFTypeRef value)
{
if(nullptr == key)
return;
if(nullptr == value) {
if(CFDictionaryContainsKey(mMetadata, key))
CFDictionarySetValue(mChangedMetadata, key, kCFNull);
else
CFDictionaryRemoveValue(mChangedMetadata, key);
}
else {
CFTypeRef savedValue = CFDictionaryGetValue(mMetadata, key);
// Revert the change if the new value is the save as the saved value
if(CFDictionaryContainsKey(mChangedMetadata, key)) {
if(savedValue && CFEqual(savedValue, value))
CFDictionaryRemoveValue(mChangedMetadata, key);
else
CFDictionarySetValue(mChangedMetadata, key, value);
}
// If a saved value exists only register the change if the new value is different
else if(savedValue && !CFEqual(savedValue, value))
CFDictionarySetValue(mChangedMetadata, key, value);
// If no saved value exists for the key register the change
else if(nullptr == savedValue)
CFDictionarySetValue(mChangedMetadata, key, value);
}
}
示例6: rb_mod_init_copy
VALUE
rb_mod_init_copy(VALUE clone, SEL sel, VALUE orig)
{
rb_obj_init_copy(clone, 0, orig);
VALUE super;
if (!RCLASS_RUBY(orig)) {
super = orig;
rb_warn("cloning class `%s' is not supported, creating a " \
"subclass instead", rb_class2name(orig));
}
else {
super = RCLASS_SUPER(orig);
}
RCLASS_SET_SUPER(clone, super);
// Copy flags.
unsigned long version_flag = RCLASS_IS_RUBY_CLASS;
if ((RCLASS_VERSION(super) & RCLASS_IS_OBJECT_SUBCLASS)
== RCLASS_IS_OBJECT_SUBCLASS) {
version_flag |= RCLASS_IS_OBJECT_SUBCLASS;
}
if (RCLASS_MODULE(orig)) {
version_flag |= RCLASS_IS_MODULE;
}
RCLASS_SET_VERSION(clone, version_flag);
if (!class_isMetaClass((Class)clone)) {
// Clear type info.
RCLASS_SET_VERSION(*(Class *)clone, RCLASS_VERSION(*(Class *)clone));
}
// Copy methods.
rb_vm_copy_methods((Class)orig, (Class)clone);
if (!class_isMetaClass((Class)orig)) {
rb_vm_copy_methods(*(Class *)orig, *(Class *)clone);
}
// Copy ivars.
CFMutableDictionaryRef orig_dict = rb_class_ivar_dict(orig);
CFMutableDictionaryRef clone_dict;
if (orig_dict != NULL) {
clone_dict = CFDictionaryCreateMutableCopy(NULL, 0, orig_dict);
rb_class_ivar_set_dict(clone, clone_dict);
CFMakeCollectable(clone_dict);
}
else {
clone_dict = rb_class_ivar_dict_or_create(clone);
}
// Remove the classpath & classid (name) so that they are not
// copied over the new module / class.
CFDictionaryRemoveValue(clone_dict, (const void *)id_classpath);
CFDictionaryRemoveValue(clone_dict, (const void *)id_classid);
return clone;
}
示例7: __remove_password
__private_extern__
Boolean
__remove_password(SCPreferencesRef prefs,
CFDictionaryRef config,
CFStringRef passwordKey,
CFStringRef encryptionKey,
CFStringRef encryptionKeyChainValue,
CFStringRef unique_id,
CFDictionaryRef *newConfig)
{
CFStringRef encryption = NULL;
Boolean ok = FALSE;
// check for keychain password
if (config != NULL) {
encryption = CFDictionaryGetValue(config, encryptionKey);
}
if ((encryption == NULL) ||
(isA_CFString(encryption) &&
CFEqual(encryption, encryptionKeyChainValue))) {
// remove keychain password
if (prefs != NULL) {
ok = _SCPreferencesSystemKeychainPasswordItemRemove(prefs, unique_id);
} else {
ok = _SCSecKeychainPasswordItemRemove(NULL, unique_id);
}
}
// as needed, check if we have an in-line password that we can remove
if (!ok && (encryption == NULL) && (config != NULL)) {
CFDataRef inline_password;
inline_password = CFDictionaryGetValue(config, passwordKey);
inline_password = __copy_legacy_password(inline_password);
if (inline_password != NULL) {
CFRelease(inline_password);
ok = TRUE;
}
}
if (newConfig != NULL) {
if (ok && (config != NULL)) {
CFMutableDictionaryRef temp;
temp = CFDictionaryCreateMutableCopy(NULL, 0, config);
CFDictionaryRemoveValue(temp, passwordKey);
CFDictionaryRemoveValue(temp, encryptionKey);
*newConfig = (CFDictionaryRef)temp;
} else {
*newConfig = NULL;
}
}
return ok;
}
示例8: rb_mod_init_copy
/* :nodoc: */
VALUE
rb_mod_init_copy(VALUE clone, SEL sel, VALUE orig)
{
static ID classpath = 0;
static ID classid = 0;
rb_obj_init_copy(clone, 0, orig);
{
VALUE super;
unsigned long version_flag;
if (!RCLASS_RUBY(orig)) {
super = orig;
rb_warn("cloning class `%s' is not supported, creating a " \
"subclass instead", rb_class2name(orig));
}
else {
super = RCLASS_SUPER(orig);
}
RCLASS_SET_SUPER(clone, super);
version_flag = RCLASS_IS_RUBY_CLASS;
if ((RCLASS_VERSION(super) & RCLASS_IS_OBJECT_SUBCLASS) == RCLASS_IS_OBJECT_SUBCLASS) {
version_flag |= RCLASS_IS_OBJECT_SUBCLASS;
}
RCLASS_SET_VERSION(clone, version_flag);
rb_vm_copy_methods((Class)orig, (Class)clone);
CFMutableDictionaryRef ivar_dict = rb_class_ivar_dict(orig);
if (ivar_dict != NULL) {
CFMutableDictionaryRef cloned_ivar_dict;
if (classpath == 0) {
classpath = rb_intern("__classpath__");
}
if (classid == 0) {
classid = rb_intern("__classid__");
}
cloned_ivar_dict = CFDictionaryCreateMutableCopy(NULL, 0,
(CFDictionaryRef)ivar_dict);
// Remove the classpath & classid (name) so that they are not
// copied over the new module / class
CFDictionaryRemoveValue(cloned_ivar_dict, (const void *)classpath);
CFDictionaryRemoveValue(cloned_ivar_dict, (const void *)classid);
CFMakeCollectable(cloned_ivar_dict);
rb_class_ivar_set_dict(clone, cloned_ivar_dict);
}
}
return clone;
}
示例9: EAPOLClientProfileSetInformation
/*
* Function: EAPOLClientProfileSetInformation
*
* Purpose:
* Associate additional information with the profile using the given
* application identifier.
*
* If info is NULL, the information for the particular application is cleared.
*
* Note:
* applicationID must be an application identifier e.g. "com.mycompany.myapp".
*/
Boolean
EAPOLClientProfileSetInformation(EAPOLClientProfileRef profile,
CFStringRef applicationID,
CFDictionaryRef information)
{
if (applicationID_is_valid(applicationID) == FALSE) {
return (FALSE);
}
if (information == NULL) {
if (profile->information != NULL) {
CFDictionaryRemoveValue(profile->information, applicationID);
}
}
else {
if (isA_CFDictionary(information) == NULL) {
return (FALSE);
}
if (profile->information == NULL) {
profile->information
= CFDictionaryCreateMutable(NULL, 0,
&kCFTypeDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks);
}
CFDictionarySetValue(profile->information, applicationID, information);
}
return (TRUE);
}
示例10: CFDictionaryCreateMutableCopy
CFDictionaryRef SFB::Audio::Metadata::CreateDictionaryRepresentation() const
{
CFMutableDictionaryRef dictionaryRepresentation = CFDictionaryCreateMutableCopy(kCFAllocatorDefault, 0, mMetadata);
CFIndex count = CFDictionaryGetCount(mChangedMetadata);
CFTypeRef *keys = (CFTypeRef *)malloc(sizeof(CFTypeRef) * (size_t)count);
CFTypeRef *values = (CFTypeRef *)malloc(sizeof(CFTypeRef) * (size_t)count);
CFDictionaryGetKeysAndValues(mChangedMetadata, keys, values);
for(CFIndex i = 0; i < count; ++i) {
if(kCFNull == values[i])
CFDictionaryRemoveValue(dictionaryRepresentation, keys[i]);
else
CFDictionarySetValue(dictionaryRepresentation, keys[i], values[i]);
}
free(keys), keys = nullptr;
free(values), values = nullptr;
CFMutableArray pictureArray = CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks);
for(auto picture : GetAttachedPictures()) {
CFDictionary pictureRepresentation = picture->CreateDictionaryRepresentation();
CFArrayAppendValue(pictureArray, pictureRepresentation);
}
if(0 < CFArrayGetCount(pictureArray)) {
CFDictionarySetValue(dictionaryRepresentation, kAttachedPicturesKey, pictureArray);
}
return dictionaryRepresentation;
}
示例11: CFDictionaryGetCount
void SFB::Audio::Metadata::MergeChangedMetadataIntoMetadata()
{
CFIndex count = CFDictionaryGetCount(mChangedMetadata);
CFTypeRef *keys = (CFTypeRef *)malloc(sizeof(CFTypeRef) * (size_t)count);
CFTypeRef *values = (CFTypeRef *)malloc(sizeof(CFTypeRef) * (size_t)count);
CFDictionaryGetKeysAndValues(mChangedMetadata, keys, values);
for(CFIndex i = 0; i < count; ++i) {
if(kCFNull == values[i])
CFDictionaryRemoveValue(mMetadata, keys[i]);
else
CFDictionarySetValue(mMetadata, keys[i], values[i]);
}
free(keys), keys = nullptr;
free(values), values = nullptr;
CFDictionaryRemoveAllValues(mChangedMetadata);
auto iter = std::begin(mPictures);
while(iter != std::end(mPictures)) {
auto picture = *iter;
if(AttachedPicture::ChangeState::Removed == picture->mState)
iter = mPictures.erase(iter);
else {
picture->MergeChangedMetadataIntoMetadata();
picture->mState = AttachedPicture::ChangeState::Saved;
++iter;
}
}
}
示例12: rb_gc_copy_finalizer
void
rb_gc_copy_finalizer(VALUE dest, VALUE obj)
{
VALUE table;
if (__os_finalizers == NULL)
return;
if (NATIVE(obj)) {
if (!rb_objc_flag_check((void *)obj, FL_FINALIZE))
return;
}
else {
if (!FL_TEST(obj, FL_FINALIZE))
return;
}
table = (VALUE)CFDictionaryGetValue((CFDictionaryRef)__os_finalizers,
(const void *)obj);
if (table == 0) {
CFDictionaryRemoveValue(__os_finalizers, (const void *)dest);
}
else {
CFDictionarySetValue(__os_finalizers, (const void *)dest,
(const void *)table);
}
}
示例13: interface_update_quality_metric
__private_extern__
void
interface_update_quality_metric(const char *if_name,
int quality)
{
CFStringRef key = NULL;
CFMutableDictionaryRef newDict = NULL;
CFNumberRef linkquality = NULL;
key = create_linkquality_key(if_name);
newDict = copy_entity(key);
if (quality != IFNET_LQM_THRESH_UNKNOWN) {
linkquality = CFNumberCreate(NULL, kCFNumberIntType, &quality);
CFDictionarySetValue(newDict, kSCPropNetLinkQuality, linkquality);
CFRelease(linkquality);
} else {
CFDictionaryRemoveValue(newDict, kSCPropNetLinkQuality);
}
/* update status */
if (CFDictionaryGetCount(newDict) > 0) {
cache_SCDynamicStoreSetValue(store, key, newDict);
} else {
cache_SCDynamicStoreRemoveValue(store, key);
}
CFRelease(key);
CFRelease(newDict);
return;
}
示例14: remove_old_linklocal_modifiers
STATIC void
remove_old_linklocal_modifiers(CFMutableDictionaryRef modifiers)
{
CFIndex count;
count = CFDictionaryGetCount(modifiers);
if (count > 0) {
int i;
const void * keys[count];
CFDateRef now;
const void * values[count];
now = CFDateCreate(NULL, CFAbsoluteTimeGetCurrent());
CFDictionaryGetKeysAndValues(modifiers, keys, values);
for (i = 0; i < count; i++) {
CFDictionaryRef dict = (CFDictionaryRef)values[i];
if (linklocal_modifier_has_expired(dict, now)) {
CFStringRef key = (CFStringRef)keys[i];
CFDictionaryRemoveValue(modifiers, key);
}
}
CFRelease(now);
}
return;
}
示例15: classname
static VALUE
classname(VALUE klass)
{
VALUE path = Qnil;
if (klass == 0) {
klass = rb_cObject;
}
CFMutableDictionaryRef iv_dict = rb_class_ivar_dict(klass);
if (iv_dict != NULL) {
if (!CFDictionaryGetValueIfPresent((CFDictionaryRef)iv_dict,
(const void *)id_classpath, (const void **)&path)) {
if (!CFDictionaryGetValueIfPresent((CFDictionaryRef)iv_dict,
(const void *)id_classid, (const void **)&path)) {
return find_class_path(klass);
}
path = rb_str_dup(path);
OBJ_FREEZE(path);
CFDictionarySetValue(iv_dict, (const void *)id_classpath,
(const void *)path);
CFDictionaryRemoveValue(iv_dict, (const void *)id_classid);
}
if (TYPE(path) != T_STRING) {
rb_bug("class path is not set properly");
}
return path;
}
return find_class_path(klass);
}