Skip to content

Commit 05711a8

Browse files
Arsentiy Milchakovmpimenov
Arsentiy Milchakov
authored andcommitted
[editor] review fixes
1 parent 2dfefa3 commit 05711a8

25 files changed

+98
-74
lines changed

android/jni/com/mapswithme/maps/editor/OsmOAuth.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace
1616
using namespace osm;
1717
using namespace jni;
1818

19-
jobjectArray ToStringArray(JNIEnv * env, TKeySecret const & secret)
19+
jobjectArray ToStringArray(JNIEnv * env, KeySecret const & secret)
2020
{
2121
jobjectArray resultArray = env->NewObjectArray(2, GetStringClass(env), nullptr);
2222
env->SetObjectArrayElement(resultArray, 0, ToJavaString(env, secret.first));
@@ -25,7 +25,7 @@ jobjectArray ToStringArray(JNIEnv * env, TKeySecret const & secret)
2525
}
2626

2727
// @returns [url, key, secret]
28-
jobjectArray ToStringArray(JNIEnv * env, OsmOAuth::TUrlRequestToken const & uks)
28+
jobjectArray ToStringArray(JNIEnv * env, OsmOAuth::UrlRequestToken const & uks)
2929
{
3030
jobjectArray resultArray = env->NewObjectArray(3, GetStringClass(env), nullptr);
3131
env->SetObjectArrayElement(resultArray, 0, ToJavaString(env, uks.first));
@@ -62,9 +62,9 @@ Java_com_mapswithme_maps_editor_OsmOAuth_nativeAuthWithWebviewToken(JNIEnv * env
6262
{
6363
try
6464
{
65-
TRequestToken const rt = { ToNativeString(env, key), ToNativeString(env, secret) };
65+
RequestToken const rt = { ToNativeString(env, key), ToNativeString(env, secret) };
6666
OsmOAuth auth = OsmOAuth::ServerAuth();
67-
TKeySecret const ks = auth.FinishAuthorization(rt, ToNativeString(env, verifier));
67+
KeySecret const ks = auth.FinishAuthorization(rt, ToNativeString(env, verifier));
6868
return ToStringArray(env, ks);
6969
}
7070
catch (std::exception const & ex)
@@ -79,7 +79,7 @@ Java_com_mapswithme_maps_editor_OsmOAuth_nativeGetFacebookAuthUrl(JNIEnv * env,
7979
{
8080
try
8181
{
82-
OsmOAuth::TUrlRequestToken const uks = OsmOAuth::ServerAuth().GetFacebookOAuthURL();
82+
OsmOAuth::UrlRequestToken const uks = OsmOAuth::ServerAuth().GetFacebookOAuthURL();
8383
return ToStringArray(env, uks);
8484
}
8585
catch (std::exception const & ex)
@@ -94,7 +94,7 @@ Java_com_mapswithme_maps_editor_OsmOAuth_nativeGetGoogleAuthUrl(JNIEnv * env, jc
9494
{
9595
try
9696
{
97-
OsmOAuth::TUrlRequestToken const uks = OsmOAuth::ServerAuth().GetGoogleOAuthURL();
97+
OsmOAuth::UrlRequestToken const uks = OsmOAuth::ServerAuth().GetGoogleOAuthURL();
9898
return ToStringArray(env, uks);
9999
}
100100
catch (std::exception const & ex)
@@ -109,7 +109,7 @@ Java_com_mapswithme_maps_editor_OsmOAuth_nativeGetOsmUsername(JNIEnv * env, jcla
109109
{
110110
try
111111
{
112-
TKeySecret keySecret(jni::ToNativeString(env, token), jni::ToNativeString(env, secret));
112+
KeySecret keySecret(jni::ToNativeString(env, token), jni::ToNativeString(env, secret));
113113
ServerApi06 const api(OsmOAuth::ServerAuth(keySecret));
114114
return jni::ToJavaString(env, api.GetUserPreferences().m_displayName);
115115
}

editor/changeset_wrapper.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@
99
#include "base/macros.hpp"
1010

1111
#include <algorithm>
12+
#include <cstdint>
1213
#include <exception>
1314
#include <random>
1415
#include <sstream>
16+
#include <utility>
1517

1618
#include "private.h"
1719

editor/changeset_wrapper.hpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
#pragma once
22

3-
#include "base/exception.hpp"
4-
53
#include "editor/server_api.hpp"
64
#include "editor/xml_feature.hpp"
75

86
#include "geometry/point2d.hpp"
97
#include "geometry/rect2d.hpp"
108

9+
#include "base/exception.hpp"
10+
1111
#include <map>
12+
#include <string>
1213
#include <vector>
1314

1415
class FeatureType;

editor/editor_tests/feature_matcher_test.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
#include "editor/feature_matcher.hpp"
44
#include "editor/xml_feature.hpp"
55

6+
#include <string>
7+
#include <vector>
8+
69
#include "3party/pugixml/src/pugixml.hpp"
710

811
namespace

editor/editor_tests/match_by_geometry_test.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
#include "editor/feature_matcher.hpp"
44
#include "editor/xml_feature.hpp"
55

6+
#include <string>
7+
#include <vector>
8+
69
#include "3party/pugixml/src/pugixml.hpp"
710

811
namespace

editor/editor_tests/osm_editor_test.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@ void EditorTest::RollBackChangesTest()
622622
builder.Add(cafe);
623623
});
624624

625-
const std::string houseNumber = "4a";
625+
std::string const houseNumber = "4a";
626626

627627
ForEachCafeAtPoint(m_dataSource, m2::PointD(1.0, 1.0), [&editor, &houseNumber](FeatureType & ft)
628628
{

editor/editor_tests/osm_editor_test.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313

1414
#include "platform/local_country_file_utils.hpp"
1515

16+
#include "base/assert.hpp"
17+
1618
#include <string>
1719
#include <utility>
1820
#include <vector>

editor/editor_tests/ui2oh_test.cpp

+13-10
Original file line numberDiff line numberDiff line change
@@ -223,11 +223,13 @@ UNIT_TEST(OpeningHours2TimeTableSet_off)
223223
TimeTableSet tts;
224224

225225
TEST(MakeTimeTableSet(oh, tts), ());
226-
TEST_EQUAL(
227-
tts.GetUnhandledDays(),
228-
OpeningDays({osmoh::Weekday::Monday, osmoh::Weekday::Tuesday, osmoh::Weekday::Wednesday,
229-
osmoh::Weekday::Thursday, osmoh::Weekday::Friday, osmoh::Weekday::Saturday}),
230-
());
226+
TEST_EQUAL(tts.GetUnhandledDays(),
227+
OpeningDays({osmoh::Weekday::Monday,
228+
osmoh::Weekday::Tuesday,
229+
osmoh::Weekday::Wednesday,
230+
osmoh::Weekday::Thursday,
231+
osmoh::Weekday::Friday,
232+
osmoh::Weekday::Saturday}), ());
231233
}
232234
{
233235
OpeningHours oh("Mo-Su 08:00-13:00,14:00-20:00; Sa 10:00-11:00 off");
@@ -284,11 +286,12 @@ UNIT_TEST(OpeningHours2TimeTableSet_off)
284286
TEST(MakeTimeTableSet(oh, tts), ());
285287
TEST_EQUAL(tts.Size(), 1, ());
286288

287-
TEST_EQUAL(
288-
tts.GetUnhandledDays(),
289-
OpeningDays({osmoh::Weekday::Monday, osmoh::Weekday::Tuesday, osmoh::Weekday::Wednesday,
290-
osmoh::Weekday::Thursday, osmoh::Weekday::Friday}),
291-
());
289+
TEST_EQUAL(tts.GetUnhandledDays(),
290+
OpeningDays({osmoh::Weekday::Monday,
291+
osmoh::Weekday::Tuesday,
292+
osmoh::Weekday::Wednesday,
293+
osmoh::Weekday::Thursday,
294+
osmoh::Weekday::Friday}), ());
292295
}
293296
{
294297
OpeningHours oh("Mo-Fr 11:00-17:00; Sa-Su 12:00-16:00; Mo-Fr 11:00-13:00 off");

editor/editor_tests/xml_feature_test.cpp

+10-4
Original file line numberDiff line numberDiff line change
@@ -265,10 +265,16 @@ UNIT_TEST(XMLFeature_FromXmlNode)
265265

266266
UNIT_TEST(XMLFeature_Geometry)
267267
{
268-
std::vector<m2::PointD> const geometry = {{28.7206411, 3.7182409}, {46.7569003, 47.0774689},
269-
{22.5909217, 41.6994874}, {14.7537008, 17.7788229},
270-
{55.1261701, 10.3199476}, {28.6519654, 50.0305930},
271-
{28.7206411, 3.7182409}};
268+
std::vector<m2::PointD> const geometry =
269+
{
270+
{28.7206411, 3.7182409},
271+
{46.7569003, 47.0774689},
272+
{22.5909217, 41.6994874},
273+
{14.7537008, 17.7788229},
274+
{55.1261701, 10.3199476},
275+
{28.6519654, 50.0305930},
276+
{28.7206411, 3.7182409}
277+
};
272278

273279
XMLFeature feature(XMLFeature::Type::Way);
274280
feature.SetGeometry(geometry);

editor/new_feature_categories.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ namespace osm
1818
class NewFeatureCategories
1919
{
2020
public:
21-
using TypeName = string;
21+
using TypeName = std::string;
2222
using TypeNames = std::vector<TypeName>;
2323

2424
NewFeatureCategories(editor::EditorConfig const & config);

editor/opening_hours_ui.hpp

-2
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@ class TimeTable
4949
osmoh::TTimespans m_excludeTime;
5050
};
5151

52-
class TimeTableProxy;
53-
5452
class TimeTableSet
5553
{
5654
using TimeTableSetImpl = std::vector<TimeTable>;

editor/osm_editor.cpp

+5-3
Original file line numberDiff line numberDiff line change
@@ -852,9 +852,11 @@ void Editor::UploadChanges(string const & key, string const & secret, ChangesetT
852852
if (!m_isUploadingNow)
853853
{
854854
m_isUploadingNow = true;
855-
GetPlatform().RunTask(Platform::Thread::Network, [
856-
upload = move(upload), key, secret, tags = move(tags), callback = move(callback)
857-
]() { upload(move(key), move(secret), move(tags), move(callback)); });
855+
GetPlatform().RunTask(Platform::Thread::Network, [upload = move(upload), key, secret,
856+
tags = move(tags), callback = move(callback)]()
857+
{
858+
upload(move(key), move(secret), move(tags), move(callback));
859+
});
858860
}
859861
}
860862

editor/osm_editor.hpp

+11-8
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,13 @@
1919
#include "base/timer.hpp"
2020

2121
#include <atomic>
22+
#include <cstdint>
2223
#include <ctime>
2324
#include <functional>
2425
#include <map>
26+
#include <memory>
2527
#include <string>
28+
#include <utility>
2629
#include <vector>
2730

2831
namespace editor
@@ -58,7 +61,7 @@ class Editor final : public MwmSet::Observer
5861
virtual ~Delegate() = default;
5962

6063
virtual MwmSet::MwmId GetMwmIdByMapName(std::string const & name) const = 0;
61-
virtual unique_ptr<EditableMapObject> GetOriginalMapObject(FeatureID const & fid) const = 0;
64+
virtual std::unique_ptr<EditableMapObject> GetOriginalMapObject(FeatureID const & fid) const = 0;
6265
virtual std::string GetOriginalFeatureStreet(FeatureID const & fid) const = 0;
6366
virtual void ForEachFeatureAtPoint(FeatureTypeFn && fn, m2::PointD const & point) const = 0;
6467
};
@@ -100,9 +103,9 @@ class Editor final : public MwmSet::Observer
100103

101104
static Editor & Instance();
102105

103-
void SetDelegate(unique_ptr<Delegate> delegate) { m_delegate = std::move(delegate); }
106+
void SetDelegate(std::unique_ptr<Delegate> delegate) { m_delegate = std::move(delegate); }
104107

105-
void SetStorageForTesting(unique_ptr<editor::StorageBase> storage)
108+
void SetStorageForTesting(std::unique_ptr<editor::StorageBase> storage)
106109
{
107110
m_storage = std::move(storage);
108111
}
@@ -214,7 +217,7 @@ class Editor final : public MwmSet::Observer
214217

215218
/// @returns false if fails.
216219
bool Save(FeaturesContainer const & features) const;
217-
bool SaveTransaction(shared_ptr<FeaturesContainer> const & features);
220+
bool SaveTransaction(std::shared_ptr<FeaturesContainer> const & features);
218221
bool RemoveFeatureIfExists(FeatureID const & fid);
219222
/// Notify framework that something has changed and should be redisplayed.
220223
void Invalidate();
@@ -239,7 +242,7 @@ class Editor final : public MwmSet::Observer
239242

240243
// These methods are just checked wrappers around Delegate.
241244
MwmSet::MwmId GetMwmIdByMapName(std::string const & name);
242-
unique_ptr<EditableMapObject> GetOriginalMapObject(FeatureID const & fid) const;
245+
std::unique_ptr<EditableMapObject> GetOriginalMapObject(FeatureID const & fid) const;
243246
std::string GetOriginalFeatureStreet(FeatureID const & fid) const;
244247
void ForEachFeatureAtPoint(FeatureTypeFn && fn, m2::PointD const & point) const;
245248
FeatureID GetFeatureIdByXmlFeature(FeaturesContainer const & features,
@@ -259,7 +262,7 @@ class Editor final : public MwmSet::Observer
259262
/// Deleted, edited and created features.
260263
base::AtomicSharedPtr<FeaturesContainer> m_features;
261264

262-
unique_ptr<Delegate> m_delegate;
265+
std::unique_ptr<Delegate> m_delegate;
263266

264267
/// Invalidate map viewport after edits.
265268
InvalidateFn m_invalidateFn;
@@ -269,9 +272,9 @@ class Editor final : public MwmSet::Observer
269272
editor::ConfigLoader m_configLoader;
270273

271274
/// Notes to be sent to osm.
272-
shared_ptr<editor::Notes> m_notes;
275+
std::shared_ptr<editor::Notes> m_notes;
273276

274-
unique_ptr<editor::StorageBase> m_storage;
277+
std::unique_ptr<editor::StorageBase> m_storage;
275278

276279
std::atomic<bool> m_isUploadingNow;
277280

iphone/Maps/Classes/CustomViews/Login/MWMAuthorizationCommon.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ UIColor * AuthorizationButtonBackgroundColor(AuthorizationButtonType type);
1414
void AuthorizationConfigButton(UIButton * btn, AuthorizationButtonType type);
1515

1616
// Deletes any stored credentials if called with empty key or secret.
17-
void AuthorizationStoreCredentials(osm::TKeySecret const & keySecret);
17+
void AuthorizationStoreCredentials(osm::KeySecret const & keySecret);
1818
BOOL AuthorizationHaveCredentials();
1919
// Returns empty key and secret if user has not beed authorized.
20-
osm::TKeySecret AuthorizationGetCredentials();
20+
osm::KeySecret AuthorizationGetCredentials();
2121

2222
void AuthorizationSetNeedCheck(BOOL needCheck);
2323
BOOL AuthorizationIsNeedCheck();

iphone/Maps/Classes/CustomViews/Login/MWMAuthorizationCommon.mm

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
NSString * const kAuthNeedCheck = @"AuthNeedCheck";
1414
NSString * const kOSMUserName = @"UDOsmUserName";
1515

16-
void SetOSMUserNameWithCredentials(osm::TKeySecret const & keySecret)
16+
void SetOSMUserNameWithCredentials(osm::KeySecret const & keySecret)
1717
{
1818
using namespace osm;
1919
dispatch_sync(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^
@@ -75,7 +75,7 @@ void AuthorizationConfigButton(UIButton * btn, AuthorizationButtonType type)
7575
[btn setBackgroundColor:[bgCol colorWithAlphaComponent:highlightedAlpha] forState:UIControlStateHighlighted];
7676
}
7777

78-
void AuthorizationStoreCredentials(osm::TKeySecret const & keySecret)
78+
void AuthorizationStoreCredentials(osm::KeySecret const & keySecret)
7979
{
8080
NSUserDefaults * ud = NSUserDefaults.standardUserDefaults;
8181
if (keySecret.first.empty() || keySecret.second.empty())
@@ -101,13 +101,13 @@ BOOL AuthorizationHaveCredentials()
101101
return requestToken && requestSecret;
102102
}
103103

104-
osm::TKeySecret AuthorizationGetCredentials()
104+
osm::KeySecret AuthorizationGetCredentials()
105105
{
106106
NSUserDefaults * ud = NSUserDefaults.standardUserDefaults;
107107
NSString * requestToken = [ud stringForKey:kOSMRequestToken];
108108
NSString * requestSecret = [ud stringForKey:kOSMRequestSecret];
109109
if (requestToken && requestSecret)
110-
return osm::TKeySecret(requestToken.UTF8String, requestSecret.UTF8String);
110+
return osm::KeySecret(requestToken.UTF8String, requestSecret.UTF8String);
111111
return {};
112112
}
113113

iphone/Maps/Classes/CustomViews/Login/MWMAuthorizationWebViewLoginViewController.mm

+3-3
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ @interface MWMAuthorizationWebViewLoginViewController ()<UIWebViewDelegate>
4848

4949
@implementation MWMAuthorizationWebViewLoginViewController
5050
{
51-
TRequestToken m_requestToken;
51+
RequestToken m_requestToken;
5252
}
5353

5454
- (void)viewDidLoad
@@ -77,7 +77,7 @@ - (void)loadAuthorizationPage
7777
OsmOAuth const auth = OsmOAuth::ServerAuth();
7878
try
7979
{
80-
OsmOAuth::TUrlRequestToken urt;
80+
OsmOAuth::UrlRequestToken urt;
8181
switch (self.authType)
8282
{
8383
case MWMWebViewAuthorizationTypeGoogle: urt = auth.GetGoogleOAuthURL(); break;
@@ -133,7 +133,7 @@ - (void)checkAuthorization:(NSString *)verifier
133133
[self startSpinner];
134134
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
135135
OsmOAuth const auth = OsmOAuth::ServerAuth();
136-
TKeySecret ks;
136+
KeySecret ks;
137137
try
138138
{
139139
ks = auth.FinishAuthorization(self->m_requestToken, verifier.UTF8String);

iphone/Maps/Core/Editor/MWMEditorHelper.mm

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ + (void)uploadEdits:(void (^)(UIBackgroundFetchResult))completionHandler
3131
break;
3232
}
3333
};
34-
osm::TKeySecret const keySecret = osm_auth_ios::AuthorizationGetCredentials();
34+
osm::KeySecret const keySecret = osm_auth_ios::AuthorizationGetCredentials();
3535
osm::Editor::Instance().UploadChanges(
3636
keySecret.first, keySecret.second,
3737
{{"created_by",

iphone/Maps/UI/Editor/OpeningHours/MWMOpeningHoursCommon.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ NSDateComponents * dateComponentsFromTime(osmoh::Time const & time);
66
NSDate * dateFromTime(osmoh::Time const & time);
77
NSString * stringFromTime(osmoh::Time const & time);
88

9-
NSString * stringFromOpeningDays(editor::ui::TOpeningDays const & openingDays);
9+
NSString * stringFromOpeningDays(editor::ui::OpeningDays const & openingDays);
1010

1111
BOOL isEveryDay(editor::ui::TimeTable const & timeTable);

iphone/Maps/UI/Editor/OpeningHours/MWMOpeningHoursCommon.mm

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
return [fmt stringFromDate:dateFromTime(time)];
2525
}
2626

27-
NSString * stringFromOpeningDays(editor::ui::TOpeningDays const & openingDays)
27+
NSString * stringFromOpeningDays(editor::ui::OpeningDays const & openingDays)
2828
{
2929
NSCalendar * cal = NSCalendar.currentCalendar;
3030
cal.locale = NSLocale.currentLocale;

iphone/Maps/UI/Editor/OpeningHours/MWMOpeningHoursModel.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
- (CGFloat)heightForIndexPath:(NSIndexPath * _Nonnull)indexPath withWidth:(CGFloat)width;
3232
- (void)fillCell:(MWMOpeningHoursTableViewCell * _Nonnull)cell atIndexPath:(NSIndexPath * _Nonnull)indexPath;
3333
- (NSUInteger)numberOfRowsInSection:(NSUInteger)section;
34-
- (editor::ui::TOpeningDays)unhandledDays;
34+
- (editor::ui::OpeningDays)unhandledDays;
3535

3636
- (void)storeCachedData;
3737
- (void)updateOpeningHours;

0 commit comments

Comments
 (0)