[darwinbuild-changes] [249] trunk/darwinxref

source_changes at macosforge.org source_changes at macosforge.org
Wed Oct 4 02:01:57 PDT 2006


Revision: 249
          http://trac.macosforge.org/projects/darwinbuild/changeset/249
Author:   kevin
Date:     2006-10-04 02:01:57 -0700 (Wed, 04 Oct 2006)

Log Message:
-----------
- Added new DBCopyOneProp APIs for accessing properties without inheritance

Modified Paths:
--------------
    trunk/darwinxref/DBDataStore.c
    trunk/darwinxref/DBPlugin.h

Modified: trunk/darwinxref/DBDataStore.c
===================================================================
--- trunk/darwinxref/DBDataStore.c	2005-09-15 20:40:24 UTC (rev 248)
+++ trunk/darwinxref/DBDataStore.c	2006-10-04 09:01:57 UTC (rev 249)
@@ -281,8 +281,6 @@
 	}
 }
 
-static CFStringRef _DBCopyPropString(CFStringRef build, CFStringRef project, CFStringRef property);
-
 CFArrayRef DBCopyProjectNames(CFStringRef build) {
 	CFMutableArrayRef projects = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
 	do {		
@@ -293,7 +291,7 @@
 		arrayAppendArrayDistinct(projects, res);
 		CFRelease(res);
 
-		build = _DBCopyPropString(build, NULL, CFSTR("inherits"));
+		build = DBCopyOnePropString(build, NULL, CFSTR("inherits"));
 	} while (build != NULL);
 
 	CFArraySortValues(projects, CFRangeMake(0, CFArrayGetCount(projects)), (CFComparatorFunction)CFStringCompare, 0);
@@ -362,7 +360,25 @@
 	return res;
 }
 
-CFStringRef _DBCopyPropString(CFStringRef build, CFStringRef project, CFStringRef property) {
+CFTypeRef DBCopyOneProp(CFStringRef build, CFStringRef project, CFStringRef property) {
+	CFTypeRef res = NULL;
+	CFTypeID type = DBCopyPropType(property);
+	if (type == -1) return NULL;
+
+	if (type == CFStringGetTypeID()) {
+		res = DBCopyOnePropString(build, project, property);
+	} else if (type == CFArrayGetTypeID()) {
+		res = DBCopyOnePropArray(build, project, property);
+	} else if (type == CFDictionaryGetTypeID()) {
+		res = DBCopyOnePropDictionary(build, project, property);
+	} else if (type == CFDataGetTypeID()) {
+		res = DBCopyOnePropData(build, project, property);
+	}
+	return res;
+}
+
+
+CFStringRef DBCopyOnePropString(CFStringRef build, CFStringRef project, CFStringRef property) {
 	char* cbuild = strdup_cfstr(build);
 	char* cproj = strdup_cfstr(project);
 	char* cprop = strdup_cfstr(property);
@@ -378,7 +394,7 @@
 	return res;
 }
 
-CFDataRef _DBCopyPropData(CFStringRef build, CFStringRef project, CFStringRef property) {
+CFDataRef DBCopyOnePropData(CFStringRef build, CFStringRef project, CFStringRef property) {
 	char* cbuild = strdup_cfstr(build);
 	char* cproj = strdup_cfstr(project);
 	char* cprop = strdup_cfstr(property);
@@ -394,7 +410,7 @@
 	return res;
 }
 
-CFArrayRef _DBCopyPropArray(CFStringRef build, CFStringRef project, CFStringRef property) {
+CFArrayRef DBCopyOnePropArray(CFStringRef build, CFStringRef project, CFStringRef property) {
 	char* cbuild = strdup_cfstr(build);
 	char* cproj = strdup_cfstr(project);
 	char* cprop = strdup_cfstr(property);
@@ -414,7 +430,7 @@
 	return res;
 }
 
-CFDictionaryRef _DBCopyPropDictionary(CFStringRef build, CFStringRef project, CFStringRef property) {
+CFDictionaryRef DBCopyOnePropDictionary(CFStringRef build, CFStringRef project, CFStringRef property) {
 	char* cbuild = strdup_cfstr(build);
 	char* cproj = strdup_cfstr(project);
 	char* cprop = strdup_cfstr(property);
@@ -483,10 +499,10 @@
 		res = func(build, project, property);
 		if (res) break;
 		
-		original = _DBCopyPropString(build, project, CFSTR("original"));
+		original = DBCopyOnePropString(build, project, CFSTR("original"));
 		if (original) break;
 
-		CFStringRef inherits = _DBCopyPropString(build, NULL, CFSTR("inherits"));
+		CFStringRef inherits = DBCopyOnePropString(build, NULL, CFSTR("inherits"));
 		if (inherits) CFArrayAppendValue(builds, inherits);
 		build = inherits;
 	} while (build != NULL);
@@ -506,19 +522,19 @@
 
 
 CFStringRef DBCopyPropString(CFStringRef build, CFStringRef project, CFStringRef property) {
-	return (CFStringRef)_DBCopyPropWithInheritance(build, project, property, (void*)_DBCopyPropString);
+	return (CFStringRef)_DBCopyPropWithInheritance(build, project, property, (void*)DBCopyOnePropString);
 }
 
 CFDataRef DBCopyPropData(CFStringRef build, CFStringRef project, CFStringRef property) {
-	return (CFDataRef)_DBCopyPropWithInheritance(build, project, property, (void*)_DBCopyPropData);
+	return (CFDataRef)_DBCopyPropWithInheritance(build, project, property, (void*)DBCopyOnePropData);
 }
 
 CFArrayRef DBCopyPropArray(CFStringRef build, CFStringRef project, CFStringRef property) {
-	return (CFArrayRef)_DBCopyPropWithInheritance(build, project, property, (void*)_DBCopyPropArray);
+	return (CFArrayRef)_DBCopyPropWithInheritance(build, project, property, (void*)DBCopyOnePropArray);
 }
 
 CFDictionaryRef DBCopyPropDictionary(CFStringRef build, CFStringRef project, CFStringRef property) {
-	return (CFDictionaryRef)_DBCopyPropWithInheritance(build, project, property, (void*)_DBCopyPropDictionary);
+	return (CFDictionaryRef)_DBCopyPropWithInheritance(build, project, property, (void*)DBCopyOnePropDictionary);
 }
 
 
@@ -857,7 +873,7 @@
 		res = _DBCopyGroupMembers(build, group);
 		if (res) break;
 		
-		build = _DBCopyPropString(build, NULL, CFSTR("inherits"));
+		build = DBCopyOnePropString(build, NULL, CFSTR("inherits"));
 	} while (build != NULL);
 	return res;
 }

Modified: trunk/darwinxref/DBPlugin.h
===================================================================
--- trunk/darwinxref/DBPlugin.h	2005-09-15 20:40:24 UTC (rev 248)
+++ trunk/darwinxref/DBPlugin.h	2006-10-04 09:01:57 UTC (rev 249)
@@ -147,12 +147,21 @@
 
 CFArrayRef DBCopyChangedProjectNames(CFStringRef oldbuild, CFStringRef newbuild);
 
+// Get properties with inheritance
 CFTypeRef DBCopyProp(CFStringRef build, CFStringRef project, CFStringRef property);
 CFStringRef DBCopyPropString(CFStringRef build, CFStringRef project, CFStringRef property);
 CFDataRef DBCopyPropData(CFStringRef build, CFStringRef project, CFStringRef property);
 CFArrayRef DBCopyPropArray(CFStringRef build, CFStringRef project, CFStringRef property);
 CFDictionaryRef DBCopyPropDictionary(CFStringRef build, CFStringRef project, CFStringRef property);
 
+// Get properties without inheritance (only check one build)
+CFTypeRef DBCopyOneProp(CFStringRef build, CFStringRef project, CFStringRef property);
+CFStringRef DBCopyOnePropString(CFStringRef build, CFStringRef project, CFStringRef property);
+CFDataRef DBCopyOnePropData(CFStringRef build, CFStringRef project, CFStringRef property);
+CFArrayRef DBCopyOnePropArray(CFStringRef build, CFStringRef project, CFStringRef property);
+CFDictionaryRef DBCopyOnePropDictionary(CFStringRef build, CFStringRef project, CFStringRef property);
+
+
 int DBSetProp(CFStringRef build, CFStringRef project, CFStringRef property, CFTypeRef value);
 int DBSetPropString(CFStringRef build, CFStringRef project, CFStringRef property, CFStringRef value);
 int DBSetPropData(CFStringRef build, CFStringRef project, CFStringRef property, CFDataRef value);

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/darwinbuild-changes/attachments/20061004/5a43defb/attachment-0001.html


More information about the darwinbuild-changes mailing list