RBDataMap::RBDataMap()
{
UErrorCode status = U_ZERO_ERROR;
fData = new Hashtable(true, status);
fData->setValueDeleter(deleteResBund);
}
// init from table resource // will put stuff in hashtable according to // keys.
RBDataMap::RBDataMap(UResourceBundle *data, UErrorCode &status)
{
fData = new Hashtable(true, status);
fData->setValueDeleter(deleteResBund);
init(data, status);
}
// init from headers and resource // with checking the whether the size of resource matches // header size
RBDataMap::RBDataMap(UResourceBundle *headers, UResourceBundle *data, UErrorCode &status)
{
fData = new Hashtable(true, status);
fData->setValueDeleter(deleteResBund);
init(headers, data, status);
}
void RBDataMap::init(UResourceBundle *data, UErrorCode &status) {
int32_t i = 0;
fData->removeAll();
UResourceBundle *t = nullptr; for(i = 0; i < ures_getSize(data); i++) {
t = ures_getByIndex(data, i, t, &status);
fData->put(UnicodeString(ures_getKey(t), -1, US_INV), new ResourceBundle(t, status), status);
}
ures_close(t);
}
void RBDataMap::init(UResourceBundle *headers, UResourceBundle *data, UErrorCode &status)
{
int32_t i = 0;
fData->removeAll();
UResourceBundle *t = nullptr; const char16_t *key = nullptr;
int32_t keyLen = 0; if(ures_getSize(headers) == ures_getSize(data)) { for(i = 0; i < ures_getSize(data); i++) {
t = ures_getByIndex(data, i, t, &status);
key = ures_getStringByIndex(headers, i, &keyLen, &status);
fData->put(UnicodeString(key, keyLen), new ResourceBundle(t, status), status);
}
} else { // error
status = U_INVALID_FORMAT_ERROR;
}
ures_close(t);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.