colonialRegions::colonialRegions() { LOG(LogLevel::Info) << "Parsing EU4 colonial regions"; registerKeyword(std::regex("colonial_\\w+"), [this](const std::string& regionName, std::istream& theStream) { colonialRegion newRegion(theStream); auto provinces = newRegion.getProvinces(); std::for_each(provinces.begin(), provinces.end(), [this, regionName](const int& province) { provinceToColonialRegions.insert(std::make_pair(province, regionName)); } ); } ); parseFile(Configuration::getEU4Path() + "/common/colonial_regions/00_colonial_regions.txt"); for (auto mod: Configuration::getEU4Mods()) { set<string> filenames; Utils::GetAllFilesInFolder(mod + "/common/colonial_regions/", filenames); for (auto filename: filenames) { string modRegionsFile(mod + "/common/colonial_regions/" + filename); if (Utils::DoesFileExist(modRegionsFile)) { parseFile(modRegionsFile); } } } }
Point3D BodyRegion::getAnimateRegionPos(AnimationSprite *pSprite, Region region) { Point3D pos = pSprite->getCenterPosition3D(); Size size(pSprite->getCenterToSides() * 2, pSprite->getCenterToBottom() * 2); int faceDirection = pSprite->getFaceDirection().x; // log("faceDirection:%d",faceDirection); BodyRegion newRegion(pos,size,faceDirection); //初始化 Point3D ret = newRegion.getPosition(region);//相对的位置 return ret; }
// must be called from main thread void GfxPainter::setRect(const QRect &rect) { // XXX - need to support 32-bit if(fRect == rect) return; fRect = rect; width = rect.width(); step = width; height = rect.height(); #if defined(Q_WS_QWS) linestep = QDirectPainter::linestep(); fBuffer = QDirectPainter::frameBuffer(); #endif if(buffer) { delete [] buffer; buffer = 0; } if(fRect.isEmpty()) { if(p) { delete p; delete pImg; p = 0; pImg = 0; } } else { buffer = new uchar[width * height * 2]; if(p) { delete p; delete pImg; } pImg = new QImage(buffer, width, height, QImage::Format_RGB16); p = new QPainter(pImg); } QRegion newRegion(rect); clipRegion = newRegion; if(!qt_region_is_rect(newRegion)) clipRects = newRegion.rects(); else clipRects.clear(); // mainThreadProxy->call(); }
void TiledLayerChromium::updateBounds() { IntSize oldBounds = m_tiler->bounds(); IntSize newBounds = contentBounds(); if (oldBounds == newBounds) return; m_tiler->setBounds(newBounds); // Invalidate any areas that the new bounds exposes. Region oldRegion(IntRect(IntPoint(), oldBounds)); Region newRegion(IntRect(IntPoint(), newBounds)); newRegion.subtract(oldRegion); Vector<IntRect> rects = newRegion.rects(); for (size_t i = 0; i < rects.size(); ++i) invalidateRect(rects[i]); }
void wxGTKDCImpl::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord height ) { wxASSERT_MSG( width >= 0 && height >= 0, "Clipping box size values cannot be negative" ); wxRect newRegion(x, y, width, height); wxRect clipRegion; if ( m_clipping ) { // New clipping box is an intersection // of required clipping box and the current one. wxRect curRegion(m_clipX1, m_clipY1, m_clipX2 - m_clipX1, m_clipY2 - m_clipY1); clipRegion = curRegion.Intersect(newRegion); } else { // Effective clipping box is an intersection // of required clipping box and DC surface. int dcWidth, dcHeight; DoGetSize(&dcWidth, &dcHeight); wxRect dcRect(DeviceToLogicalX(0), DeviceToLogicalY(0), DeviceToLogicalXRel(dcWidth), DeviceToLogicalYRel(dcHeight)); clipRegion = dcRect.Intersect(newRegion); m_clipping = true; } if ( clipRegion.IsEmpty() ) { m_clipX1 = m_clipY1 = m_clipX2 = m_clipY2 = 0; } else { m_clipX1 = clipRegion.GetLeftTop().x; m_clipY1 = clipRegion.GetLeftTop().y; m_clipX2 = clipRegion.GetBottomRight().x + 1; m_clipY2 = clipRegion.GetBottomRight().y + 1; } }
void PositionManager::updateRegion(Movable *movable, float oldX, float oldY, uint8_t oldLayer) { Region oldRegion(oldX, oldY, oldLayer); Region newRegion(movable->x, movable->y, movable->layer); if(oldRegion == newRegion) { return; } movable->onRegionChange(&oldRegion, &newRegion); for(int32_t rx = oldRegion.rx - Region::VISIBILITY_RADIUS; rx <= oldRegion.rx + Region::VISIBILITY_RADIUS; rx++) { int32_t ryStart = oldRegion.ry - Region::VISIBILITY_RADIUS + ::abs(rx - oldRegion.rx); int32_t ryEnd = oldRegion.ry + Region::VISIBILITY_RADIUS - ::abs(rx - oldRegion.rx); for(int32_t ry = ryStart; ry <= ryEnd; ry++) { Region testRegion(rx, ry, oldRegion.layer); if(oldRegion.isVisibleRegion(testRegion) && !newRegion.isVisibleRegion(testRegion)) { //disappear in old region movable->onLeaveRegion(&testRegion); } } } for(int32_t rx = newRegion.rx - Region::VISIBILITY_RADIUS; rx <= newRegion.rx + Region::VISIBILITY_RADIUS; rx++) { int32_t ryStart = newRegion.ry - Region::VISIBILITY_RADIUS + ::abs(rx - newRegion.rx); int32_t ryEnd = newRegion.ry + Region::VISIBILITY_RADIUS - ::abs(rx - newRegion.rx); for(int32_t ry = ryStart; ry <= ryEnd; ry++) { Region testRegion(rx, ry, newRegion.layer); if(newRegion.isVisibleRegion(testRegion) && !oldRegion.isVisibleRegion(testRegion)) { //appear in new region movable->onEnterRegion(&testRegion); } } } }
bool OsmAnd::WorldRegions_P::loadWorldRegions( QHash< QString, std::shared_ptr<const WorldRegion> >& outRegions, const IQueryController* const controller) const { const std::shared_ptr<QIODevice> ocbfFile(new QFile(owner->ocbfFileName)); if (!ocbfFile->open(QIODevice::ReadOnly)) return false; const std::shared_ptr<ObfReader> ocbfReader(new ObfReader(ocbfFile)); const auto& obfInfo = ocbfReader->obtainInfo(); if (!obfInfo) { ocbfFile->close(); return false; } for(const auto& mapSection : constOf(obfInfo->mapSections)) { // Check if request is aborted if (controller && controller->isAborted()) { ocbfFile->close(); return false; } bool idsCaptured = false; uint32_t nameId = std::numeric_limits<uint32_t>::max(); uint32_t idId = std::numeric_limits<uint32_t>::max(); uint32_t downloadNameId = std::numeric_limits<uint32_t>::max(); uint32_t regionPrefixId = std::numeric_limits<uint32_t>::max(); uint32_t regionSuffixId = std::numeric_limits<uint32_t>::max(); const QLatin1String localizedNameTagPrefix("name:"); const auto localizedNameTagPrefixLen = localizedNameTagPrefix.size(); const auto worldRegionsCollector = [&outRegions, &idsCaptured, &nameId, &idId, &downloadNameId, ®ionPrefixId, ®ionSuffixId, localizedNameTagPrefix, localizedNameTagPrefixLen] (const std::shared_ptr<const OsmAnd::Model::BinaryMapObject>& worldRegionMapObject) -> bool { const auto& rules = worldRegionMapObject->section->encodingDecodingRules; if (!idsCaptured) { nameId = rules->name_encodingRuleId; QHash< QString, QHash<QString, uint32_t> >::const_iterator citRule; if ((citRule = rules->encodingRuleIds.constFind(QLatin1String("key_name"))) != rules->encodingRuleIds.cend()) idId = citRule->constBegin().value(); if ((citRule = rules->encodingRuleIds.constFind(QLatin1String("download_name"))) != rules->encodingRuleIds.cend()) downloadNameId = citRule->constBegin().value(); if ((citRule = rules->encodingRuleIds.constFind(QLatin1String("region_prefix"))) != rules->encodingRuleIds.cend()) regionPrefixId = citRule->constBegin().value(); if ((citRule = rules->encodingRuleIds.constFind(QLatin1String("region_suffix"))) != rules->encodingRuleIds.cend()) regionSuffixId = citRule->constBegin().value(); idsCaptured = true; } QString name; QString id; QString downloadName; QString regionPrefix; QString regionSuffix; QHash<QString, QString> localizedNames; for(const auto& localizedNameEntry : rangeOf(constOf(worldRegionMapObject->names))) { const auto ruleId = localizedNameEntry.key(); if (ruleId == idId) { id = localizedNameEntry.value().toLower(); continue; } else if (ruleId == nameId) { name = localizedNameEntry.value(); continue; } else if (ruleId == downloadNameId) { downloadName = localizedNameEntry.value().toLower(); continue; } else if (ruleId == regionPrefixId) { regionPrefix = localizedNameEntry.value().toLower(); continue; } else if (ruleId == regionSuffixId) { regionSuffix = localizedNameEntry.value().toLower(); continue; } const auto& nameTag = rules->decodingRules[localizedNameEntry.key()].tag; if (!nameTag.startsWith(localizedNameTagPrefix)) continue; const auto languageId = nameTag.mid(localizedNameTagPrefixLen).toLower(); localizedNames.insert(languageId, localizedNameEntry.value()); } QString parentId = regionSuffix; if (!regionPrefix.isEmpty()) { if (!parentId.isEmpty()) parentId.prepend(regionPrefix + QLatin1String("_")); else parentId = regionPrefix; } // Build up full id if (!regionPrefix.isEmpty()) id.prepend(regionPrefix + QLatin1String("_")); if (!regionSuffix.isEmpty()) id.append(QLatin1String("_") + regionSuffix); std::shared_ptr<const WorldRegion> newRegion(new WorldRegion(id, downloadName, name, localizedNames, parentId)); outRegions.insert(id, qMove(newRegion)); return false; }; // Read objects from each map section OsmAnd::ObfMapSectionReader::loadMapObjects( ocbfReader, mapSection, mapSection->levels.first()->minZoom, nullptr, // Query entire world nullptr, // No need for map objects to be stored nullptr, // Foundation is not needed nullptr, // No filtering by ID worldRegionsCollector, controller); } ocbfFile->close(); return true; }
/* * Initializes the region data from the ICU resource bundles. The region data * contains the basic relationships such as which regions are known, what the numeric * codes are, any known aliases, and the territory containment data. * * If the region data has already loaded, then this method simply returns without doing * anything meaningful. */ void Region::loadRegionData(UErrorCode &status) { // Construct service objs first LocalUHashtablePointer newRegionIDMap(uhash_open(uhash_hashUnicodeString, uhash_compareUnicodeString, NULL, &status)); LocalUHashtablePointer newNumericCodeMap(uhash_open(uhash_hashLong,uhash_compareLong,NULL,&status)); LocalUHashtablePointer newRegionAliases(uhash_open(uhash_hashUnicodeString,uhash_compareUnicodeString,NULL,&status)); LocalPointer<DecimalFormat> df(new DecimalFormat(status), status); LocalPointer<UVector> continents(new UVector(uprv_deleteUObject, uhash_compareUnicodeString, status), status); LocalPointer<UVector> groupings(new UVector(uprv_deleteUObject, uhash_compareUnicodeString, status), status); allRegions = new UVector(uprv_deleteUObject, uhash_compareUnicodeString, status); LocalUResourceBundlePointer metadata(ures_openDirect(NULL,"metadata",&status)); LocalUResourceBundlePointer metadataAlias(ures_getByKey(metadata.getAlias(),"alias",NULL,&status)); LocalUResourceBundlePointer territoryAlias(ures_getByKey(metadataAlias.getAlias(),"territory",NULL,&status)); LocalUResourceBundlePointer supplementalData(ures_openDirect(NULL,"supplementalData",&status)); LocalUResourceBundlePointer codeMappings(ures_getByKey(supplementalData.getAlias(),"codeMappings",NULL,&status)); LocalUResourceBundlePointer idValidity(ures_getByKey(supplementalData.getAlias(),"idValidity",NULL,&status)); LocalUResourceBundlePointer regionList(ures_getByKey(idValidity.getAlias(),"region",NULL,&status)); LocalUResourceBundlePointer regionRegular(ures_getByKey(regionList.getAlias(),"regular",NULL,&status)); LocalUResourceBundlePointer regionMacro(ures_getByKey(regionList.getAlias(),"macroregion",NULL,&status)); LocalUResourceBundlePointer regionUnknown(ures_getByKey(regionList.getAlias(),"unknown",NULL,&status)); LocalUResourceBundlePointer territoryContainment(ures_getByKey(supplementalData.getAlias(),"territoryContainment",NULL,&status)); LocalUResourceBundlePointer worldContainment(ures_getByKey(territoryContainment.getAlias(),"001",NULL,&status)); LocalUResourceBundlePointer groupingContainment(ures_getByKey(territoryContainment.getAlias(),"grouping",NULL,&status)); if (U_FAILURE(status)) { return; } // now, initialize df->setParseIntegerOnly(TRUE); uhash_setValueDeleter(newRegionIDMap.getAlias(), deleteRegion); // regionIDMap owns objs uhash_setKeyDeleter(newRegionAliases.getAlias(), uprv_deleteUObject); // regionAliases owns the string keys while ( ures_hasNext(regionRegular.getAlias()) ) { UnicodeString regionName = ures_getNextUnicodeString(regionRegular.getAlias(),NULL,&status); int32_t rangeMarkerLocation = regionName.indexOf(RANGE_MARKER); UChar buf[6]; regionName.extract(buf,6,status); if ( rangeMarkerLocation > 0 ) { UChar endRange = regionName.charAt(rangeMarkerLocation+1); buf[rangeMarkerLocation] = 0; while ( buf[rangeMarkerLocation-1] <= endRange ) { LocalPointer<UnicodeString> newRegion(new UnicodeString(buf), status); allRegions->addElement(newRegion.orphan(),status); buf[rangeMarkerLocation-1]++; } } else { LocalPointer<UnicodeString> newRegion(new UnicodeString(regionName), status); allRegions->addElement(newRegion.orphan(),status); } } while ( ures_hasNext(regionMacro.getAlias()) ) { UnicodeString regionName = ures_getNextUnicodeString(regionMacro.getAlias(),NULL,&status); int32_t rangeMarkerLocation = regionName.indexOf(RANGE_MARKER); UChar buf[6]; regionName.extract(buf,6,status); if ( rangeMarkerLocation > 0 ) { UChar endRange = regionName.charAt(rangeMarkerLocation+1); buf[rangeMarkerLocation] = 0; while ( buf[rangeMarkerLocation-1] <= endRange ) { LocalPointer<UnicodeString> newRegion(new UnicodeString(buf), status); allRegions->addElement(newRegion.orphan(),status); buf[rangeMarkerLocation-1]++; } } else { LocalPointer<UnicodeString> newRegion(new UnicodeString(regionName), status); allRegions->addElement(newRegion.orphan(),status); } } while ( ures_hasNext(regionUnknown.getAlias()) ) { LocalPointer<UnicodeString> regionName (new UnicodeString(ures_getNextUnicodeString(regionUnknown.getAlias(),NULL,&status),status)); allRegions->addElement(regionName.orphan(),status); } while ( ures_hasNext(worldContainment.getAlias()) ) { UnicodeString *continentName = new UnicodeString(ures_getNextUnicodeString(worldContainment.getAlias(),NULL,&status)); continents->addElement(continentName,status); } while ( ures_hasNext(groupingContainment.getAlias()) ) { UnicodeString *groupingName = new UnicodeString(ures_getNextUnicodeString(groupingContainment.getAlias(),NULL,&status)); groupings->addElement(groupingName,status); } for ( int32_t i = 0 ; i < allRegions->size() ; i++ ) { LocalPointer<Region> r(new Region(), status); if ( U_FAILURE(status) ) { return; } UnicodeString *regionName = (UnicodeString *)allRegions->elementAt(i); r->idStr = *regionName; r->idStr.extract(0,r->idStr.length(),r->id,sizeof(r->id),US_INV); r->type = URGN_TERRITORY; // Only temporary - figure out the real type later once the aliases are known. Formattable result; UErrorCode ps = U_ZERO_ERROR; df->parse(r->idStr,result,ps); if ( U_SUCCESS(ps) ) { r->code = result.getLong(); // Convert string to number uhash_iput(newNumericCodeMap.getAlias(),r->code,(void *)(r.getAlias()),&status); r->type = URGN_SUBCONTINENT; } else { r->code = -1; } void* idStrAlias = (void*)&(r->idStr); // about to orphan 'r'. Save this off. uhash_put(newRegionIDMap.getAlias(),idStrAlias,(void *)(r.orphan()),&status); // regionIDMap takes ownership } // Process the territory aliases while ( ures_hasNext(territoryAlias.getAlias()) ) { LocalUResourceBundlePointer res(ures_getNextResource(territoryAlias.getAlias(),NULL,&status)); const char *aliasFrom = ures_getKey(res.getAlias()); LocalPointer<UnicodeString> aliasFromStr(new UnicodeString(aliasFrom, -1, US_INV), status); UnicodeString aliasTo = ures_getUnicodeStringByKey(res.getAlias(),"replacement",&status); res.adoptInstead(NULL); const Region *aliasToRegion = (Region *) uhash_get(newRegionIDMap.getAlias(),&aliasTo); Region *aliasFromRegion = (Region *)uhash_get(newRegionIDMap.getAlias(),aliasFromStr.getAlias()); if ( aliasToRegion != NULL && aliasFromRegion == NULL ) { // This is just an alias from some string to a region uhash_put(newRegionAliases.getAlias(),(void *)aliasFromStr.orphan(), (void *)aliasToRegion,&status); } else { if ( aliasFromRegion == NULL ) { // Deprecated region code not in the master codes list - so need to create a deprecated region for it. LocalPointer<Region> newRgn(new Region, status); if ( U_SUCCESS(status) ) { aliasFromRegion = newRgn.orphan(); } else { return; // error out } aliasFromRegion->idStr.setTo(*aliasFromStr); aliasFromRegion->idStr.extract(0,aliasFromRegion->idStr.length(),aliasFromRegion->id,sizeof(aliasFromRegion->id),US_INV); uhash_put(newRegionIDMap.getAlias(),(void *)&(aliasFromRegion->idStr),(void *)aliasFromRegion,&status); Formattable result; UErrorCode ps = U_ZERO_ERROR; df->parse(aliasFromRegion->idStr,result,ps); if ( U_SUCCESS(ps) ) { aliasFromRegion->code = result.getLong(); // Convert string to number uhash_iput(newNumericCodeMap.getAlias(),aliasFromRegion->code,(void *)aliasFromRegion,&status); } else { aliasFromRegion->code = -1; } aliasFromRegion->type = URGN_DEPRECATED; } else { aliasFromRegion->type = URGN_DEPRECATED; } { LocalPointer<UVector> newPreferredValues(new UVector(uprv_deleteUObject, uhash_compareUnicodeString, status), status); aliasFromRegion->preferredValues = newPreferredValues.orphan(); } if( U_FAILURE(status)) { return; } UnicodeString currentRegion; //currentRegion.remove(); TODO: was already 0 length? for (int32_t i = 0 ; i < aliasTo.length() ; i++ ) { if ( aliasTo.charAt(i) != 0x0020 ) { currentRegion.append(aliasTo.charAt(i)); } if ( aliasTo.charAt(i) == 0x0020 || i+1 == aliasTo.length() ) { Region *target = (Region *)uhash_get(newRegionIDMap.getAlias(),(void *)¤tRegion); if (target) { LocalPointer<UnicodeString> preferredValue(new UnicodeString(target->idStr), status); aliasFromRegion->preferredValues->addElement((void *)preferredValue.orphan(),status); // may add null if err } currentRegion.remove(); } } } } // Process the code mappings - This will allow us to assign numeric codes to most of the territories. while ( ures_hasNext(codeMappings.getAlias()) ) { UResourceBundle *mapping = ures_getNextResource(codeMappings.getAlias(),NULL,&status); if ( ures_getType(mapping) == URES_ARRAY && ures_getSize(mapping) == 3) { UnicodeString codeMappingID = ures_getUnicodeStringByIndex(mapping,0,&status); UnicodeString codeMappingNumber = ures_getUnicodeStringByIndex(mapping,1,&status); UnicodeString codeMapping3Letter = ures_getUnicodeStringByIndex(mapping,2,&status); Region *r = (Region *)uhash_get(newRegionIDMap.getAlias(),(void *)&codeMappingID); if ( r ) { Formattable result; UErrorCode ps = U_ZERO_ERROR; df->parse(codeMappingNumber,result,ps); if ( U_SUCCESS(ps) ) { r->code = result.getLong(); // Convert string to number uhash_iput(newNumericCodeMap.getAlias(),r->code,(void *)r,&status); } LocalPointer<UnicodeString> code3(new UnicodeString(codeMapping3Letter), status); uhash_put(newRegionAliases.getAlias(),(void *)code3.orphan(), (void *)r,&status); } } ures_close(mapping); } // Now fill in the special cases for WORLD, UNKNOWN, CONTINENTS, and GROUPINGS Region *r; UnicodeString WORLD_ID_STRING(WORLD_ID); r = (Region *) uhash_get(newRegionIDMap.getAlias(),(void *)&WORLD_ID_STRING); if ( r ) { r->type = URGN_WORLD; } UnicodeString UNKNOWN_REGION_ID_STRING(UNKNOWN_REGION_ID); r = (Region *) uhash_get(newRegionIDMap.getAlias(),(void *)&UNKNOWN_REGION_ID_STRING); if ( r ) { r->type = URGN_UNKNOWN; } for ( int32_t i = 0 ; i < continents->size() ; i++ ) { r = (Region *) uhash_get(newRegionIDMap.getAlias(),(void *)continents->elementAt(i)); if ( r ) { r->type = URGN_CONTINENT; } } for ( int32_t i = 0 ; i < groupings->size() ; i++ ) { r = (Region *) uhash_get(newRegionIDMap.getAlias(),(void *)groupings->elementAt(i)); if ( r ) { r->type = URGN_GROUPING; } } // Special case: The region code "QO" (Outlying Oceania) is a subcontinent code added by CLDR // even though it looks like a territory code. Need to handle it here. UnicodeString OUTLYING_OCEANIA_REGION_ID_STRING(OUTLYING_OCEANIA_REGION_ID); r = (Region *) uhash_get(newRegionIDMap.getAlias(),(void *)&OUTLYING_OCEANIA_REGION_ID_STRING); if ( r ) { r->type = URGN_SUBCONTINENT; } // Load territory containment info from the supplemental data. while ( ures_hasNext(territoryContainment.getAlias()) ) { LocalUResourceBundlePointer mapping(ures_getNextResource(territoryContainment.getAlias(),NULL,&status)); if( U_FAILURE(status) ) { return; // error out } const char *parent = ures_getKey(mapping.getAlias()); if (uprv_strcmp(parent, "containedGroupings") == 0 || uprv_strcmp(parent, "deprecated") == 0) { continue; // handle new pseudo-parent types added in ICU data per cldrbug 7808; for now just skip. // #11232 is to do something useful with these. } UnicodeString parentStr = UnicodeString(parent, -1 , US_INV); Region *parentRegion = (Region *) uhash_get(newRegionIDMap.getAlias(),(void *)&parentStr); for ( int j = 0 ; j < ures_getSize(mapping.getAlias()); j++ ) { UnicodeString child = ures_getUnicodeStringByIndex(mapping.getAlias(),j,&status); Region *childRegion = (Region *) uhash_get(newRegionIDMap.getAlias(),(void *)&child); if ( parentRegion != NULL && childRegion != NULL ) { // Add the child region to the set of regions contained by the parent if (parentRegion->containedRegions == NULL) { parentRegion->containedRegions = new UVector(uprv_deleteUObject, uhash_compareUnicodeString, status); } LocalPointer<UnicodeString> childStr(new UnicodeString(), status); if( U_FAILURE(status) ) { return; // error out } childStr->fastCopyFrom(childRegion->idStr); parentRegion->containedRegions->addElement((void *)childStr.orphan(),status); // Set the parent region to be the containing region of the child. // Regions of type GROUPING can't be set as the parent, since another region // such as a SUBCONTINENT, CONTINENT, or WORLD must always be the parent. if ( parentRegion->type != URGN_GROUPING) { childRegion->containingRegion = parentRegion; } } } } // Create the availableRegions lists int32_t pos = UHASH_FIRST; while ( const UHashElement* element = uhash_nextElement(newRegionIDMap.getAlias(),&pos)) { Region *ar = (Region *)element->value.pointer; if ( availableRegions[ar->type] == NULL ) { LocalPointer<UVector> newAr(new UVector(uprv_deleteUObject, uhash_compareUnicodeString, status), status); availableRegions[ar->type] = newAr.orphan(); } LocalPointer<UnicodeString> arString(new UnicodeString(ar->idStr), status); if( U_FAILURE(status) ) { return; // error out } availableRegions[ar->type]->addElement((void *)arString.orphan(),status); } ucln_i18n_registerCleanup(UCLN_I18N_REGION, region_cleanup); // copy hashtables numericCodeMap = newNumericCodeMap.orphan(); regionIDMap = newRegionIDMap.orphan(); regionAliases = newRegionAliases.orphan(); }