- TestStringService service;
- service.registerFactory(sf, status);
-
- {
- UnicodeString* result = (UnicodeString*)service.get("object", status);
- if (result) {
- logln("object is: " + *result);
- delete result;
- } else {
- errln("could not get object");
- }
- }
+ {
+ TestStringService service;
+ service.registerFactory(sf, status);
+
+ {
+ UnicodeString* result = (UnicodeString*)service.get("object", status);
+ if (result) {
+ logln("object is: " + *result);
+ delete result;
+ } else {
+ errln("could not get object");
+ }
+ }
+ }
+ }
+
+ // ICUServiceKey
+ {
+ UErrorCode status = U_ZERO_ERROR;
+ UnicodeString* howdy = new UnicodeString("Howdy");
+
+ TestStringSimpleKeyService service;
+ service.registerInstance(howdy, "Greetings", status);
+ {
+ UnicodeString* result = (UnicodeString*)service.get("Greetings", status);
+ if (result) {
+ logln("object is: " + *result);
+ delete result;
+ } else {
+ errln("could not get object");
+ }
+ }
+
+ UVector ids(uprv_deleteUObject, uhash_compareUnicodeString, status);
+ // yuck, this is awkward to use. All because we pass null in an overload.
+ // TODO: change this.
+ UnicodeString str("Greet");
+ service.getVisibleIDs(ids, &str, status);
+ confirmIdentical("no fallback of greet", ids.size(), 0);