Skip to content

Commit f4dafc1

Browse files
Arsentiy Milchakovmpimenov
Arsentiy Milchakov
authored andcommitted
[editor] get rid of T prefix
1 parent ccda0f4 commit f4dafc1

20 files changed

+138
-144
lines changed

editor/changeset_wrapper.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ string DebugPrint(xml_document const & doc)
104104

105105
namespace osm
106106
{
107-
ChangesetWrapper::ChangesetWrapper(TKeySecret const & keySecret,
108-
ServerApi06::TKeyValueTags const & comments) noexcept
107+
ChangesetWrapper::ChangesetWrapper(KeySecret const & keySecret,
108+
ServerApi06::KeyValueTags const & comments) noexcept
109109
: m_changesetComments(comments), m_api(OsmOAuth::ServerAuth(keySecret))
110110
{
111111
}
@@ -252,7 +252,7 @@ void ChangesetWrapper::Delete(XMLFeature node)
252252
m_deleted_types[GetTypeForFeature(node)]++;
253253
}
254254

255-
string ChangesetWrapper::TypeCountToString(TTypeCount const & typeCount)
255+
string ChangesetWrapper::TypeCountToString(TypeCount const & typeCount)
256256
{
257257
if (typeCount.empty())
258258
return string();

editor/changeset_wrapper.hpp

+8-8
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ struct ClientToken;
1919

2020
class ChangesetWrapper
2121
{
22-
using TTypeCount = std::map<std::string, size_t>;
22+
using TypeCount = std::map<std::string, size_t>;
2323

2424
public:
2525
DECLARE_EXCEPTION(ChangesetWrapperException, RootException);
@@ -32,8 +32,8 @@ class ChangesetWrapper
3232
DECLARE_EXCEPTION(LinearFeaturesAreNotSupportedException, ChangesetWrapperException);
3333
DECLARE_EXCEPTION(EmptyFeatureException, ChangesetWrapperException);
3434

35-
ChangesetWrapper(TKeySecret const & keySecret,
36-
ServerApi06::TKeyValueTags const & comments) noexcept;
35+
ChangesetWrapper(KeySecret const & keySecret,
36+
ServerApi06::KeyValueTags const & comments) noexcept;
3737
~ChangesetWrapper();
3838

3939
/// Throws many exceptions from above list, plus including XMLNode's parsing ones.
@@ -59,15 +59,15 @@ class ChangesetWrapper
5959
void LoadXmlFromOSM(ms::LatLon const & ll, pugi::xml_document & doc, double radiusInMeters = 1.0);
6060
void LoadXmlFromOSM(ms::LatLon const & min, ms::LatLon const & max, pugi::xml_document & doc);
6161

62-
ServerApi06::TKeyValueTags m_changesetComments;
62+
ServerApi06::KeyValueTags m_changesetComments;
6363
ServerApi06 m_api;
6464
static constexpr uint64_t kInvalidChangesetId = 0;
6565
uint64_t m_changesetId = kInvalidChangesetId;
6666

67-
TTypeCount m_modified_types;
68-
TTypeCount m_created_types;
69-
TTypeCount m_deleted_types;
70-
static std::string TypeCountToString(TTypeCount const & typeCount);
67+
TypeCount m_modified_types;
68+
TypeCount m_created_types;
69+
TypeCount m_deleted_types;
70+
static std::string TypeCountToString(TypeCount const & typeCount);
7171
std::string GetDescription() const;
7272
};
7373

editor/editor_config.hpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@ namespace editor
1414
struct TypeAggregatedDescription
1515
{
1616
using EType = feature::Metadata::EType;
17-
using TFeatureFields = std::vector<EType>;
17+
using FeatureFields = std::vector<EType>;
1818

1919
bool IsEmpty() const
2020
{
2121
return IsNameEditable() || IsAddressEditable() || !m_editableFields.empty();
2222
}
2323

24-
TFeatureFields const & GetEditableFields() const { return m_editableFields; }
24+
FeatureFields const & GetEditableFields() const { return m_editableFields; }
2525

2626
bool IsNameEditable() const { return m_name; }
2727
bool IsAddressEditable() const { return m_address; }
2828

29-
TFeatureFields m_editableFields;
29+
FeatureFields m_editableFields;
3030

3131
bool m_name = false;
3232
bool m_address = false;

editor/editor_tests/editor_config_test.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ using namespace editor;
1010
UNIT_TEST(EditorConfig_TypeDescription)
1111
{
1212
using EType = feature::Metadata::EType;
13-
using TFields = editor::TypeAggregatedDescription::TFeatureFields;
13+
using Fields = editor::TypeAggregatedDescription::FeatureFields;
1414

15-
TFields const poi = {
15+
Fields const poi = {
1616
feature::Metadata::FMD_OPEN_HOURS,
1717
feature::Metadata::FMD_PHONE_NUMBER,
1818
feature::Metadata::FMD_WEBSITE,
@@ -35,7 +35,7 @@ UNIT_TEST(EditorConfig_TypeDescription)
3535
TEST(config.GetTypeDescription({"amenity-hunting_stand"}, desc), ());
3636
TEST(desc.IsNameEditable(), ());
3737
TEST(!desc.IsAddressEditable(), ());
38-
TEST_EQUAL(desc.GetEditableFields(), TFields {EType::FMD_HEIGHT}, ());
38+
TEST_EQUAL(desc.GetEditableFields(), Fields{EType::FMD_HEIGHT}, ());
3939
}
4040
{
4141
editor::TypeAggregatedDescription desc;
@@ -70,7 +70,7 @@ UNIT_TEST(EditorConfig_TypeDescription)
7070
editor::TypeAggregatedDescription desc;
7171
TEST(config.GetTypeDescription({"tourism-artwork-impresionism-monet"}, desc), ());
7272
TEST(desc.IsNameEditable(), ());
73-
TEST_EQUAL(desc.GetEditableFields(), TFields {}, ());
73+
TEST_EQUAL(desc.GetEditableFields(), Fields{}, ());
7474
}
7575
// TODO(mgsergio): Test case with priority="high" when there is one on editor.config.
7676
}

editor/editor_tests/osm_editor_test.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ class ScopedOptionalSaveStorage
107107
OptionalSaveStorage * m_storage = new OptionalSaveStorage;
108108
};
109109

110-
template <typename TFn>
111-
void ForEachCafeAtPoint(DataSource & dataSource, m2::PointD const & mercator, TFn && fn)
110+
template <typename Fn>
111+
void ForEachCafeAtPoint(DataSource & dataSource, m2::PointD const & mercator, Fn && fn)
112112
{
113113
m2::RectD const rect = MercatorBounds::RectByCenterXYAndSizeInMeters(mercator, 0.2 /* rect width */);
114114

editor/editor_tests/osm_editor_test.hpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,14 @@ class EditorTest
4949
void SaveTransactionTest();
5050

5151
private:
52-
template <typename TBuildFn>
53-
MwmSet::MwmId ConstructTestMwm(TBuildFn && fn)
52+
template <typename BuildFn>
53+
MwmSet::MwmId ConstructTestMwm(BuildFn && fn)
5454
{
55-
return BuildMwm("TestCountry", std::forward<TBuildFn>(fn));
55+
return BuildMwm("TestCountry", std::forward<BuildFn>(fn));
5656
}
5757

58-
template <typename TBuildFn>
59-
MwmSet::MwmId BuildMwm(std::string const & name, TBuildFn && fn, int64_t version = 0)
58+
template <typename BuildFn>
59+
MwmSet::MwmId BuildMwm(std::string const & name, BuildFn && fn, int64_t version = 0)
6060
{
6161
m_mwmFiles.emplace_back(GetPlatform().WritableDir(), platform::CountryFile(name), version);
6262
auto & file = m_mwmFiles.back();

editor/editor_tests/ui2oh_test.cpp

+16-19
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ UNIT_TEST(OpeningHours2TimeTableSet_off)
214214
TimeTableSet tts;
215215

216216
TEST(MakeTimeTableSet(oh, tts), ());
217-
TEST_EQUAL(tts.GetUnhandledDays(), TOpeningDays({osmoh::Weekday::Saturday}), ());
217+
TEST_EQUAL(tts.GetUnhandledDays(), OpeningDays({osmoh::Weekday::Saturday}), ());
218218
}
219219
{
220220
OpeningHours oh("Sa; Su; Sa off");
@@ -223,13 +223,11 @@ UNIT_TEST(OpeningHours2TimeTableSet_off)
223223
TimeTableSet tts;
224224

225225
TEST(MakeTimeTableSet(oh, tts), ());
226-
TEST_EQUAL(tts.GetUnhandledDays(),
227-
TOpeningDays({osmoh::Weekday::Monday,
228-
osmoh::Weekday::Tuesday,
229-
osmoh::Weekday::Wednesday,
230-
osmoh::Weekday::Thursday,
231-
osmoh::Weekday::Friday,
232-
osmoh::Weekday::Saturday}), ());
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+
());
233231
}
234232
{
235233
OpeningHours oh("Mo-Su 08:00-13:00,14:00-20:00; Sa 10:00-11:00 off");
@@ -241,7 +239,7 @@ UNIT_TEST(OpeningHours2TimeTableSet_off)
241239
TEST_EQUAL(tts.Size(), 2, ());
242240

243241
auto const tt = tts.Get(1);
244-
TEST_EQUAL(tt.GetOpeningDays(), TOpeningDays({osmoh::Weekday::Saturday}), ());
242+
TEST_EQUAL(tt.GetOpeningDays(), OpeningDays({osmoh::Weekday::Saturday}), ());
245243
TEST_EQUAL(tt.GetOpeningTime().GetStart().GetHourMinutes().GetHoursCount(), 8, ());
246244
TEST_EQUAL(tt.GetOpeningTime().GetEnd().GetHourMinutes().GetHoursCount(), 20, ());
247245
TEST_EQUAL(tt.GetExcludeTime()[0].GetStart().GetHourMinutes().GetHoursCount(), 10, ());
@@ -263,7 +261,7 @@ UNIT_TEST(OpeningHours2TimeTableSet_off)
263261
TEST_EQUAL(tt.GetOpeningTime().GetStart().GetHourMinutes().GetHoursCount(), 0, ());
264262
TEST_EQUAL(tt.GetOpeningTime().GetEnd().GetHourMinutes().GetHoursCount(), 24, ());
265263

266-
TEST_EQUAL(tt.GetOpeningDays(), TOpeningDays({osmoh::Weekday::Saturday}), ());
264+
TEST_EQUAL(tt.GetOpeningDays(), OpeningDays({osmoh::Weekday::Saturday}), ());
267265
TEST_EQUAL(tt.GetExcludeTime()[0].GetStart().GetHourMinutes().GetHoursCount(), 10, ());
268266
TEST_EQUAL(tt.GetExcludeTime()[0].GetEnd().GetHourMinutes().GetHoursCount(), 11, ());
269267
}
@@ -275,7 +273,7 @@ UNIT_TEST(OpeningHours2TimeTableSet_off)
275273

276274
TEST(MakeTimeTableSet(oh, tts), ());
277275
TEST_EQUAL(tts.Size(), 2, ());
278-
TEST_EQUAL(tts.GetUnhandledDays(), TOpeningDays({osmoh::Weekday::Tuesday}), ());
276+
TEST_EQUAL(tts.GetUnhandledDays(), OpeningDays({osmoh::Weekday::Tuesday}), ());
279277
}
280278
{
281279
OpeningHours oh("Mo-Fr 11:00-17:00; Sa-Su 12:00-16:00; Mo-Fr off");
@@ -286,12 +284,11 @@ UNIT_TEST(OpeningHours2TimeTableSet_off)
286284
TEST(MakeTimeTableSet(oh, tts), ());
287285
TEST_EQUAL(tts.Size(), 1, ());
288286

289-
TEST_EQUAL(tts.GetUnhandledDays(),
290-
TOpeningDays({osmoh::Weekday::Monday,
291-
osmoh::Weekday::Tuesday,
292-
osmoh::Weekday::Wednesday,
293-
osmoh::Weekday::Thursday,
294-
osmoh::Weekday::Friday}), ());
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+
());
295292
}
296293
{
297294
OpeningHours oh("Mo-Fr 11:00-17:00; Sa-Su 12:00-16:00; Mo-Fr 11:00-13:00 off");
@@ -303,7 +300,7 @@ UNIT_TEST(OpeningHours2TimeTableSet_off)
303300
TEST_EQUAL(tts.Size(), 2, ());
304301

305302
auto const tt = tts.Get(0);
306-
TEST_EQUAL(tts.GetUnhandledDays(), TOpeningDays(), ());
303+
TEST_EQUAL(tts.GetUnhandledDays(), OpeningDays(), ());
307304

308305
TEST_EQUAL(tt.GetOpeningTime().GetStart().GetHourMinutes().GetHoursCount(), 11, ());
309306
TEST_EQUAL(tt.GetOpeningTime().GetEnd().GetHourMinutes().GetHoursCount(), 17, ());
@@ -323,7 +320,7 @@ UNIT_TEST(OpeningHours2TimeTableSet_plus)
323320
TEST_EQUAL(tts.Size(), 1, ());
324321

325322
auto const tt = tts.Get(0);
326-
TEST_EQUAL(tts.GetUnhandledDays(), TOpeningDays(), ());
323+
TEST_EQUAL(tts.GetUnhandledDays(), OpeningDays(), ());
327324

328325
TEST_EQUAL(tt.GetOpeningTime().GetStart().GetHourMinutes().GetHoursCount(), 11, ());
329326
TEST_EQUAL(tt.GetOpeningTime().GetEnd().GetHourMinutes().GetHoursCount(), 24, ());

editor/editor_tests_support/helpers.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ namespace tests_support
1515
void SetUpEditorForTesting(std::unique_ptr<osm::Editor::Delegate> delegate);
1616
void TearDownEditorForTesting();
1717

18-
template <typename TFn>
19-
void EditFeature(FeatureType & ft, TFn && fn)
18+
template <typename Fn>
19+
void EditFeature(FeatureType & ft, Fn && fn)
2020
{
2121
auto & editor = osm::Editor::Instance();
2222

editor/opening_hours_ui.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ TimeTable TimeTable::GetPredefinedTimeTable()
144144
return tt;
145145
}
146146

147-
bool TimeTable::SetOpeningDays(TOpeningDays const & days)
147+
bool TimeTable::SetOpeningDays(OpeningDays const & days)
148148
{
149149
if (days.empty())
150150
return false;
@@ -292,9 +292,9 @@ TimeTableSet::TimeTableSet()
292292
m_table.push_back(TimeTable::GetPredefinedTimeTable());
293293
}
294294

295-
TOpeningDays TimeTableSet::GetUnhandledDays() const
295+
OpeningDays TimeTableSet::GetUnhandledDays() const
296296
{
297-
TOpeningDays days = {
297+
OpeningDays days = {
298298
osmoh::Weekday::Sunday,
299299
osmoh::Weekday::Monday,
300300
osmoh::Weekday::Tuesday,
@@ -381,7 +381,7 @@ bool TimeTableSet::UpdateByIndex(TimeTableSet & ttSet, size_t const index)
381381

382382
auto && tt = ttSet.m_table[i];
383383
// Remove all days of updated timetable from all other timetables.
384-
TOpeningDays days;
384+
OpeningDays days;
385385
std::set_difference(std::begin(tt.GetOpeningDays()), std::end(tt.GetOpeningDays()),
386386
std::begin(updated.GetOpeningDays()), std::end(updated.GetOpeningDays()),
387387
inserter(days, std::end(days)));

editor/opening_hours_ui.hpp

+27-31
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace editor
99
{
1010
namespace ui
1111
{
12-
using TOpeningDays = std::set<osmoh::Weekday>;
12+
using OpeningDays = std::set<osmoh::Weekday>;
1313

1414
class TimeTable
1515
{
@@ -20,8 +20,8 @@ class TimeTable
2020
bool IsTwentyFourHours() const { return m_isTwentyFourHours; }
2121
void SetTwentyFourHours(bool const on) { m_isTwentyFourHours = on; }
2222

23-
TOpeningDays const & GetOpeningDays() const { return m_weekdays; }
24-
bool SetOpeningDays(TOpeningDays const & days);
23+
OpeningDays const & GetOpeningDays() const { return m_weekdays; }
24+
bool SetOpeningDays(OpeningDays const & days);
2525

2626
void AddWorkingDay(osmoh::Weekday const wd);
2727
bool RemoveWorkingDay(osmoh::Weekday const wd);
@@ -44,46 +44,42 @@ class TimeTable
4444
TimeTable() = default;
4545

4646
bool m_isTwentyFourHours;
47-
TOpeningDays m_weekdays;
47+
OpeningDays m_weekdays;
4848
osmoh::Timespan m_openingTime;
4949
osmoh::TTimespans m_excludeTime;
5050
};
5151

52-
template <typename TTimeTableSet>
53-
class TimeTableProxyBase : public TimeTable
52+
class TimeTableProxy;
53+
54+
class TimeTableSet
5455
{
56+
using TimeTableSetImpl = std::vector<TimeTable>;
57+
5558
public:
56-
TimeTableProxyBase(TTimeTableSet & tts, size_t const index, TimeTable const & tt):
57-
TimeTable(tt),
58-
m_index(index),
59-
m_tts(tts)
59+
class Proxy : public TimeTable
6060
{
61-
}
62-
63-
bool Commit() { return m_tts.Replace(*this, m_index); } // Slice base class on copy.
64-
65-
private:
66-
size_t const m_index;
67-
TTimeTableSet & m_tts;
68-
};
61+
public:
62+
Proxy(TimeTableSet & tts, size_t const index, TimeTable const & tt)
63+
: TimeTable(tt), m_index(index), m_tts(tts)
64+
{
65+
}
6966

70-
class TimeTableSet;
71-
using TTimeTableProxy = TimeTableProxyBase<TimeTableSet>;
67+
bool Commit() { return m_tts.Replace(*this, m_index); } // Slice base class on copy.
7268

73-
class TimeTableSet
74-
{
75-
using TTimeTableSetImpl = std::vector<TimeTable>;
69+
private:
70+
size_t const m_index;
71+
TimeTableSet & m_tts;
72+
};
7673

77-
public:
7874
TimeTableSet();
7975

80-
TOpeningDays GetUnhandledDays() const;
76+
OpeningDays GetUnhandledDays() const;
8177

8278
TimeTable GetComplementTimeTable() const;
8379

84-
TTimeTableProxy Get(size_t const index) { return TTimeTableProxy(*this, index, m_table[index]); }
85-
TTimeTableProxy Front() { return Get(0); }
86-
TTimeTableProxy Back() { return Get(Size() - 1); }
80+
Proxy Get(size_t const index) { return Proxy(*this, index, m_table[index]); }
81+
Proxy Front() { return Get(0); }
82+
Proxy Back() { return Get(Size() - 1); }
8783

8884
size_t Size() const { return m_table.size(); }
8985
bool Empty() const { return m_table.empty(); }
@@ -95,13 +91,13 @@ class TimeTableSet
9591

9692
bool Replace(TimeTable const & tt, size_t const index);
9793

98-
TTimeTableSetImpl::const_iterator begin() const { return m_table.begin(); }
99-
TTimeTableSetImpl::const_iterator end() const { return m_table.end(); }
94+
TimeTableSetImpl::const_iterator begin() const { return m_table.begin(); }
95+
TimeTableSetImpl::const_iterator end() const { return m_table.end(); }
10096

10197
private:
10298
static bool UpdateByIndex(TimeTableSet & ttSet, size_t const index);
10399

104-
TTimeTableSetImpl m_table;
100+
TimeTableSetImpl m_table;
105101
};
106102
} // namespace ui
107103
} // namespace editor

0 commit comments

Comments
 (0)