CFLite/CFTest/CFTest.cpp: Difference between revisions

From kJams Wiki
Jump to navigation Jump to search
No edit summary
 
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 6: Line 6:
#include <CoreFoundation/CFCalendar.h>
#include <CoreFoundation/CFCalendar.h>
#include <CoreFoundation/CFBundle.h>
#include <CoreFoundation/CFBundle.h>
#include "CFTest.h"


static void ShowDiacriticSensitiveCompare(bool insensitiveB)
static void ShowDiacriticSensitiveCompare(bool insensitiveB)
{
{
SuperString resultStr;
g_pref_diacritic_insensitive_searchB = insensitiveB;
g_pref_diacritic_insensitive_searchB = insensitiveB;
printf("diacritic %ssensitive\n", insensitiveB ? "in" : "");
CCFLog()(resultStr.ssprintf("diacritic %ssensitive\n", insensitiveB ? "in" : "").ref());
SuperString str1("NeUi");
SuperString str1("NeUi");
Line 18: Line 21:
bool diacritic_insensitive_compareB = str1 == str2;
bool diacritic_insensitive_compareB = str1 == str2;
printf("%s %s %s\n",  
CCFLog()(resultStr.ssprintf("%s %s %s\n",  
  str1.consoleZ(),  
  str1.utf8Z(),  
  diacritic_insensitive_compareB ? "==" : "!=",  
  diacritic_insensitive_compareB ? "==" : "!=",  
  str2.consoleZ());
  str2.utf8Z()).ref());
if (insensitiveB) {
if (insensitiveB) {
Line 28: Line 31:
}
}


void CFLog::operator()(CFTypeRef valRef) {
#if 1
SuperString valStr;
valStr.Set_CFType(valRef);
printf("%s\n", valStr.consoleZ());
#else
fflush(stdout);
CFShow(valRef);
#endif
}
void CFTest(const char *pathZ);
void CFTest(const char *pathZ)
void CFTest(const char *pathZ)
{
{
#if defined(__WIN32__)
SuperString resultStr;
#define kCodePage_WindowsLatin1 1252
SetDefaultEncoding(kCFStringEncodingASCII);
SetConsoleOutputCP(kCodePage_WindowsLatin1);
#endif
// test console logging and CFSTR macro
// test console logging and CFSTR macro
{
{
CFLog()(CFSTR("------------------Strings---------------"));
CCFLog()(CFSTR("------------------Strings---------------\n"));
CFLog()(CFSTR("Hello, World!"));
CCFLog()(CFSTR("Hello, World!\n"));
ScCFReleaser<CFDataRef> dataRef(SuperString("yeah baby").CopyDataRef());
ScCFReleaser<CFDataRef> dataRef(SuperString("yeah baby").CopyDataRef());
SuperString str;
SuperString str;
str.Set(dataRef);
str.Set(dataRef);
printf(SuperString("The next line should read " kLeftQuote "yeah baby" kRightQuote "\n").consoleZ());
CCFLog()(SuperString("The next line should read <yeah baby>\n").ref());
CFLog()(str.ref());
CCFLog(true)(str.ref());
SuperString str1("foscoobyar");
SuperString str1("foscoobyar");
SuperString str2("scooby");
SuperString str2("scooby");
printf("\n%s %s %s\n",  
resultStr.ssprintf(
  str1.consoleZ(),  
"\n%s %s %s\n",  
  str1.Contains(str2) ? "contains" : "$$$ Error: does not contain(!?)",  
str1.utf8Z(),  
  str2.consoleZ());
str1.Contains(str2) ? "contains" : "$$$ Error: does not contain(!?)",  
str2.utf8Z());
CCFLog()(resultStr.ref());
str1.Replace(str2, "o b");
str1.Replace(str2, "o b");
printf(SuperString("The next line should read " kLeftQuote "foo bar" kRightQuote "\n").consoleZ());
CCFLog()(SuperString("The next line should read <foo bar>\n").ref());
CFLog()(str1.ref());
CCFLog(true)(str1.ref());
CFLog()(CFSTR("------------------Case Insensitive Compare---------------"));
CCFLog()(CFSTR("------------------Case Insensitive Compare---------------\n"));
ShowDiacriticSensitiveCompare(false);
ShowDiacriticSensitiveCompare(false);
printf("\n");
CCFLog()(CFSTR("\n"));
ShowDiacriticSensitiveCompare(true);
ShowDiacriticSensitiveCompare(true);
{
{
CFLog()(CFSTR("------------------Conversion---------------"));
CCFLog()(CFSTR("------------------Conversion---------------\n"));
SuperString jStr("%E3%82%91%E3%82%92%E3%81%BC%E3%81%BE%E3%81%82%E3%82%BA%E3%82%B8%E3%83%85%E3%83%9D", kCFStringEncodingPercentEscapes);
SuperString jStr("%E3%82%91%E3%82%92%E3%81%BC%E3%81%BE%E3%81%82%E3%82%BA%E3%82%B8%E3%83%85%E3%83%9D", kCFStringEncodingPercentEscapes);
Line 92: Line 83:
SuperString convertedJ;  convertedJ.Set(j, kConvertEncode);
SuperString convertedJ;  convertedJ.Set(j, kConvertEncode);
if (kConsoleEncoding == kCFStringEncodingUTF8) {
CCFLog()(resultStr.ssprintf(
printf(SuperString("The next line should read " kLeftQuote "%s" kRightQuote "\n%s\n").consoleZ(),  
"The next line should read <%s>\n%s\n",  
  jStr.consoleZ(), convertedJ.consoleZ());
jStr.utf8Z(), convertedJ.utf8Z()).ref());
}
printf("conversion: %s\n", convertedJ == jStr ? "Success!" : "$$ FAILED!");
CCFLog()(resultStr.ssprintf("conversion: %s\n", convertedJ == jStr ? "Success!" : "$$ FAILED!").ref());
}
}
}
}
{
{
CFLog()(CFSTR("------------------Encoding---------------"));
CCFLog()(CFSTR("------------------Encoding---------------\n"));
CFStringEncoding encoding = CFStringGetSystemEncoding();
CFStringEncoding encoding = CFStringGetSystemEncoding();
printf("Encoding: %s\n", SuperString(CFStringGetNameOfEncoding(encoding)).consoleZ());
CCFLog()(resultStr.ssprintf("Encoding: %s\n", SuperString(CFStringGetNameOfEncoding(encoding)).utf8Z()).ref());
CCFLog()(resultStr.ssprintf("IANA charset: %s\n", SuperString(CFStringConvertEncodingToIANACharSetName(encoding)).utf8Z()).ref());
printf("IANA charset: %s\n", SuperString(CFStringConvertEncodingToIANACharSetName(encoding)).consoleZ());
#if defined(__WIN32__)
#if defined(__WIN32__)
Line 116: Line 105:
}
}
printf("codepage: %ld\n", codePage);
CCFLog()(resultStr.ssprintf("codepage: %ld\n", codePage).ref());
CF_ASSERT(CFStringConvertWindowsCodepageToEncoding(codePage) == encoding);
CF_ASSERT(CFStringConvertWindowsCodepageToEncoding(codePage) == encoding);
#endif
#endif
}
}
CFLog()(CFSTR("------------------Locale---------------"));
CCFLog()(CFSTR("------------------Locale---------------\n"));
ScCFReleaser<CFLocaleRef> locale(CFLocaleCopyCurrent());
ScCFReleaser<CFLocaleRef> locale(CFLocaleCopyCurrent());
Line 127: Line 116:
SuperString localIdStr(CFLocaleGetIdentifier(locale));
SuperString localIdStr(CFLocaleGetIdentifier(locale));
printf("Locale ID: %s\n", localIdStr.consoleZ());
CCFLog()(resultStr.ssprintf("Locale ID: %s\n", localIdStr.utf8Z()).ref());
ScCFReleaser<CFDictionaryRef> dictRef(CFLocaleCreateComponentsFromLocaleIdentifier(
ScCFReleaser<CFDictionaryRef> dictRef(CFLocaleCreateComponentsFromLocaleIdentifier(
kCFAllocatorDefault, localIdStr.ref()));
kCFAllocatorDefault, localIdStr.ref()));
dict_for_each(dictRef, CFLog());
dict_for_each(dictRef, CCFLog(true));
}
}
{
{
CFLog()(CFSTR("------------------Preferred Languages---------------"));
CCFLog()(CFSTR("------------------Preferred Languages---------------\n"));
ScCFReleaser<CFArrayRef> arrayRef(CFLocaleCopyPreferredLanguages());
ScCFReleaser<CFArrayRef> arrayRef(CFLocaleCopyPreferredLanguages());
array_for_each(arrayRef, CFLog());
array_for_each(arrayRef, CCFLog(true));
}
}
{
{
CFLog()(CFSTR("------------------Calendar---------------"));
CCFLog()(CFSTR("------------------Calendar---------------\n"));
ScCFReleaser<CFCalendarRef> calendarRef(CFCalendarCopyCurrent());
ScCFReleaser<CFCalendarRef> calendarRef(CFCalendarCopyCurrent());
printf("Calendar ID: %s\n", SuperString(CFCalendarGetIdentifier(calendarRef)).consoleZ());
CCFLog()(resultStr.ssprintf("Calendar ID: %s\n", SuperString(CFCalendarGetIdentifier(calendarRef)).utf8Z()).ref());
ScCFReleaser<CFTimeZoneRef> timeZoneRef(CFCalendarCopyTimeZone(calendarRef));
ScCFReleaser<CFTimeZoneRef> timeZoneRef(CFCalendarCopyTimeZone(calendarRef));
CFLog()(timeZoneRef.Get());
CCFLog(true)(timeZoneRef.Get());
CFAbsoluteTime absTime = CFAbsoluteTimeGetCurrent();
CFAbsoluteTime absTime = CFAbsoluteTimeGetCurrent();
Line 155: Line 144:
ScCFReleaser<CFDateRef> dateRef(CFDateCreate(kCFAllocatorDefault, absTime));
ScCFReleaser<CFDateRef> dateRef(CFDateCreate(kCFAllocatorDefault, absTime));
CFLog()(dateRef.Get());
CCFLog(true)(dateRef.Get());
CFGregorianDate gregDate(CFAbsoluteTimeGetGregorianDate(absTime, timeZoneRef));
CFGregorianDate gregDate(CFAbsoluteTimeGetGregorianDate(absTime, timeZoneRef));
printf("year: %d\nmonth: %d\nday: %d\nhour: %d\nminute: %d\nsecond: %f\n",  
CCFLog()(resultStr.ssprintf("year: %d\nmonth: %d\nday: %d\nhour: %d\nminute: %d\nsecond: %f\n",  
  (int)gregDate.year,  
  (int)gregDate.year,  
  (int)gregDate.month,  
  (int)gregDate.month,  
Line 164: Line 153:
  (int)gregDate.hour,  
  (int)gregDate.hour,  
  (int)gregDate.minute,  
  (int)gregDate.minute,  
  (float)gregDate.second);
  (float)gregDate.second).ref());
ScCFReleaser<CFDateFormatterRef> dateFormatterRef(CFDateFormatterCreate(
ScCFReleaser<CFDateFormatterRef> dateFormatterRef(CFDateFormatterCreate(
Line 172: Line 161:
kCFAllocatorDefault, dateFormatterRef, dateRef));
kCFAllocatorDefault, dateFormatterRef, dateRef));
CFLog()(CFSTR("Make sure time zone is correct in the next line:"));
CCFLog()(CFSTR("Make sure time zone is correct in the next line:\n"));
CFLog()(dateStr.Get());
CCFLog(true)(dateStr.Get());
}
}
{
{
CFLog()(CFSTR("------------------Numbers---------------"));
CCFLog()(CFSTR("------------------Numbers---------------\n"));
ScCFReleaser<CFNumberFormatterRef> numFormatRef;
ScCFReleaser<CFNumberFormatterRef> numFormatRef;
ScCFReleaser<CFStringRef> numStr;
ScCFReleaser<CFStringRef> numStr;
Line 188: Line 177:
numStr.adopt(CFNumberFormatterCreateStringWithNumber(
numStr.adopt(CFNumberFormatterCreateStringWithNumber(
kCFAllocatorDefault, numFormatRef, numberRef));
kCFAllocatorDefault, numFormatRef, numberRef));
CFLog()(numStr.Get());
CCFLog(true)(numStr.Get());
numFormatRef.adopt(CFNumberFormatterCreate(
numFormatRef.adopt(CFNumberFormatterCreate(
Line 194: Line 183:
numStr.adopt(CFNumberFormatterCreateStringWithNumber(
numStr.adopt(CFNumberFormatterCreateStringWithNumber(
kCFAllocatorDefault, numFormatRef, numberRef));
kCFAllocatorDefault, numFormatRef, numberRef));
CFLog()(numStr.Get());
CCFLog(true)(numStr.Get());
}
}
{
{
CFLog()(CFSTR("------------------Bundle---------------"));
CCFLog()(CFSTR("------------------Bundle---------------\n"));
ScCFReleaser<CFBundleRef> bundleRef(CFBundleGetMainBundle());
ScCFReleaser<CFBundleRef> bundleRef(CFBundleGetMainBundle());
Line 219: Line 208:
if (bundleUrlRef.Get() != NULL) {
if (bundleUrlRef.Get() != NULL) {
CFLog()(bundleUrlRef.Get());
CCFLog(true)(bundleUrlRef.Get());
if (bundleRef.Get() != NULL) {
if (bundleRef.Get() != NULL) {
ScCFReleaser<CFDictionaryRef> dictRef(CFBundleGetInfoDictionary(bundleRef));
ScCFReleaser<CFDictionaryRef> dictRef(CFBundleGetInfoDictionary(bundleRef));
dict_for_each(dictRef, CFLog());
dict_for_each(dictRef, CCFLog(true));
}
}
{
{
CFLog()(CFSTR("------------------plist - xml---------------"));
CCFLog()(CFSTR("------------------plist - xml---------------\n"));
#if defined(__WIN32__)
#if defined(__WIN32__)
Line 245: Line 234:
ScCFReleaser<CFURLRef> absUrlRef(CFURLCopyAbsoluteURL(xmlUrlRef));
ScCFReleaser<CFURLRef> absUrlRef(CFURLCopyAbsoluteURL(xmlUrlRef));
printf("URL: %s\n", SuperString(CFURLGetString(absUrlRef)).consoleZ());
CCFLog()(resultStr.ssprintf("URL: %s\n", SuperString(CFURLGetString(absUrlRef)).utf8Z()).ref());
if (Read_PList(xmlUrlRef, dictRef.AddressOf())) {
if (Read_PList(xmlUrlRef, dictRef.AddressOf())) {
dict_for_each(dictRef, CFLog());
dict_for_each(dictRef, CCFLog(true));
SuperString outRelpath("out.xml"); outRelpath.prepend(relPathStr);
SuperString outRelpath("out.xml"); outRelpath.prepend(relPathStr);
Line 257: Line 246:
}
}
} else {
} else {
CFLog()(CFSTR("error illegal file path?"));
CCFLog()(CFSTR("error illegal file path?\n"));
}
}
}
}
Line 263: Line 252:
}
}
CFLog()(CFSTR("\nNote: not exercied here, but I want full CFXML support: input stream, node, parser, tree"));
CCFLog()(CFSTR("\nNote: not exercied here, but I want full CFXML support: input stream, node, parser, tree\n"));
 
/*
*dictP = CFDictionaryCreateMutable(
  kCFAllocatorDefault, 0,
  &kCFTypeDictionaryKeyCallBacks,
  &kCFTypeDictionaryValueCallBacks);
 
CFDictionarySetValue(dict, keyRef, rectDictRef);
CFDictionarySetValue(plist.Get(), OSTypeToString(CM_Key_AlbumDict).ref(), album.Get());
return (CFStringRef)CFDictionaryGetValue(dict, keyRef.Get());
 
*arrayP = CFArrayCreateMutable(
  kCFAllocatorDefault, 0,
  &kCFTypeArrayCallBacks);
 
CFArrayAppendValue(i_selectionRef, itemRef.Get());
CFArrayInsertValueAtIndex(arrayRef, atIndex, valRef.Get());
CFNumberRef valRef = (CFNumberRef)CFArrayGetValueAtIndex(dict, indexL);
CFArraySetValueAtIndex(dict, indexL, valRef.Get());
return CFArrayGetFirstIndexOfValue(array, rangeRef, valRef.Get());
 
 
*xmlP = CFXMLTreeCreateFromData(
kCFAllocatorDefault,
xmlData.Get(), url,
kCFXMLParserSkipWhitespace,
kCFXMLNodeCurrentVersion);
CFXMLNodeTypeCode type = CFXMLNodeGetTypeCode(nodeRef);
CFXMLElementInfo *infoP = (CFXMLElementInfo *)CFXMLNodeGetInfoPtr(nodeRef);
i_keyStr.Set(CFXMLNodeGetString(nodeRef));
*/
/*
/*
bonus points:  CFCharacterSet
bonus points:  CFCharacterSet
*/
*/
CFLog()(CFSTR("--------------------------------------"));
CCFLog()(CFSTR("--------------------------------------\n"));
}
}
</pre>
</pre>

Latest revision as of 22:28, 22 July 2008

#include "SuperString.h"
#include <CoreFoundation/CFLocale.h>
#include <CoreFoundation/CFNumberFormatter.h>
#include <CoreFoundation/CFDateFormatter.h>
#include <CoreFoundation/CFCalendar.h>
#include <CoreFoundation/CFBundle.h>
#include "CFTest.h"

static void	ShowDiacriticSensitiveCompare(bool insensitiveB)
{
	SuperString		resultStr;

	g_pref_diacritic_insensitive_searchB = insensitiveB;
	
	CCFLog()(resultStr.ssprintf("diacritic %ssensitive\n", insensitiveB ? "in" : "").ref());
	
	SuperString			str1("NeUi");
	SuperString			str2("%C3%B1%C3%A9%C3%BC%C3%AE", kCFStringEncodingPercentEscapes);
	
	bool				diacritic_insensitive_compareB = str1 == str2;
	
	CCFLog()(resultStr.ssprintf("%s %s %s\n", 
		   str1.utf8Z(), 
		   diacritic_insensitive_compareB ? "==" : "!=", 
		   str2.utf8Z()).ref());
	
	if (insensitiveB) {
		CF_ASSERT(diacritic_insensitive_compareB);
	}
}

void	CFTest(const char *pathZ)
{
	SuperString		resultStr;
	
	SetDefaultEncoding(kCFStringEncodingASCII);
	
	//	test console logging and CFSTR macro
	{
		CCFLog()(CFSTR("------------------Strings---------------\n"));
		CCFLog()(CFSTR("Hello, World!\n"));
		ScCFReleaser<CFDataRef>		dataRef(SuperString("yeah baby").CopyDataRef());
		SuperString					str;
		
		str.Set(dataRef);
		CCFLog()(SuperString("The next line should read <yeah baby>\n").ref());
		CCFLog(true)(str.ref());
		
		SuperString		str1("foscoobyar");
		SuperString		str2("scooby");
		
		resultStr.ssprintf(
			"\n%s %s %s\n", 
			str1.utf8Z(), 
			str1.Contains(str2) ? "contains" : "$$$ Error: does not contain(!?)", 
			str2.utf8Z());
		
		CCFLog()(resultStr.ref());
		
		str1.Replace(str2, "o b");
		CCFLog()(SuperString("The next line should read <foo bar>\n").ref());
		CCFLog(true)(str1.ref());
		
		CCFLog()(CFSTR("------------------Case Insensitive Compare---------------\n"));
		ShowDiacriticSensitiveCompare(false);
		CCFLog()(CFSTR("\n"));
		ShowDiacriticSensitiveCompare(true);
		
		{
			CCFLog()(CFSTR("------------------Conversion---------------\n"));
			SuperString			jStr("%E3%82%91%E3%82%92%E3%81%BC%E3%81%BE%E3%81%82%E3%82%BA%E3%82%B8%E3%83%85%E3%83%9D", kCFStringEncodingPercentEscapes);
				
			#if defined(__WIN32__)
				#define		kConvertEncode		kCFStringEncodingDOSJapanese
			#else
				#define		kConvertEncode		kCFStringEncodingMacJapanese
			#endif
			
			ustring				j;
			CopyCFStringToUString(jStr.ref(), j, kConvertEncode);
			
			SuperString			convertedJ;  convertedJ.Set(j, kConvertEncode);
			
			CCFLog()(resultStr.ssprintf(
				"The next line should read <%s>\n%s\n", 
				jStr.utf8Z(), convertedJ.utf8Z()).ref());
			
			CCFLog()(resultStr.ssprintf("conversion: %s\n", convertedJ == jStr ? "Success!" : "$$ FAILED!").ref());
		}
	}
	
	{
		CCFLog()(CFSTR("------------------Encoding---------------\n"));
		CFStringEncoding		encoding = CFStringGetSystemEncoding();
		
		CCFLog()(resultStr.ssprintf("Encoding: %s\n", SuperString(CFStringGetNameOfEncoding(encoding)).utf8Z()).ref());
		CCFLog()(resultStr.ssprintf("IANA charset: %s\n", SuperString(CFStringConvertEncodingToIANACharSetName(encoding)).utf8Z()).ref());
		
		#if defined(__WIN32__)
			UInt32					codePage = CFStringConvertEncodingToWindowsCodepage(encoding);
			
			if (encoding == kCFStringEncodingWindowsLatin1) {
				CF_ASSERT(codePage == kCodePage_WindowsLatin1);
			}
			
			CCFLog()(resultStr.ssprintf("codepage: %ld\n", codePage).ref());
			CF_ASSERT(CFStringConvertWindowsCodepageToEncoding(codePage) == encoding);
		#endif		
	}
	
	CCFLog()(CFSTR("------------------Locale---------------\n"));
	ScCFReleaser<CFLocaleRef>				locale(CFLocaleCopyCurrent());
	
	{
		SuperString				localIdStr(CFLocaleGetIdentifier(locale));
		
		CCFLog()(resultStr.ssprintf("Locale ID: %s\n", localIdStr.utf8Z()).ref());
		
		ScCFReleaser<CFDictionaryRef>	dictRef(CFLocaleCreateComponentsFromLocaleIdentifier(
			kCFAllocatorDefault, localIdStr.ref()));
		
		dict_for_each(dictRef, CCFLog(true));
	}
	
	{
		CCFLog()(CFSTR("------------------Preferred Languages---------------\n"));
		ScCFReleaser<CFArrayRef>	arrayRef(CFLocaleCopyPreferredLanguages());
		
		array_for_each(arrayRef, CCFLog(true));
	}
	
	{
		CCFLog()(CFSTR("------------------Calendar---------------\n"));
		ScCFReleaser<CFCalendarRef>		calendarRef(CFCalendarCopyCurrent());
		
		CCFLog()(resultStr.ssprintf("Calendar ID: %s\n", SuperString(CFCalendarGetIdentifier(calendarRef)).utf8Z()).ref());
		
		ScCFReleaser<CFTimeZoneRef>		timeZoneRef(CFCalendarCopyTimeZone(calendarRef));
		CCFLog(true)(timeZoneRef.Get());
		
		CFAbsoluteTime				absTime = CFAbsoluteTimeGetCurrent();
		
		ScCFReleaser<CFDateRef>		dateRef(CFDateCreate(kCFAllocatorDefault, absTime));
		
		CCFLog(true)(dateRef.Get());
		
		CFGregorianDate				gregDate(CFAbsoluteTimeGetGregorianDate(absTime, timeZoneRef));
		CCFLog()(resultStr.ssprintf("year: %d\nmonth: %d\nday: %d\nhour: %d\nminute: %d\nsecond: %f\n", 
			   (int)gregDate.year, 
			   (int)gregDate.month, 
			   (int)gregDate.day, 
			   (int)gregDate.hour, 
			   (int)gregDate.minute, 
			   (float)gregDate.second).ref());
		
		ScCFReleaser<CFDateFormatterRef>	dateFormatterRef(CFDateFormatterCreate(
			kCFAllocatorDefault, locale, kCFDateFormatterFullStyle, kCFDateFormatterFullStyle));
		
		ScCFReleaser<CFStringRef>			dateStr(CFDateFormatterCreateStringWithDate(
			kCFAllocatorDefault, dateFormatterRef, dateRef));
		
		CCFLog()(CFSTR("Make sure time zone is correct in the next line:\n"));
		CCFLog(true)(dateStr.Get());
	}
	
	{
		CCFLog()(CFSTR("------------------Numbers---------------\n"));
		ScCFReleaser<CFNumberFormatterRef>		numFormatRef;
		ScCFReleaser<CFStringRef>				numStr;
		float									numF = 123456.789;
		ScCFReleaser<CFNumberRef>				numberRef(CFNumberCreate(
			kCFAllocatorDefault, kCFNumberFloat32Type, &numF));
		
		numFormatRef.adopt(CFNumberFormatterCreate(
			kCFAllocatorDefault, locale, kCFNumberFormatterDecimalStyle));
		numStr.adopt(CFNumberFormatterCreateStringWithNumber(
			kCFAllocatorDefault, numFormatRef, numberRef));
		CCFLog(true)(numStr.Get());
		
		numFormatRef.adopt(CFNumberFormatterCreate(
			kCFAllocatorDefault, locale, kCFNumberFormatterCurrencyStyle));
		numStr.adopt(CFNumberFormatterCreateStringWithNumber(
			kCFAllocatorDefault, numFormatRef, numberRef));
		CCFLog(true)(numStr.Get());
	}
	
	{
		CCFLog()(CFSTR("------------------Bundle---------------\n"));	
		
		ScCFReleaser<CFBundleRef>		bundleRef(CFBundleGetMainBundle());
		ScCFReleaser<CFURLRef>			bundleUrlRef;
		
		if (bundleRef.Get() == NULL) {
			if (pathZ != NULL) {
				bundleUrlRef.adopt(CFURLCreateWithFileSystemPath(
					kCFAllocatorDefault, SuperString(pathZ), kCFURLWindowsPathStyle, false));
			}
		} else {
			bundleUrlRef.adopt(CFBundleCopyBundleURL(bundleRef));
			
			//	this is a "get" not a "copy" so extra retain will cancel the extra release
			bundleRef.Retain();
		}
		
		CF_ASSERT(bundleUrlRef.Get());
		
		if (bundleUrlRef.Get() != NULL) {
			
			CCFLog(true)(bundleUrlRef.Get());
			
			if (bundleRef.Get() != NULL) {
				ScCFReleaser<CFDictionaryRef>	dictRef(CFBundleGetInfoDictionary(bundleRef));
				
				dict_for_each(dictRef, CCFLog(true));
			}
			
			{
				CCFLog()(CFSTR("------------------plist - xml---------------\n"));
				
				#if defined(__WIN32__)
					//	you may need to fix this relative URL here
					SuperString				relPathStr("../../");
				#else
					SuperString				relPathStr("../../../");
				#endif
				
				SuperString				testRelPath("test.xml");	testRelPath.prepend(relPathStr);
				ScCFReleaser<CFURLRef>	xmlUrlRef(CFURLCreateWithFileSystemPathRelativeToBase(
					kCFAllocatorDefault, testRelPath.ref(), kCFURLPOSIXPathStyle, false, bundleUrlRef));
				
				if (xmlUrlRef.Get()) {
					ScCFReleaser<CFDictionaryRef>		dictRef;
					ScCFReleaser<CFURLRef>				absUrlRef(CFURLCopyAbsoluteURL(xmlUrlRef));
					
					CCFLog()(resultStr.ssprintf("URL: %s\n", SuperString(CFURLGetString(absUrlRef)).utf8Z()).ref());
					
					if (Read_PList(xmlUrlRef, dictRef.AddressOf())) {
						dict_for_each(dictRef, CCFLog(true));
						
						SuperString				outRelpath("out.xml");	outRelpath.prepend(relPathStr);
						ScCFReleaser<CFURLRef>	outXmlUrlRef(CFURLCreateWithFileSystemPathRelativeToBase(
							kCFAllocatorDefault, outRelpath.ref(), kCFURLPOSIXPathStyle, false, bundleUrlRef));
						
						Write_PList(dictRef.Get(), outXmlUrlRef);
					}
				} else {
					CCFLog()(CFSTR("error illegal file path?\n"));
				}
			}
		}
	}
	
	CCFLog()(CFSTR("\nNote: not exercied here, but I want full CFXML support: input stream, node, parser, tree\n"));

	/*
	*dictP = CFDictionaryCreateMutable(
									   kCFAllocatorDefault, 0,
									   &kCFTypeDictionaryKeyCallBacks,
									   &kCFTypeDictionaryValueCallBacks);

	CFDictionarySetValue(dict, keyRef, rectDictRef);
	CFDictionarySetValue(plist.Get(), OSTypeToString(CM_Key_AlbumDict).ref(), album.Get());
	return (CFStringRef)CFDictionaryGetValue(dict, keyRef.Get());

	*arrayP = CFArrayCreateMutable(
								   kCFAllocatorDefault, 0,
								   &kCFTypeArrayCallBacks);

	CFArrayAppendValue(i_selectionRef, itemRef.Get());
	CFArrayInsertValueAtIndex(arrayRef, atIndex, valRef.Get());
	CFNumberRef			valRef	= (CFNumberRef)CFArrayGetValueAtIndex(dict, indexL);
	CFArraySetValueAtIndex(dict, indexL, valRef.Get());
	return CFArrayGetFirstIndexOfValue(array, rangeRef, valRef.Get());


	*xmlP = CFXMLTreeCreateFromData(
									kCFAllocatorDefault,
									xmlData.Get(), url, 
									kCFXMLParserSkipWhitespace,
									kCFXMLNodeCurrentVersion);
	
	CFXMLNodeTypeCode		type = CFXMLNodeGetTypeCode(nodeRef);
	CFXMLElementInfo	*infoP = (CFXMLElementInfo *)CFXMLNodeGetInfoPtr(nodeRef);
	i_keyStr.Set(CFXMLNodeGetString(nodeRef));
*/
	
	/*
	 bonus points:  CFCharacterSet
	 */
	CCFLog()(CFSTR("--------------------------------------\n"));
}