diff --git a/android/UnitTests/jni/mock.cpp b/android/UnitTests/jni/mock.cpp index 6004160caf..7f203bcdb1 100644 --- a/android/UnitTests/jni/mock.cpp +++ b/android/UnitTests/jni/mock.cpp @@ -10,14 +10,14 @@ #include "base/assert.hpp" #include "base/logging.hpp" -#include "std/string.hpp" +#include using namespace my; // @todo(vbykoianko) Probably it's worth thinking about output of the function to make the result of // the tests more readable. // @todo(vbykoianko) It's necessary display the test name in the android log. -static void AndroidLogMessage(LogLevel l, SrcPoint const & src, string const & s) +static void AndroidLogMessage(LogLevel l, SrcPoint const & src, std::string const & s) { android_LogPriority pr = ANDROID_LOG_SILENT; @@ -30,11 +30,11 @@ static void AndroidLogMessage(LogLevel l, SrcPoint const & src, string const & s case LCRITICAL: pr = ANDROID_LOG_FATAL; break; } - string const out = DebugPrint(src) + " " + s; + std::string const out = DebugPrint(src) + " " + s; __android_log_write(pr, " MapsMeTests ", out.c_str()); } -static void AndroidAssertMessage(SrcPoint const & src, string const & s) +static void AndroidAssertMessage(SrcPoint const & src, std::string const & s) { #if defined(MWM_LOG_TO_FILE) AndroidLogToFile(LERROR, src, s); @@ -96,7 +96,7 @@ namespace android_tests return false; } - static string GetApkPath(ANativeActivity * activity, JNIEnv * env) + static std::string GetApkPath(ANativeActivity * activity, JNIEnv * env) { ASSERT(activity, ()); ASSERT(env, ()); @@ -113,7 +113,7 @@ namespace android_tests return res; } - static string GetSdcardPath(ANativeActivity * activity, JNIEnv * env) + static std::string GetSdcardPath(ANativeActivity * activity, JNIEnv * env) { ASSERT(activity, ()); ASSERT(env, ()); @@ -139,7 +139,7 @@ namespace android_tests return res; } - static string GetPackageName(ANativeActivity * activity, JNIEnv * env) + static std::string GetPackageName(ANativeActivity * activity, JNIEnv * env) { ASSERT(activity, ()); ASSERT(env, ()); @@ -162,13 +162,13 @@ namespace android_tests void Initialize(ANativeActivity * activity, JNIEnv * env) { LOG(LINFO, ("Platform::Initialize()")); - string apkPath = android_tests::GetApkPath(activity, env); + std::string apkPath = android_tests::GetApkPath(activity, env); LOG(LINFO, ("Apk path FromJNI: ", apkPath.c_str())); - string sdcardPath = android_tests::GetSdcardPath(activity, env); + std::string sdcardPath = android_tests::GetSdcardPath(activity, env); LOG(LINFO, ("Sdcard path FromJNI: ", sdcardPath.c_str())); - string packageName = android_tests::GetPackageName(activity, env); + std::string packageName = android_tests::GetPackageName(activity, env); LOG(LINFO, ("Package name FromJNI: ", packageName.c_str())); m_writableDir = sdcardPath + "/MapsWithMe/"; @@ -180,12 +180,12 @@ namespace android_tests } /// get storage path without ending "/MapsWithMe/" - string GetStoragePathPrefix() const + std::string GetStoragePathPrefix() const { - return string("/sdcard"); + return std::string("/sdcard"); } /// assign storage path (should contain ending "/MapsWithMe/") - void SetStoragePath(string const & path) {} + void SetStoragePath(std::string const & path) {} bool HasAvailableSpaceForWriting(uint64_t size) const{ return true; } @@ -202,7 +202,7 @@ Platform & GetPlatform() return android_tests::Platform::Instance(); } -string GetAndroidSystemLanguage() +std::string GetAndroidSystemLanguage() { return "en_US"; } diff --git a/android/jni/com/mapswithme/core/jni_helper.cpp b/android/jni/com/mapswithme/core/jni_helper.cpp index d892537260..ec20c3b80a 100644 --- a/android/jni/com/mapswithme/core/jni_helper.cpp +++ b/android/jni/com/mapswithme/core/jni_helper.cpp @@ -5,7 +5,8 @@ #include "base/assert.hpp" #include "base/exception.hpp" #include "base/logging.hpp" -#include "std/vector.hpp" + +#include static JavaVM * g_jvm = 0; extern JavaVM * GetJVM() @@ -118,9 +119,9 @@ jclass GetGlobalClassRef(JNIEnv * env, char const * sig) return static_cast(env->NewGlobalRef(klass)); } -string ToNativeString(JNIEnv * env, jstring str) +std::string ToNativeString(JNIEnv * env, jstring str) { - string result; + std::string result; char const * utfBuffer = env->GetStringUTFChars(str, 0); if (utfBuffer) { @@ -130,12 +131,12 @@ string ToNativeString(JNIEnv * env, jstring str) return result; } -string ToNativeString(JNIEnv * env, jbyteArray const & bytes) +std::string ToNativeString(JNIEnv * env, jbyteArray const & bytes) { int const len = env->GetArrayLength(bytes); - vector buffer(len); + std::vector buffer(len); env->GetByteArrayRegion(bytes, 0, len, reinterpret_cast(buffer.data())); - return string(buffer.data(), len); + return std::string(buffer.data(), len); } jstring ToJavaString(JNIEnv * env, char const * s) @@ -143,10 +144,10 @@ jstring ToJavaString(JNIEnv * env, char const * s) return env->NewStringUTF(s); } -jobjectArray ToJavaStringArray(JNIEnv * env, vector const & src) +jobjectArray ToJavaStringArray(JNIEnv * env, std::vector const & src) { return ToJavaArray(env, GetStringClass(env), src, - [](JNIEnv * env, string const & item) + [](JNIEnv * env, std::string const & item) { return ToJavaString(env, item.c_str()); }); @@ -171,14 +172,14 @@ struct global_ref_deleter } }; -shared_ptr make_global_ref(jobject obj) +std::shared_ptr make_global_ref(jobject obj) { jobject * ref = new jobject; *ref = GetEnv()->NewGlobalRef(obj); - return shared_ptr(ref, global_ref_deleter()); + return std::shared_ptr(ref, global_ref_deleter()); } -string ToNativeString(JNIEnv * env, const jthrowable & e) +std::string ToNativeString(JNIEnv * env, const jthrowable & e) { jni::TScopedLocalClassRef logClassRef(env, env->FindClass("android/util/Log")); ASSERT(logClassRef.get(), ()); @@ -204,7 +205,7 @@ bool HandleJavaException(JNIEnv * env) return false; } -string DescribeException() +std::string DescribeException() { JNIEnv * env = GetEnv(); diff --git a/android/jni/com/mapswithme/core/jni_helper.hpp b/android/jni/com/mapswithme/core/jni_helper.hpp index 86f97fc7c4..35a5b334b1 100644 --- a/android/jni/com/mapswithme/core/jni_helper.hpp +++ b/android/jni/com/mapswithme/core/jni_helper.hpp @@ -6,8 +6,8 @@ #include "geometry/point2d.hpp" -#include "std/string.hpp" -#include "std/shared_ptr.hpp" +#include +#include extern jclass g_mapObjectClazz; extern jclass g_bookmarkClazz; @@ -32,12 +32,12 @@ jmethodID GetConstructorID(JNIEnv * env, jclass clazz, char const * signature); // Result value should be DeleteGlobalRef`ed by caller jclass GetGlobalClassRef(JNIEnv * env, char const * s); -string ToNativeString(JNIEnv * env, jstring str); +std::string ToNativeString(JNIEnv * env, jstring str); // Converts UTF-8 array to native UTF-8 string. Result differs from simple GetStringUTFChars call for characters greater than U+10000, // since jni uses modified UTF (MUTF-8) for strings. -string ToNativeString(JNIEnv * env, jbyteArray const & utfBytes); +std::string ToNativeString(JNIEnv * env, jbyteArray const & utfBytes); jstring ToJavaString(JNIEnv * env, char const * s); -inline jstring ToJavaString(JNIEnv * env, string const & s) +inline jstring ToJavaString(JNIEnv * env, std::string const & s) { return ToJavaString(env, s.c_str()); } @@ -45,10 +45,10 @@ inline jstring ToJavaString(JNIEnv * env, string const & s) jclass GetStringClass(JNIEnv * env); char const * GetStringClassName(); -string DescribeException(); +std::string DescribeException(); bool HandleJavaException(JNIEnv * env); -shared_ptr make_global_ref(jobject obj); +std::shared_ptr make_global_ref(jobject obj); using TScopedLocalRef = ScopedLocalRef; using TScopedLocalClassRef = ScopedLocalRef; using TScopedLocalObjectArrayRef = ScopedLocalRef; diff --git a/android/jni/com/mapswithme/core/logging.cpp b/android/jni/com/mapswithme/core/logging.cpp index 4eda5db1fc..7f0a670a42 100644 --- a/android/jni/com/mapswithme/core/logging.cpp +++ b/android/jni/com/mapswithme/core/logging.cpp @@ -20,7 +20,7 @@ namespace jni using namespace my; -void AndroidMessage(LogLevel level, SrcPoint const & src, string const & s) +void AndroidMessage(LogLevel level, SrcPoint const & src, std::string const & s) { android_LogPriority pr = ANDROID_LOG_SILENT; @@ -37,20 +37,20 @@ void AndroidMessage(LogLevel level, SrcPoint const & src, string const & s) static jmethodID const logCoreMsgMethod = jni::GetStaticMethodID(env.get(), g_loggerFactoryClazz, "logCoreMessage", "(ILjava/lang/String;)V"); - string const out = DebugPrint(src) + " " + s; + std::string const out = DebugPrint(src) + " " + s; jni::TScopedLocalRef msg(env.get(), jni::ToJavaString(env.get(), out)); env->CallStaticVoidMethod(g_loggerFactoryClazz, logCoreMsgMethod, pr, msg.get()); if (g_crashlytics) g_crashlytics->log(g_crashlytics, out.c_str()); } -void AndroidLogMessage(LogLevel level, SrcPoint const & src, string const & s) +void AndroidLogMessage(LogLevel level, SrcPoint const & src, std::string const & s) { AndroidMessage(level, src, s); CHECK_LESS(level, g_LogAbortLevel, ("Abort. Log level is too serious", level)); } -void AndroidAssertMessage(SrcPoint const & src, string const & s) +void AndroidAssertMessage(SrcPoint const & src, std::string const & s) { AndroidMessage(LCRITICAL, src, s); #ifdef DEBUG diff --git a/android/jni/com/mapswithme/core/render_context.hpp b/android/jni/com/mapswithme/core/render_context.hpp index e17b0d6e65..4d13bc9c1a 100644 --- a/android/jni/com/mapswithme/core/render_context.hpp +++ b/android/jni/com/mapswithme/core/render_context.hpp @@ -2,7 +2,7 @@ #include "graphics/opengl/gl_render_context.hpp" -#include "std/shared_ptr.hpp" +#include namespace android { diff --git a/android/jni/com/mapswithme/maps/DownloadResourcesActivity.cpp b/android/jni/com/mapswithme/maps/DownloadResourcesActivity.cpp index b5b0098e93..145a42ee4f 100644 --- a/android/jni/com/mapswithme/maps/DownloadResourcesActivity.cpp +++ b/android/jni/com/mapswithme/maps/DownloadResourcesActivity.cpp @@ -16,13 +16,13 @@ #include "com/mapswithme/core/jni_helper.hpp" -#include "std/vector.hpp" -#include "std/string.hpp" -#include "std/bind.hpp" -#include "std/shared_ptr.hpp" - +#include +#include +#include +#include using namespace downloader; +using namespace std::placeholders; /// Special error codes to notify GUI about free space //@{ @@ -37,19 +37,19 @@ using namespace downloader; struct FileToDownload { - vector m_urls; - string m_fileName; - string m_pathOnSdcard; + std::vector m_urls; + std::string m_fileName; + std::string m_pathOnSdcard; uint64_t m_fileSize; }; namespace { -static vector g_filesToDownload; +static std::vector g_filesToDownload; static int g_totalDownloadedBytes; static int g_totalBytesToDownload; -static shared_ptr g_currentRequest; +static std::shared_ptr g_currentRequest; } // namespace @@ -57,7 +57,7 @@ extern "C" { using TCallback = HttpRequest::CallbackT; - static int HasSpaceForFiles(Platform & pl, string const & sdcardPath, size_t fileSize) + static int HasSpaceForFiles(Platform & pl, std::string const & sdcardPath, size_t fileSize) { switch (pl.GetWritableStorageStatus(fileSize)) { @@ -73,7 +73,7 @@ extern "C" } // Check if we need to download mandatory resource file. - static bool NeedToDownload(Platform & pl, string const & name, int size) + static bool NeedToDownload(Platform & pl, std::string const & name, int size) { try { @@ -99,12 +99,12 @@ extern "C" g_totalDownloadedBytes = 0; Platform & pl = GetPlatform(); - string const path = pl.WritableDir(); + std::string const path = pl.WritableDir(); ReaderStreamBuf buffer(pl.GetReader(EXTERNAL_RESOURCES_FILE)); istream in(&buffer); - string name; + std::string name; int size; while (true) { @@ -141,7 +141,7 @@ extern "C" return res; } - static void DownloadFileFinished(shared_ptr obj, HttpRequest const & req) + static void DownloadFileFinished(std::shared_ptr obj, HttpRequest const & req) { HttpRequest::StatusT const status = req.Status(); ASSERT_NOT_EQUAL(status, HttpRequest::EInProgress, ()); @@ -169,7 +169,7 @@ extern "C" env->CallVoidMethod(*obj, methodID, errorCode); } - static void DownloadFileProgress(shared_ptr listener, HttpRequest const & req) + static void DownloadFileProgress(std::shared_ptr listener, HttpRequest const & req) { FileToDownload & curFile = g_filesToDownload.back(); @@ -206,11 +206,11 @@ extern "C" LOG(LDEBUG, ("downloading", curFile.m_fileName, "sized", curFile.m_fileSize, "bytes")); - TCallback onFinish(bind(&DownloadFileFinished, jni::make_global_ref(listener), _1)); - TCallback onProgress(bind(&DownloadFileProgress, jni::make_global_ref(listener), _1)); + TCallback onFinish(std::bind(&DownloadFileFinished, jni::make_global_ref(listener), _1)); + TCallback onProgress(std::bind(&DownloadFileProgress, jni::make_global_ref(listener), _1)); g_currentRequest.reset(HttpRequest::PostJson(GetPlatform().ResourcesMetaServerUrl(), curFile.m_fileName, - bind(&DownloadURLListFinished, _1, onFinish, onProgress))); + std::bind(&DownloadURLListFinished, _1, onFinish, onProgress))); return ERR_FILE_IN_PROGRESS; } diff --git a/android/jni/com/mapswithme/maps/Framework.cpp b/android/jni/com/mapswithme/maps/Framework.cpp index 4e9b082684..5d0d059f4a 100644 --- a/android/jni/com/mapswithme/maps/Framework.cpp +++ b/android/jni/com/mapswithme/maps/Framework.cpp @@ -37,6 +37,9 @@ #include "base/math.hpp" #include "base/sunrise_sunset.hpp" +using namespace std; +using namespace std::placeholders; + android::Framework * g_framework = 0; namespace platform diff --git a/android/jni/com/mapswithme/maps/Framework.hpp b/android/jni/com/mapswithme/maps/Framework.hpp index 3bd1ab33ac..d0d47b9488 100644 --- a/android/jni/com/mapswithme/maps/Framework.hpp +++ b/android/jni/com/mapswithme/maps/Framework.hpp @@ -21,11 +21,10 @@ #include "indexer/map_style.hpp" -#include "std/map.hpp" -#include "std/mutex.hpp" -#include "std/shared_ptr.hpp" -#include "std/unique_ptr.hpp" -#include "std/cstdint.hpp" +#include +#include +#include +#include namespace search { @@ -43,11 +42,11 @@ namespace android math::LowPassVector m_sensors[2]; double m_lastCompass; - string m_searchQuery; + std::string m_searchQuery; bool m_isContextDestroyed; - map m_guiPositions; + std::map m_guiPositions; void TrafficStateChanged(TrafficManager::TrafficState state); @@ -111,7 +110,7 @@ namespace android void Touch(int action, Finger const & f1, Finger const & f2, uint8_t maskedPointer); bool Search(search::EverywhereSearchParams const & params); - string GetLastSearchQuery() { return m_searchQuery; } + std::string GetLastSearchQuery() { return m_searchQuery; } void ClearLastSearchQuery() { m_searchQuery.clear(); } void AddLocalMaps(); @@ -119,7 +118,7 @@ namespace android m2::PointD GetViewportCenter() const; - void AddString(string const & name, string const & value); + void AddString(std::string const & name, std::string const & value); void Scale(::Framework::EScaleMode mode); void Scale(m2::PointD const & centerPt, int targetZoom, bool animate); @@ -131,11 +130,11 @@ namespace android bool IsDownloadingActive(); - bool ShowMapForURL(string const & url); + bool ShowMapForURL(std::string const & url); void DeactivatePopup(); - string GetOutdatedCountriesString(); + std::string GetOutdatedCountriesString(); void ShowTrack(int category, int track); @@ -162,10 +161,10 @@ namespace android void SetPlacePageInfo(place_page::Info const & info); place_page::Info & GetPlacePageInfo(); void RequestBookingMinPrice(JNIEnv * env, jobject policy, - string const & hotelId, string const & currency, + std::string const & hotelId, std::string const & currency, booking::GetMinPriceCallback const & callback); void RequestBookingInfo(JNIEnv * env, jobject policy, - string const & hotelId, string const & lang, + std::string const & hotelId, std::string const & lang, booking::GetHotelInfoCallback const & callback); bool HasSpaceForMigration(); @@ -180,7 +179,7 @@ namespace android uint64_t RequestUberProducts(JNIEnv * env, jobject policy, ms::LatLon const & from, ms::LatLon const & to, uber::ProductsCallback const & callback, uber::ErrorCallback const & errorCallback); - static uber::RideRequestLinks GetUberLinks(string const & productId, ms::LatLon const & from, ms::LatLon const & to); + static uber::RideRequestLinks GetUberLinks(std::string const & productId, ms::LatLon const & from, ms::LatLon const & to); int ToDoAfterUpdate() const; }; diff --git a/android/jni/com/mapswithme/maps/LocationState.cpp b/android/jni/com/mapswithme/maps/LocationState.cpp index f3f16d8492..5556915a35 100644 --- a/android/jni/com/mapswithme/maps/LocationState.cpp +++ b/android/jni/com/mapswithme/maps/LocationState.cpp @@ -7,7 +7,7 @@ extern "C" { -static void LocationStateModeChanged(location::EMyPositionMode mode, shared_ptr const & listener) +static void LocationStateModeChanged(location::EMyPositionMode mode, std::shared_ptr const & listener) { g_framework->OnMyPositionModeChanged(mode); @@ -33,7 +33,8 @@ Java_com_mapswithme_maps_location_LocationState_nativeGetMode(JNIEnv * env, jcla JNIEXPORT void JNICALL Java_com_mapswithme_maps_location_LocationState_nativeSetListener(JNIEnv * env, jclass clazz, jobject listener) { - g_framework->SetMyPositionModeListener(bind(&LocationStateModeChanged, _1, jni::make_global_ref(listener))); + g_framework->SetMyPositionModeListener(std::bind(&LocationStateModeChanged, std::placeholders::_1, + jni::make_global_ref(listener))); } // public static void nativeRemoveListener(); diff --git a/android/jni/com/mapswithme/maps/MapManager.cpp b/android/jni/com/mapswithme/maps/MapManager.cpp index f5f3b17bfe..2d2dc59b22 100644 --- a/android/jni/com/mapswithme/maps/MapManager.cpp +++ b/android/jni/com/mapswithme/maps/MapManager.cpp @@ -12,9 +12,11 @@ #include "platform/local_country_file_utils.hpp" #include "platform/mwm_version.hpp" -#include "std/bind.hpp" -#include "std/shared_ptr.hpp" -#include "std/unordered_map.hpp" +#include +#include +#include + +using namespace std::placeholders; namespace { @@ -204,8 +206,8 @@ Java_com_mapswithme_maps_downloader_MapManager_nativeMigrate(JNIEnv * env, jclas g_migrationListener = env->NewGlobalRef(listener); - TCountryId id = g_framework->PreMigrate(position, bind(&MigrationStatusChangedCallback, _1, keepOldMaps), - bind(&MigrationProgressCallback, _1, _2)); + TCountryId id = g_framework->PreMigrate(position, std::bind(&MigrationStatusChangedCallback, _1, keepOldMaps), + std::bind(&MigrationProgressCallback, _1, _2)); if (id != kInvalidCountryId) { NodeAttrs attrs; @@ -533,7 +535,7 @@ Java_com_mapswithme_maps_downloader_MapManager_nativeDelete(JNIEnv * env, jclass EndBatchingCallbacks(env); } -static void StatusChangedCallback(shared_ptr const & listenerRef, TCountryId const & countryId) +static void StatusChangedCallback(std::shared_ptr const & listenerRef, TCountryId const & countryId) { NodeStatuses ns; GetStorage().GetNodeStatuses(countryId, ns); @@ -545,7 +547,7 @@ static void StatusChangedCallback(shared_ptr const & listenerRef, TCoun EndBatchingCallbacks(jni::GetEnv()); } -static void ProgressChangedCallback(shared_ptr const & listenerRef, TCountryId const & countryId, TLocalAndRemoteSize const & sizes) +static void ProgressChangedCallback(std::shared_ptr const & listenerRef, TCountryId const & countryId, TLocalAndRemoteSize const & sizes) { JNIEnv * env = jni::GetEnv(); @@ -558,8 +560,8 @@ JNIEXPORT jint JNICALL Java_com_mapswithme_maps_downloader_MapManager_nativeSubscribe(JNIEnv * env, jclass clazz, jobject listener) { PrepareClassRefs(env); - return GetStorage().Subscribe(bind(&StatusChangedCallback, jni::make_global_ref(listener), _1), - bind(&ProgressChangedCallback, jni::make_global_ref(listener), _1, _2)); + return GetStorage().Subscribe(std::bind(&StatusChangedCallback, jni::make_global_ref(listener), _1), + std::bind(&ProgressChangedCallback, jni::make_global_ref(listener), _1, _2)); } // static void nativeUnsubscribe(int slot); diff --git a/android/jni/com/mapswithme/maps/SearchEngine.cpp b/android/jni/com/mapswithme/maps/SearchEngine.cpp index 67e55c2224..f8eaaa677c 100644 --- a/android/jni/com/mapswithme/maps/SearchEngine.cpp +++ b/android/jni/com/mapswithme/maps/SearchEngine.cpp @@ -18,6 +18,7 @@ #include using namespace std; +using namespace std::placeholders; using search::Result; using search::Results; @@ -243,7 +244,7 @@ jobject ToJavaResult(Result & result, bool isLocalAdsCustomer, bool hasPosition, env->ReleaseIntArrayElements(ranges.get(), rawArr, 0); ms::LatLon ll = ms::LatLon::Zero(); - string distance; + std::string distance; if (result.HasPoint()) { ll = MercatorBounds::ToLatLon(result.GetFeatureCenter()); diff --git a/android/jni/com/mapswithme/maps/Sponsored.cpp b/android/jni/com/mapswithme/maps/Sponsored.cpp index b0720d0f87..7efb4a9b5a 100644 --- a/android/jni/com/mapswithme/maps/Sponsored.cpp +++ b/android/jni/com/mapswithme/maps/Sponsored.cpp @@ -5,8 +5,8 @@ #include "map/place_page_info.hpp" #include "partners_api/booking_api.hpp" -#include "std/bind.hpp" -#include "std/chrono.hpp" +#include +#include namespace { @@ -26,7 +26,7 @@ jmethodID g_hotelInfoConstructor; jmethodID g_sponsoredClassConstructor; jmethodID g_priceCallback; jmethodID g_infoCallback; -string g_lastRequestedHotelId; +std::string g_lastRequestedHotelId; void PrepareClassRefs(JNIEnv * env, jclass sponsoredClass) { @@ -98,7 +98,7 @@ jobjectArray ToReviewsArray(JNIEnv * env, vector const & reviews) [](JNIEnv * env, HotelReview const & item) { return env->NewObject( g_reviewClass, g_reviewConstructor, - time_point_cast(item.m_date).time_since_epoch().count(), + std::chrono::time_point_cast(item.m_date).time_since_epoch().count(), item.m_score, jni::ToJavaString(env, item.m_author), jni::ToJavaString(env, item.m_pros), jni::ToJavaString(env, item.m_cons)); }); @@ -132,13 +132,13 @@ JNIEXPORT void JNICALL Java_com_mapswithme_maps_widget_placepage_Sponsored_nativ { PrepareClassRefs(env, clazz); - string const hotelId = jni::ToNativeString(env, id); + std::string const hotelId = jni::ToNativeString(env, id); g_lastRequestedHotelId = hotelId; - string const code = jni::ToNativeString(env, currencyCode); + std::string const code = jni::ToNativeString(env, currencyCode); g_framework->RequestBookingMinPrice(env, policy, hotelId, code, - [](string const & hotelId, string const & price, string const & currency) { + [](std::string const & hotelId, std::string const & price, std::string const & currency) { GetPlatform().RunOnGuiThread([hotelId, price, currency]() { if (g_lastRequestedHotelId != hotelId) return; @@ -156,10 +156,10 @@ JNIEXPORT void JNICALL Java_com_mapswithme_maps_widget_placepage_Sponsored_nativ { PrepareClassRefs(env, clazz); - string const hotelId = jni::ToNativeString(env, id); + std::string const hotelId = jni::ToNativeString(env, id); g_lastRequestedHotelId = hotelId; - string code = jni::ToNativeString(env, locale); + std::string code = jni::ToNativeString(env, locale); if (code.size() > 2) // 2 - number of characters in country code code.resize(2); diff --git a/android/jni/com/mapswithme/maps/TrackRecorder.cpp b/android/jni/com/mapswithme/maps/TrackRecorder.cpp index 31303f000f..be39741948 100644 --- a/android/jni/com/mapswithme/maps/TrackRecorder.cpp +++ b/android/jni/com/mapswithme/maps/TrackRecorder.cpp @@ -2,7 +2,7 @@ #include "map/gps_tracker.hpp" -#include "std/chrono.hpp" +#include namespace { @@ -38,7 +38,7 @@ extern "C" JNIEXPORT void JNICALL Java_com_mapswithme_maps_location_TrackRecorder_nativeSetDuration(JNIEnv * env, jclass clazz, jint durationHours) { - GpsTracker::Instance().SetDuration(hours(durationHours)); + GpsTracker::Instance().SetDuration(std::chrono::hours(durationHours)); } JNIEXPORT jint JNICALL diff --git a/android/jni/com/mapswithme/maps/TrafficState.cpp b/android/jni/com/mapswithme/maps/TrafficState.cpp index d0e2094b32..fe421012bb 100644 --- a/android/jni/com/mapswithme/maps/TrafficState.cpp +++ b/android/jni/com/mapswithme/maps/TrafficState.cpp @@ -6,7 +6,7 @@ extern "C" { -static void TrafficStateChanged(TrafficManager::TrafficState state, shared_ptr const & listener) +static void TrafficStateChanged(TrafficManager::TrafficState state, std::shared_ptr const & listener) { JNIEnv * env = jni::GetEnv(); env->CallVoidMethod(*listener, jni::GetMethodID(env, *listener, "onTrafficStateChanged", "(I)V"), static_cast(state)); @@ -16,7 +16,7 @@ JNIEXPORT void JNICALL Java_com_mapswithme_maps_traffic_TrafficState_nativeSetListener(JNIEnv * env, jclass clazz, jobject listener) { CHECK(g_framework, ("Framework isn't created yet!")); - g_framework->SetTrafficStateListener(bind(&TrafficStateChanged, _1, jni::make_global_ref(listener))); + g_framework->SetTrafficStateListener(std::bind(&TrafficStateChanged, std::placeholders::_1, jni::make_global_ref(listener))); } JNIEXPORT void JNICALL diff --git a/android/jni/com/mapswithme/maps/UserMarkHelper.cpp b/android/jni/com/mapswithme/maps/UserMarkHelper.cpp index d5641f8c72..4a7e6b3c6c 100644 --- a/android/jni/com/mapswithme/maps/UserMarkHelper.cpp +++ b/android/jni/com/mapswithme/maps/UserMarkHelper.cpp @@ -27,7 +27,7 @@ void InjectMetadata(JNIEnv * env, jclass const clazz, jobject const mapObject, f } } -jobject CreateBanner(JNIEnv * env, string const & id, jint type) +jobject CreateBanner(JNIEnv * env, std::string const & id, jint type) { static jmethodID const bannerCtorId = jni::GetConstructorID(env, g_bannerClazz, "(Ljava/lang/String;I)V"); @@ -35,11 +35,11 @@ jobject CreateBanner(JNIEnv * env, string const & id, jint type) return env->NewObject(g_bannerClazz, bannerCtorId, jni::ToJavaString(env, id), type); } -jobject CreateMapObject(JNIEnv * env, int mapObjectType, string const & title, - string const & secondaryTitle, string const & subtitle, double lat, - double lon, string const & address, Metadata const & metadata, - string const & apiId, jobjectArray jbanners, bool isReachableByTaxi, - string const & bookingSearchUrl, jobject const & localAdInfo) +jobject CreateMapObject(JNIEnv * env, int mapObjectType, std::string const & title, + std::string const & secondaryTitle, std::string const & subtitle, double lat, + double lon, std::string const & address, Metadata const & metadata, + std::string const & apiId, jobjectArray jbanners, bool isReachableByTaxi, + std::string const & bookingSearchUrl, jobject const & localAdInfo) { // public MapObject(@MapObjectType int mapObjectType, String title, String secondaryTitle, // String subtitle, double lat, double lon, String address, String apiId, diff --git a/android/jni/com/mapswithme/maps/UserMarkHelper.hpp b/android/jni/com/mapswithme/maps/UserMarkHelper.hpp index 9635027023..02633c3ef4 100644 --- a/android/jni/com/mapswithme/maps/UserMarkHelper.hpp +++ b/android/jni/com/mapswithme/maps/UserMarkHelper.hpp @@ -28,7 +28,7 @@ static constexpr int kSearch = 4; // Fills mapobject's metadata. void InjectMetadata(JNIEnv * env, jclass clazz, jobject const mapObject, feature::Metadata const & metadata); -jobject CreateMapObject(JNIEnv * env, int mapObjectType, string const & title, string const & subtitle, +jobject CreateMapObject(JNIEnv * env, int mapObjectType, std::string const & title, std::string const & subtitle, double lat, double lon, feature::Metadata const & metadata); jobject CreateMapObject(JNIEnv * env, place_page::Info const & info); diff --git a/android/jni/com/mapswithme/maps/bookmarks/data/BookmarkCategory.cpp b/android/jni/com/mapswithme/maps/bookmarks/data/BookmarkCategory.cpp index 4f0e3cd591..ac7811ac4f 100644 --- a/android/jni/com/mapswithme/maps/bookmarks/data/BookmarkCategory.cpp +++ b/android/jni/com/mapswithme/maps/bookmarks/data/BookmarkCategory.cpp @@ -106,7 +106,7 @@ Java_com_mapswithme_maps_bookmarks_data_BookmarkCategory_nativeGetTrack( ASSERT(nTrack, ("Track must not be null with index:)", bmkId)); - string formattedLength; + std::string formattedLength; measurement_utils::FormatDistance(nTrack->GetLengthMeters(), formattedLength); dp::Color nColor = nTrack->GetColor(0); diff --git a/android/jni/com/mapswithme/maps/bookmarks/data/BookmarkManager.cpp b/android/jni/com/mapswithme/maps/bookmarks/data/BookmarkManager.cpp index ca8b434005..63c47815a3 100644 --- a/android/jni/com/mapswithme/maps/bookmarks/data/BookmarkManager.cpp +++ b/android/jni/com/mapswithme/maps/bookmarks/data/BookmarkManager.cpp @@ -91,7 +91,7 @@ Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeSaveToKmzFile( BookmarkCategory * pCat = frm()->GetBmCategory(catID); if (pCat) { - string const name = pCat->GetName(); + std::string const name = pCat->GetName(); if (CreateZipFromPathDeflatedAndDefaultCompression(pCat->GetFileName(), ToNativeString(env, tmpPath) + name + ".kmz")) return ToJavaString(env, name); } @@ -123,8 +123,8 @@ Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_getLastEditedCategory( JNIEXPORT jstring JNICALL Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeGenerateUniqueFileName(JNIEnv * env, jclass thiz, jstring jBaseName) { - string baseName = ToNativeString(env, jBaseName); - string bookmarkFileName = BookmarkCategory::GenerateUniqueFileName(GetPlatform().SettingsDir(), baseName); + std::string baseName = ToNativeString(env, jBaseName); + std::string bookmarkFileName = BookmarkCategory::GenerateUniqueFileName(GetPlatform().SettingsDir(), baseName); return ToJavaString(env, bookmarkFileName); } diff --git a/android/jni/com/mapswithme/maps/editor/Editor.cpp b/android/jni/com/mapswithme/maps/editor/Editor.cpp index 41782818bd..872a0a2992 100644 --- a/android/jni/com/mapswithme/maps/editor/Editor.cpp +++ b/android/jni/com/mapswithme/maps/editor/Editor.cpp @@ -13,14 +13,15 @@ #include "indexer/editable_map_object.hpp" #include "indexer/osm_editor.hpp" -#include "std/algorithm.hpp" -#include "std/set.hpp" #include "std/target_os.hpp" -#include "std/vector.hpp" + +#include +#include +#include namespace { -using TCuisine = pair; +using TCuisine = pair; osm::EditableMapObject g_editableMapObject; jclass g_featureCategoryClazz; @@ -458,7 +459,7 @@ Java_com_mapswithme_maps_editor_Editor_nativeRollbackMapObject(JNIEnv * env, jcl JNIEXPORT jobjectArray JNICALL Java_com_mapswithme_maps_editor_Editor_nativeGetAllFeatureCategories(JNIEnv * env, jclass clazz, jstring jLang) { - string const & lang = jni::ToNativeString(env, jLang); + std::string const & lang = jni::ToNativeString(env, jLang); GetFeatureCategories().AddLanguage(lang); return jni::ToJavaArray(env, g_featureCategoryClazz, GetFeatureCategories().GetAllCategoryNames(lang), @@ -468,7 +469,7 @@ Java_com_mapswithme_maps_editor_Editor_nativeGetAllFeatureCategories(JNIEnv * en JNIEXPORT jobjectArray JNICALL Java_com_mapswithme_maps_editor_Editor_nativeSearchFeatureCategories(JNIEnv * env, jclass clazz, jstring query, jstring jLang) { - string const & lang = jni::ToNativeString(env, jLang); + std::string const & lang = jni::ToNativeString(env, jLang); GetFeatureCategories().AddLanguage(lang); return jni::ToJavaArray(env, g_featureCategoryClazz, GetFeatureCategories().Search(jni::ToNativeString(env, query), lang), @@ -479,7 +480,7 @@ JNIEXPORT jobjectArray JNICALL Java_com_mapswithme_maps_editor_Editor_nativeGetCuisines(JNIEnv * env, jclass clazz) { osm::TAllCuisines const & cuisines = osm::Cuisines::Instance().AllSupportedCuisines(); - vector keys; + std::vector keys; keys.reserve(cuisines.size()); for (TCuisine const & cuisine : cuisines) keys.push_back(cuisine.first); @@ -496,11 +497,11 @@ JNIEXPORT jobjectArray JNICALL Java_com_mapswithme_maps_editor_Editor_nativeTranslateCuisines(JNIEnv * env, jclass clazz, jobjectArray jKeys) { int const length = env->GetArrayLength(jKeys); - vector translations; + std::vector translations; translations.reserve(length); for (int i = 0; i < length; i++) { - string const & key = jni::ToNativeString(env, (jstring) env->GetObjectArrayElement(jKeys, i)); + std::string const & key = jni::ToNativeString(env, (jstring) env->GetObjectArrayElement(jKeys, i)); translations.push_back(osm::Cuisines::Instance().Translate(key)); } return jni::ToJavaStringArray(env, translations); @@ -510,7 +511,7 @@ JNIEXPORT void JNICALL Java_com_mapswithme_maps_editor_Editor_nativeSetSelectedCuisines(JNIEnv * env, jclass clazz, jobjectArray jKeys) { int const length = env->GetArrayLength(jKeys); - vector cuisines; + std::vector cuisines; cuisines.reserve(length); for (int i = 0; i < length; i++) cuisines.push_back(jni::ToNativeString(env, (jstring) env->GetObjectArrayElement(jKeys, i))); diff --git a/android/jni/com/mapswithme/maps/editor/OpeningHours.cpp b/android/jni/com/mapswithme/maps/editor/OpeningHours.cpp index 475ede0ff0..55faa9f909 100644 --- a/android/jni/com/mapswithme/maps/editor/OpeningHours.cpp +++ b/android/jni/com/mapswithme/maps/editor/OpeningHours.cpp @@ -7,9 +7,9 @@ #include "base/logging.hpp" -#include "std/algorithm.hpp" -#include "std/set.hpp" -#include "std/vector.hpp" +#include +#include +#include #include "3party/opening_hours/opening_hours.hpp" @@ -72,10 +72,10 @@ jobject JavaTimetable(JNIEnv * env, jobject workingHours, jobject closedHours, b jobject JavaTimetable(JNIEnv * env, TimeTable const & tt) { auto const excludeSpans = tt.GetExcludeTime(); - set weekdays = tt.GetOpeningDays(); - vector weekdaysVector; + std::set weekdays = tt.GetOpeningDays(); + std::vector weekdaysVector; weekdaysVector.reserve(weekdays.size()); - transform(weekdays.begin(), weekdays.end(), back_inserter(weekdaysVector), [](Weekday weekday) + std::transform(weekdays.begin(), weekdays.end(), std::back_inserter(weekdaysVector), [](Weekday weekday) { return static_cast(weekday); }); @@ -283,7 +283,7 @@ JNIEXPORT jobjectArray JNICALL Java_com_mapswithme_maps_editor_OpeningHours_nativeTimetablesFromString(JNIEnv * env, jclass clazz, jstring jSource) { TimeTableSet tts; - string const source = jni::ToNativeString(env, jSource); + std::string const source = jni::ToNativeString(env, jSource); if (!source.empty() && MakeTimeTableSet(OpeningHours(source), tts)) return JavaTimetables(env, tts); @@ -294,7 +294,7 @@ JNIEXPORT jstring JNICALL Java_com_mapswithme_maps_editor_OpeningHours_nativeTimetablesToString(JNIEnv * env, jclass clazz, jobjectArray jTts) { TimeTableSet tts = NativeTimetableSet(env, jTts); - stringstream sstr; + std::stringstream sstr; sstr << MakeOpeningHours(tts).GetRule(); return jni::ToJavaString(env, sstr.str()); } diff --git a/android/jni/com/mapswithme/maps/editor/OsmOAuth.cpp b/android/jni/com/mapswithme/maps/editor/OsmOAuth.cpp index 74606f4d47..452a624bb1 100644 --- a/android/jni/com/mapswithme/maps/editor/OsmOAuth.cpp +++ b/android/jni/com/mapswithme/maps/editor/OsmOAuth.cpp @@ -129,7 +129,7 @@ Java_com_mapswithme_maps_editor_OsmOAuth_nativeUpdateOsmUserStats(JNIEnv * env, // static void onUserStatsUpdated(UserStats stats) static jmethodID const listenerId = jni::GetStaticMethodID(env, osmAuthClazz, "onUserStatsUpdated", "(Lcom/mapswithme/maps/editor/data/UserStats;)V"); - string const username = jni::ToNativeString(env, jUsername); + std::string const username = jni::ToNativeString(env, jUsername); auto const policy = forceUpdate ? editor::UserStatsLoader::UpdatePolicy::Force : editor::UserStatsLoader::UpdatePolicy::Lazy; g_framework->NativeFramework()->UpdateUserStats(username, policy, [username]() @@ -138,7 +138,7 @@ Java_com_mapswithme_maps_editor_OsmOAuth_nativeUpdateOsmUserStats(JNIEnv * env, if (!userStats.IsValid()) return; int32_t count, rank; - string levelUp; + std::string levelUp; userStats.GetChangesCount(count); userStats.GetRank(rank); userStats.GetLevelUpRequiredFeat(levelUp); diff --git a/android/jni/com/mapswithme/opengl/androidoglcontextfactory.cpp b/android/jni/com/mapswithme/opengl/androidoglcontextfactory.cpp index dd308db66d..95e6c9159d 100644 --- a/android/jni/com/mapswithme/opengl/androidoglcontextfactory.cpp +++ b/android/jni/com/mapswithme/opengl/androidoglcontextfactory.cpp @@ -4,7 +4,7 @@ #include "base/assert.hpp" #include "base/logging.hpp" -#include "std/algorithm.hpp" +#include #include #include @@ -239,9 +239,9 @@ bool AndroidOGLContextFactory::createWindowSurface() { LOG(LDEBUG, ("Backbuffer format: RGB8")); } - ASSERT(count > 0, ("Didn't find any configs.")); + ASSERT(count > 0, ("Didn't std::find any configs.")); - sort(&configs[0], &configs[count], ConfigComparator(m_display)); + std::sort(&configs[0], &configs[count], ConfigComparator(m_display)); for (int i = 0; i < count; ++i) { EGLConfig currentConfig = configs[i]; diff --git a/android/jni/com/mapswithme/platform/HttpThread.cpp b/android/jni/com/mapswithme/platform/HttpThread.cpp index b21034b28e..5abe243057 100644 --- a/android/jni/com/mapswithme/platform/HttpThread.cpp +++ b/android/jni/com/mapswithme/platform/HttpThread.cpp @@ -10,12 +10,12 @@ private: jobject m_self; public: - HttpThread(string const & url, + HttpThread(std::string const & url, downloader::IHttpThreadCallback & cb, int64_t beg, int64_t end, int64_t expectedFileSize, - string const & pb) + std::string const & pb) { JNIEnv * env = jni::GetEnv(); @@ -26,7 +26,7 @@ public: static jmethodID const startMethodId = env->GetMethodID(klass, "start", "()V"); // User id is always the same, so do not waste time on every chunk call - static string const uniqueUserId = GetPlatform().UniqueClientId(); + static std::string const uniqueUserId = GetPlatform().UniqueClientId(); jni::TScopedLocalByteArrayRef postBody(env, nullptr); size_t const postBodySize = pb.size(); @@ -64,12 +64,12 @@ public: namespace downloader { - HttpThread * CreateNativeHttpThread(string const & url, + HttpThread * CreateNativeHttpThread(std::string const & url, downloader::IHttpThreadCallback & cb, int64_t beg, int64_t end, int64_t size, - string const & pb) + std::string const & pb) { return new HttpThread(url, cb, beg, end, size, pb); } diff --git a/android/jni/com/mapswithme/platform/Language.cpp b/android/jni/com/mapswithme/platform/Language.cpp index 7c64984cf1..1c0550062e 100644 --- a/android/jni/com/mapswithme/platform/Language.cpp +++ b/android/jni/com/mapswithme/platform/Language.cpp @@ -6,9 +6,9 @@ #include "base/logging.hpp" #include "base/string_utils.hpp" -#include "std/string.hpp" +#include -string ReplaceDeprecatedLanguageCode(string const & lang) +std::string ReplaceDeprecatedLanguageCode(std::string const & lang) { // in* -> id // iw* -> he @@ -22,7 +22,7 @@ string ReplaceDeprecatedLanguageCode(string const & lang) } /// This function is called from native c++ code -string GetAndroidSystemLanguage() +std::string GetAndroidSystemLanguage() { static char const * DEFAULT_LANG = "en"; @@ -40,7 +40,7 @@ string GetAndroidSystemLanguage() jni::TScopedLocalRef localeInstance(env, env->CallStaticObjectMethod(localeClass, localeGetDefaultId)); jni::TScopedLocalRef langString(env, env->CallObjectMethod(localeInstance.get(), localeToStringId)); - string res = jni::ToNativeString(env, (jstring) langString.get()); + std::string res = jni::ToNativeString(env, (jstring) langString.get()); if (res.empty()) res = DEFAULT_LANG; diff --git a/android/jni/com/mapswithme/platform/Language.hpp b/android/jni/com/mapswithme/platform/Language.hpp index 295e524078..0ab49bc313 100644 --- a/android/jni/com/mapswithme/platform/Language.hpp +++ b/android/jni/com/mapswithme/platform/Language.hpp @@ -2,7 +2,7 @@ #include "../core/jni_helper.hpp" -#include "std/string.hpp" +#include /// More details about deprecated language codes http://developer.android.com/reference/java/util/Locale.html -string ReplaceDeprecatedLanguageCode(string const & language); +std::string ReplaceDeprecatedLanguageCode(std::string const & language); diff --git a/android/jni/com/mapswithme/platform/MarketingService.cpp b/android/jni/com/mapswithme/platform/MarketingService.cpp index 9d36b3c4bb..439bdf80fb 100644 --- a/android/jni/com/mapswithme/platform/MarketingService.cpp +++ b/android/jni/com/mapswithme/platform/MarketingService.cpp @@ -2,6 +2,8 @@ #include "Platform.hpp" +using namespace std; + void MarketingService::SendPushWooshTag(string const & tag) { SendPushWooshTag(tag, vector{"1"}); diff --git a/android/jni/com/mapswithme/platform/Platform.cpp b/android/jni/com/mapswithme/platform/Platform.cpp index 6a958e47fb..b1f1ebdc1e 100644 --- a/android/jni/com/mapswithme/platform/Platform.cpp +++ b/android/jni/com/mapswithme/platform/Platform.cpp @@ -7,24 +7,24 @@ #include "base/logging.hpp" #include "base/stl_add.hpp" -#include "std/algorithm.hpp" +#include -string Platform::UniqueClientId() const +std::string Platform::UniqueClientId() const { JNIEnv * env = jni::GetEnv(); static jmethodID const getInstallationId = jni::GetStaticMethodID(env, g_utilsClazz, "getInstallationId", "()Ljava/lang/String;"); static jstring const installationId = (jstring)env->CallStaticObjectMethod(g_utilsClazz, getInstallationId); - static string const result = jni::ToNativeString(env, installationId); + static std::string const result = jni::ToNativeString(env, installationId); return result; } -string Platform::GetMemoryInfo() const +std::string Platform::GetMemoryInfo() const { JNIEnv * env = jni::GetEnv(); if (env == nullptr) - return string(); + return std::string(); static shared_ptr classMemLogging = jni::make_global_ref(env->FindClass("com/mapswithme/util/log/MemLogging")); ASSERT(classMemLogging, ()); @@ -69,8 +69,8 @@ namespace android m_sendPushWooshTagsMethod = env->GetMethodID(functorProcessClass, "sendPushWooshTags", "(Ljava/lang/String;[Ljava/lang/String;)V"); m_myTrackerTrackMethod = env->GetStaticMethodID(g_myTrackerClazz, "trackEvent", "(Ljava/lang/String;)V"); - string const flavor = jni::ToNativeString(env, flavorName); - string const build = jni::ToNativeString(env, buildType); + std::string const flavor = jni::ToNativeString(env, flavorName); + std::string const build = jni::ToNativeString(env, buildType); LOG(LINFO, ("Flavor name:", flavor)); LOG(LINFO, ("Build type name:", build)); @@ -88,7 +88,7 @@ namespace android m_tmpDir = jni::ToNativeString(env, tmpPath); m_writableDir = jni::ToNativeString(env, storagePath); - string const obbPath = jni::ToNativeString(env, obbGooglePath); + std::string const obbPath = jni::ToNativeString(env, obbGooglePath); Platform::FilesList files; GetFilesByExt(obbPath, ".obb", files); m_extResFiles.clear(); @@ -116,7 +116,7 @@ namespace android { } - string Platform::GetStoragePathPrefix() const + std::string Platform::GetStoragePathPrefix() const { size_t const count = m_writableDir.size(); ASSERT_GREATER ( count, 2, () ); @@ -127,14 +127,14 @@ namespace android return m_writableDir.substr(0, i); } - void Platform::SetWritableDir(string const & dir) + void Platform::SetWritableDir(std::string const & dir) { m_writableDir = dir; settings::Set("StoragePath", m_writableDir); LOG(LINFO, ("Writable path = ", m_writableDir)); } - void Platform::SetSettingsDir(string const & dir) + void Platform::SetSettingsDir(std::string const & dir) { m_settingsDir = dir; LOG(LINFO, ("Settings path = ", m_settingsDir)); @@ -158,7 +158,7 @@ namespace android jni::GetEnv()->CallVoidMethod(m_functorProcessObject, m_functorProcessMethod, reinterpret_cast(functor)); } - void Platform::SendPushWooshTag(string const & tag, vector const & values) + void Platform::SendPushWooshTag(std::string const & tag, std::vector const & values) { if (values.empty()) return; @@ -169,10 +169,10 @@ namespace android jni::TScopedLocalObjectArrayRef(env, jni::ToJavaStringArray(env, values)).get()); } - void Platform::SendMarketingEvent(string const & tag, map const & params) + void Platform::SendMarketingEvent(std::string const & tag, std::map const & params) { JNIEnv * env = jni::GetEnv(); - string eventData = tag; + std::string eventData = tag; for (auto const & item : params) eventData.append("_" + item.first + "_" + item.second); diff --git a/android/jni/com/mapswithme/platform/Platform.hpp b/android/jni/com/mapswithme/platform/Platform.hpp index 4ffb7540c7..9f8a2169c5 100644 --- a/android/jni/com/mapswithme/platform/Platform.hpp +++ b/android/jni/com/mapswithme/platform/Platform.hpp @@ -21,16 +21,16 @@ namespace android void OnExternalStorageStatusChanged(bool isAvailable); /// get storage path without ending "/MapsWithMe/" - string GetStoragePathPrefix() const; + std::string GetStoragePathPrefix() const; /// assign storage path (should contain ending "/MapsWithMe/") - void SetWritableDir(string const & dir); - void SetSettingsDir(string const & dir); + void SetWritableDir(std::string const & dir); + void SetSettingsDir(std::string const & dir); bool HasAvailableSpaceForWriting(uint64_t size) const; void RunOnGuiThread(TFunctor const & fn); - void SendPushWooshTag(string const & tag, vector const & values); - void SendMarketingEvent(string const & tag, map const & params); + void SendPushWooshTag(std::string const & tag, vector const & values); + void SendMarketingEvent(std::string const & tag, map const & params); static Platform & Instance(); diff --git a/android/jni/com/mapswithme/platform/SocketImpl.cpp b/android/jni/com/mapswithme/platform/SocketImpl.cpp index 632449a126..9c81a0f95d 100644 --- a/android/jni/com/mapswithme/platform/SocketImpl.cpp +++ b/android/jni/com/mapswithme/platform/SocketImpl.cpp @@ -1,6 +1,9 @@ #include "../core/jni_helper.hpp" + #include "platform/socket.hpp" + #include "base/logging.hpp" +#include "base/stl_add.hpp" namespace platform { @@ -23,7 +26,7 @@ public: env->DeleteGlobalRef(m_self); } - bool Open(string const & host, uint16_t port) + bool Open(std::string const & host, uint16_t port) { JNIEnv * env = jni::GetEnv(); static jmethodID const openMethod = @@ -83,5 +86,5 @@ private: jobject m_self; }; -unique_ptr CreateSocket() { return make_unique(); } +std::unique_ptr CreateSocket() { return my::make_unique(); } } diff --git a/android/jni/com/mapswithme/util/Config.cpp b/android/jni/com/mapswithme/util/Config.cpp index 3c40e73cd0..3fe9a07660 100644 --- a/android/jni/com/mapswithme/util/Config.cpp +++ b/android/jni/com/mapswithme/util/Config.cpp @@ -76,7 +76,7 @@ extern "C" JNIEXPORT jstring JNICALL Java_com_mapswithme_util_Config_nativeGetString(JNIEnv * env, jclass thiz, jstring name, jstring defaultValue) { - string value; + std::string value; if (settings::Get(jni::ToNativeString(env, name), value)) return jni::ToJavaString(env, value); diff --git a/android/jni/com/mapswithme/util/HttpClient.cpp b/android/jni/com/mapswithme/util/HttpClient.cpp index 49e71dbff3..6677a9320c 100644 --- a/android/jni/com/mapswithme/util/HttpClient.cpp +++ b/android/jni/com/mapswithme/util/HttpClient.cpp @@ -33,8 +33,8 @@ SOFTWARE. #include "base/exception.hpp" #include "base/logging.hpp" -#include "std/string.hpp" -#include "std/unordered_map.hpp" +#include +#include DECLARE_EXCEPTION(JniException, RootException); @@ -57,7 +57,7 @@ jfieldID GetHttpParamsFieldId(ScopedEnv & env, const char * name, } // Set string value to HttpClient.Params object, throws JniException and -void SetString(ScopedEnv & env, jobject params, jfieldID const fieldId, string const & value) +void SetString(ScopedEnv & env, jobject params, jfieldID const fieldId, std::string const & value) { if (value.empty()) return; @@ -76,7 +76,7 @@ void SetBoolean(ScopedEnv & env, jobject params, jfieldID const fieldId, bool co } // Get string value from HttpClient.Params object, throws JniException. -void GetString(ScopedEnv & env, jobject const params, jfieldID const fieldId, string & result) +void GetString(ScopedEnv & env, jobject const params, jfieldID const fieldId, std::string & result) { jni::ScopedLocalRef const wrappedValue( env.get(), static_cast(env->GetObjectField(params, fieldId))); @@ -92,7 +92,7 @@ void GetInt(ScopedEnv & env, jobject const params, jfieldID const fieldId, int & } void SetHeaders(ScopedEnv & env, jobject const params, - unordered_map const & headers) + std::unordered_map const & headers) { if (headers.empty()) return; @@ -104,7 +104,7 @@ void SetHeaders(ScopedEnv & env, jobject const params, RethrowOnJniException(env); - using HeaderPair = unordered_map::value_type; + using HeaderPair = std::unordered_map::value_type; env->CallVoidMethod( params, setHeaders, jni::ToJavaArray(env.get(), g_httpHeaderClazz, headers, [](JNIEnv * env, @@ -116,7 +116,7 @@ void SetHeaders(ScopedEnv & env, jobject const params, RethrowOnJniException(env); } -void LoadHeaders(ScopedEnv & env, jobject const params, unordered_map & headers) +void LoadHeaders(ScopedEnv & env, jobject const params, std::unordered_map & headers) { static jmethodID const getHeaders = env->GetMethodID(g_httpParamsClazz, "getHeaders", "()[Ljava/lang/Object;"); @@ -162,7 +162,7 @@ public: {"httpResponseCode", GetHttpParamsFieldId(env, "httpResponseCode", "I")}}; } - jfieldID GetId(string const & fieldName) const + jfieldID GetId(std::string const & fieldName) const { auto const it = m_fieldIds.find(fieldName); CHECK(it != m_fieldIds.end(), ("Incorrect field name:", fieldName)); @@ -170,7 +170,7 @@ public: } private: - unordered_map m_fieldIds; + std::unordered_map m_fieldIds; }; } // namespace diff --git a/android/jni/com/mapswithme/util/StringUtils.cpp b/android/jni/com/mapswithme/util/StringUtils.cpp index 7e01c268cd..8c6d7827c2 100644 --- a/android/jni/com/mapswithme/util/StringUtils.cpp +++ b/android/jni/com/mapswithme/util/StringUtils.cpp @@ -22,13 +22,13 @@ Java_com_mapswithme_util_StringUtils_nativeContainsNormalized(JNIEnv * env, jcla JNIEXPORT jobjectArray JNICALL Java_com_mapswithme_util_StringUtils_nativeFilterContainsNormalized(JNIEnv * env, jclass thiz, jobjectArray src, jstring jSubstr) { - string substr = jni::ToNativeString(env, jSubstr); + std::string substr = jni::ToNativeString(env, jSubstr); int const length = env->GetArrayLength(src); - std::vector filtered; + std::vector filtered; filtered.reserve(length); for (int i = 0; i < length; i++) { - string str = jni::ToNativeString(env, (jstring) env->GetObjectArrayElement(src, i)); + std::string str = jni::ToNativeString(env, (jstring) env->GetObjectArrayElement(src, i)); if (search::ContainsNormalized(str, substr)) filtered.push_back(str); }