MCPcopy Create free account
hub / github.com/comaps/comaps / PutItemsToList

Function PutItemsToList

android/sdk/src/main/cpp/app/organicmaps/sdk/MapManager.cpp:247–271  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

245}
246
247static void PutItemsToList(
248 JNIEnv * env, jobject const list, storage::CountriesVec const & children, int category,
249 std::function<bool(storage::CountryId const & countryId, storage::NodeAttrs const & attrs)> const & predicate)
250{
251 auto const & ciBuilder = CountryItemBuilder::Instance(env);
252 auto const listAddMethod = jni::ListBuilder::Instance(env).m_add;
253
254 storage::NodeAttrs attrs;
255 for (storage::CountryId const & child : children)
256 {
257 GetStorage().GetNodeAttrs(child, attrs);
258
259 if (predicate && !predicate(child, attrs))
260 continue;
261
262 using SLR = jni::TScopedLocalRef;
263 SLR const item(env, ciBuilder.Create(env, SLR(env, jni::ToJavaString(env, child))));
264 env->SetIntField(item.get(), ciBuilder.m_Category, category);
265
266 UpdateItem(env, item.get(), attrs);
267
268 // Put to resulting list
269 env->CallBooleanMethod(list, listAddMethod, item.get());
270 }
271}
272
273// static void nativeListItems(@Nullable String root, double lat, double lon, boolean hasLocation, boolean myMapsMode,
274// List<CountryItem> result);

Calls 5

UpdateItemFunction · 0.85
GetNodeAttrsMethod · 0.80
getMethod · 0.65
ToJavaStringFunction · 0.50
CreateMethod · 0.45

Tested by

no test coverage detected