Skip to content

Commit 66314dd

Browse files
authored
Merge pull request #2397 from joto/class-suffix
Add suffix _t to several classes
2 parents 70ee2ce + c953857 commit 66314dd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+264
-253
lines changed

src/command-line-parser.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,8 @@ options_t parse_command_line(int argc, char *argv[])
392392
app.add_flag_function("-l,--latlong",
393393
[&](int64_t) {
394394
options.projection =
395-
reprojection::create_projection(PROJ_LATLONG);
395+
reprojection_t::create_projection(
396+
PROJ_LATLONG);
396397
})
397398
->description("Store data in degrees of latitude & longitude (WGS84).")
398399
->group("Pgsql output options");
@@ -401,7 +402,7 @@ options_t parse_command_line(int argc, char *argv[])
401402
app.add_flag_function("-m,--merc",
402403
[&](int64_t) {
403404
options.projection =
404-
reprojection::create_projection(
405+
reprojection_t::create_projection(
405406
PROJ_SPHERE_MERC);
406407
})
407408
->description("Store data in Web Mercator [EPSG 3857]. This is the "
@@ -425,7 +426,7 @@ options_t parse_command_line(int argc, char *argv[])
425426
#ifdef HAVE_GENERIC_PROJ
426427
[&](int arg) {
427428
options.projection =
428-
reprojection::create_projection(arg);
429+
reprojection_t::create_projection(arg);
429430
#else
430431
[&](int) {
431432
throw std::runtime_error{
@@ -665,7 +666,8 @@ options_t parse_command_line(int argc, char *argv[])
665666
}
666667

667668
if (!options.projection) {
668-
options.projection = reprojection::create_projection(PROJ_SPHERE_MERC);
669+
options.projection =
670+
reprojection_t::create_projection(PROJ_SPHERE_MERC);
669671
}
670672

671673
check_options_expire(&options);

src/expire-tiles.cpp

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@
2626
#include "tile.hpp"
2727
#include "wkb.hpp"
2828

29-
expire_tiles::expire_tiles(uint32_t max_zoom,
30-
std::shared_ptr<reprojection> projection)
29+
expire_tiles_t::expire_tiles_t(uint32_t max_zoom,
30+
std::shared_ptr<reprojection_t> projection)
3131
: m_projection(std::move(projection)), m_maxzoom(max_zoom),
3232
m_map_width(static_cast<int>(1U << m_maxzoom))
3333
{}
3434

35-
void expire_tiles::expire_tile(uint32_t x, uint32_t y)
35+
void expire_tiles_t::expire_tile(uint32_t x, uint32_t y)
3636
{
3737
// Only try to insert to tile into the set if the last inserted tile
3838
// is different from this tile.
@@ -43,7 +43,7 @@ void expire_tiles::expire_tile(uint32_t x, uint32_t y)
4343
}
4444
}
4545

46-
uint32_t expire_tiles::normalise_tile_x_coord(int x) const
46+
uint32_t expire_tiles_t::normalise_tile_x_coord(int x) const
4747
{
4848
x %= m_map_width;
4949
if (x < 0) {
@@ -52,46 +52,46 @@ uint32_t expire_tiles::normalise_tile_x_coord(int x) const
5252
return static_cast<uint32_t>(x);
5353
}
5454

55-
geom::point_t expire_tiles::coords_to_tile(geom::point_t const &point)
55+
geom::point_t expire_tiles_t::coords_to_tile(geom::point_t const &point)
5656
{
5757
auto const c = m_projection->target_to_tile(point);
5858

5959
return {m_map_width * (0.5 + c.x() / tile_t::EARTH_CIRCUMFERENCE),
6060
m_map_width * (0.5 - c.y() / tile_t::EARTH_CIRCUMFERENCE)};
6161
}
6262

63-
void expire_tiles::from_point_list(geom::point_list_t const &list,
64-
expire_config_t const &expire_config)
63+
void expire_tiles_t::from_point_list(geom::point_list_t const &list,
64+
expire_config_t const &expire_config)
6565
{
6666
for_each_segment(list, [&](geom::point_t const &a, geom::point_t const &b) {
6767
from_line_segment(a, b, expire_config);
6868
});
6969
}
7070

71-
void expire_tiles::from_geometry(geom::point_t const &geom,
72-
expire_config_t const &expire_config)
71+
void expire_tiles_t::from_geometry(geom::point_t const &geom,
72+
expire_config_t const &expire_config)
7373
{
7474
geom::box_t const box = geom::envelope(geom);
7575
from_bbox(box, expire_config);
7676
}
7777

78-
void expire_tiles::from_geometry(geom::linestring_t const &geom,
79-
expire_config_t const &expire_config)
78+
void expire_tiles_t::from_geometry(geom::linestring_t const &geom,
79+
expire_config_t const &expire_config)
8080
{
8181
from_point_list(geom, expire_config);
8282
}
8383

84-
void expire_tiles::from_polygon_boundary(geom::polygon_t const &geom,
85-
expire_config_t const &expire_config)
84+
void expire_tiles_t::from_polygon_boundary(geom::polygon_t const &geom,
85+
expire_config_t const &expire_config)
8686
{
8787
from_point_list(geom.outer(), expire_config);
8888
for (auto const &inner : geom.inners()) {
8989
from_point_list(inner, expire_config);
9090
}
9191
}
9292

93-
void expire_tiles::from_geometry(geom::polygon_t const &geom,
94-
expire_config_t const &expire_config)
93+
void expire_tiles_t::from_geometry(geom::polygon_t const &geom,
94+
expire_config_t const &expire_config)
9595
{
9696
if (expire_config.mode == expire_mode::boundary_only) {
9797
from_polygon_boundary(geom, expire_config);
@@ -105,16 +105,16 @@ void expire_tiles::from_geometry(geom::polygon_t const &geom,
105105
}
106106
}
107107

108-
void expire_tiles::from_polygon_boundary(geom::multipolygon_t const &geom,
109-
expire_config_t const &expire_config)
108+
void expire_tiles_t::from_polygon_boundary(geom::multipolygon_t const &geom,
109+
expire_config_t const &expire_config)
110110
{
111111
for (auto const &sgeom : geom) {
112112
from_polygon_boundary(sgeom, expire_config);
113113
}
114114
}
115115

116-
void expire_tiles::from_geometry(geom::multipolygon_t const &geom,
117-
expire_config_t const &expire_config)
116+
void expire_tiles_t::from_geometry(geom::multipolygon_t const &geom,
117+
expire_config_t const &expire_config)
118118
{
119119
if (expire_config.mode == expire_mode::boundary_only) {
120120
from_polygon_boundary(geom, expire_config);
@@ -130,14 +130,14 @@ void expire_tiles::from_geometry(geom::multipolygon_t const &geom,
130130

131131
// False positive: Apparently clang-tidy can not see through the visit()
132132
// NOLINTNEXTLINE(readability-convert-member-functions-to-static)
133-
void expire_tiles::from_geometry(geom::geometry_t const &geom,
134-
expire_config_t const &expire_config)
133+
void expire_tiles_t::from_geometry(geom::geometry_t const &geom,
134+
expire_config_t const &expire_config)
135135
{
136136
geom.visit([&](auto const &g) { from_geometry(g, expire_config); });
137137
}
138138

139-
void expire_tiles::from_geometry_if_3857(geom::geometry_t const &geom,
140-
expire_config_t const &expire_config)
139+
void expire_tiles_t::from_geometry_if_3857(geom::geometry_t const &geom,
140+
expire_config_t const &expire_config)
141141
{
142142
if (geom.srid() == PROJ_SPHERE_MERC) {
143143
from_geometry(geom, expire_config);
@@ -147,9 +147,9 @@ void expire_tiles::from_geometry_if_3857(geom::geometry_t const &geom,
147147
/*
148148
* Expire tiles that a line crosses
149149
*/
150-
void expire_tiles::from_line_segment(geom::point_t const &a,
151-
geom::point_t const &b,
152-
expire_config_t const &expire_config)
150+
void expire_tiles_t::from_line_segment(geom::point_t const &a,
151+
geom::point_t const &b,
152+
expire_config_t const &expire_config)
153153
{
154154
auto tilec_a = coords_to_tile(a);
155155
auto tilec_b = coords_to_tile(b);
@@ -207,8 +207,8 @@ void expire_tiles::from_line_segment(geom::point_t const &a,
207207
/*
208208
* Expire tiles within a bounding box
209209
*/
210-
int expire_tiles::from_bbox(geom::box_t const &box,
211-
expire_config_t const &expire_config)
210+
int expire_tiles_t::from_bbox(geom::box_t const &box,
211+
expire_config_t const &expire_config)
212212
{
213213
if (!enabled()) {
214214
return 0;
@@ -257,7 +257,7 @@ int expire_tiles::from_bbox(geom::box_t const &box,
257257
return 0;
258258
}
259259

260-
quadkey_list_t expire_tiles::get_tiles()
260+
quadkey_list_t expire_tiles_t::get_tiles()
261261
{
262262
quadkey_list_t tiles;
263263
tiles.reserve(m_dirty_tiles.size());
@@ -267,7 +267,7 @@ quadkey_list_t expire_tiles::get_tiles()
267267
return tiles;
268268
}
269269

270-
void expire_tiles::merge_and_destroy(expire_tiles *other)
270+
void expire_tiles_t::merge_and_destroy(expire_tiles_t *other)
271271
{
272272
if (m_map_width != other->m_map_width) {
273273
throw fmt_error("Unable to merge tile expiry sets when "
@@ -285,7 +285,7 @@ void expire_tiles::merge_and_destroy(expire_tiles *other)
285285
}
286286
}
287287

288-
int expire_from_result(expire_tiles *expire, pg_result_t const &result,
288+
int expire_from_result(expire_tiles_t *expire, pg_result_t const &result,
289289
expire_config_t const &expire_config)
290290
{
291291
auto const num_tuples = result.num_tuples();

src/expire-tiles.hpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,13 @@
2525
#include "pgsql.hpp"
2626
#include "tile.hpp"
2727

28-
class reprojection;
28+
class reprojection_t;
2929

30-
class expire_tiles
30+
class expire_tiles_t
3131
{
3232
public:
33-
expire_tiles(uint32_t max_zoom, std::shared_ptr<reprojection> projection);
33+
expire_tiles_t(uint32_t max_zoom,
34+
std::shared_ptr<reprojection_t> projection);
3435

3536
bool empty() const noexcept { return m_dirty_tiles.empty(); }
3637

@@ -76,7 +77,7 @@ class expire_tiles
7677
int from_bbox(geom::box_t const &box, expire_config_t const &expire_config);
7778

7879
/**
79-
* Get tiles as a vector of quadkeys and remove them from the expire_tiles
80+
* Get tiles as a vector of quadkeys and remove them from the expire_tiles_t
8081
* object.
8182
*/
8283
quadkey_list_t get_tiles();
@@ -85,7 +86,7 @@ class expire_tiles
8586
* Merge the list of expired tiles in the other object into this
8687
* object, destroying the list in the other object.
8788
*/
88-
void merge_and_destroy(expire_tiles *other);
89+
void merge_and_destroy(expire_tiles_t *other);
8990

9091
private:
9192
/**
@@ -115,12 +116,12 @@ class expire_tiles
115116
/// The tile which has been added last to the unordered set.
116117
tile_t m_prev_tile;
117118

118-
std::shared_ptr<reprojection> m_projection;
119+
std::shared_ptr<reprojection_t> m_projection;
119120

120121
uint32_t m_maxzoom;
121122
int m_map_width;
122123

123-
}; // class expire_tiles
124+
}; // class expire_tiles_t
124125

125126
/**
126127
* Expire tiles based on an osm id.
@@ -132,7 +133,7 @@ class expire_tiles
132133
* \param expire_config Configuration for expiry.
133134
* \return The number of tuples in the result or -1 if expire is disabled.
134135
*/
135-
int expire_from_result(expire_tiles *expire, pg_result_t const &result,
136+
int expire_from_result(expire_tiles_t *expire, pg_result_t const &result,
136137
expire_config_t const &expire_config);
137138

138139
#endif // OSM2PGSQL_EXPIRE_TILES_HPP

src/flex-table-column.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ void flex_table_column_t::add_expire(expire_config_t const &config)
203203
}
204204

205205
void flex_table_column_t::do_expire(geom::geometry_t const &geom,
206-
std::vector<expire_tiles> *expire) const
206+
std::vector<expire_tiles_t> *expire) const
207207
{
208208
assert(expire);
209209
for (auto const &expire_config : m_expires) {

src/flex-table-column.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ class flex_table_column_t
132132
}
133133

134134
void do_expire(geom::geometry_t const &geom,
135-
std::vector<expire_tiles> *expire) const;
135+
std::vector<expire_tiles_t> *expire) const;
136136

137137
private:
138138
std::vector<expire_config_t> m_expires;

src/flex-table.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ class table_connection_t
278278
public:
279279
table_connection_t(flex_table_t *table,
280280
std::shared_ptr<db_copy_thread_t> const &copy_thread)
281-
: m_proj(reprojection::create_projection(table->srid())), m_table(table),
281+
: m_proj(reprojection_t::create_projection(table->srid())), m_table(table),
282282
m_target(std::make_shared<db_target_descr_t>(
283283
table->schema(), table->name(), table->id_column_names(),
284284
table->build_sql_column_list())),
@@ -314,7 +314,7 @@ class table_connection_t
314314

315315
void delete_rows_with(osmium::item_type type, osmid_t id);
316316

317-
reprojection const &proj() const noexcept
317+
reprojection_t const &proj() const noexcept
318318
{
319319
assert(m_proj);
320320
return *m_proj;
@@ -335,7 +335,7 @@ class table_connection_t
335335
}
336336

337337
private:
338-
std::shared_ptr<reprojection> m_proj;
338+
std::shared_ptr<reprojection_t> m_proj;
339339

340340
flex_table_t *m_table;
341341

src/flex-write.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ void write_null(db_copy_mgr_t<db_deleter_by_type_and_id_t> *copy_mgr,
3939
flex_table_column_t const &column)
4040
{
4141
if (column.not_null()) {
42-
throw not_null_exception{
42+
throw not_null_exception_t{
4343
fmt::format("Can not add NULL to column '{}' declared NOT NULL.",
4444
column.name()),
4545
&column};
@@ -258,7 +258,7 @@ bool is_compatible(geom::geometry_t const &geom,
258258
void flex_write_column(lua_State *lua_state,
259259
db_copy_mgr_t<db_deleter_by_type_and_id_t> *copy_mgr,
260260
flex_table_column_t const &column,
261-
std::vector<expire_tiles> *expire)
261+
std::vector<expire_tiles_t> *expire)
262262
{
263263
lua_getfield(lua_state, -1, column.name().c_str());
264264
int const ltype = lua_type(lua_state, -1);

src/flex-write.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@
1818
#include <string>
1919
#include <vector>
2020

21-
class expire_tiles;
21+
class expire_tiles_t;
2222

23-
class not_null_exception : public std::runtime_error
23+
class not_null_exception_t : public std::runtime_error
2424
{
2525
public:
26-
not_null_exception(std::string const &message,
26+
not_null_exception_t(std::string const &message,
2727
flex_table_column_t const *column)
2828
: std::runtime_error(message), m_column(column)
2929
{}
@@ -32,11 +32,11 @@ class not_null_exception : public std::runtime_error
3232

3333
private:
3434
flex_table_column_t const *m_column;
35-
}; // class not_null_exception
35+
}; // class not_null_exception_t
3636

3737
void flex_write_column(lua_State *lua_state,
3838
db_copy_mgr_t<db_deleter_by_type_and_id_t> *copy_mgr,
3939
flex_table_column_t const &column,
40-
std::vector<expire_tiles> *expire);
40+
std::vector<expire_tiles_t> *expire);
4141

4242
#endif // OSM2PGSQL_FLEX_WRITE_HPP

src/gen/gen-rivers.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,8 @@ SELECT "{id_column}", "{width_column}", "{name_column}", "{geom_column}"
345345
geom::geometry_t const geom{std::move(edge.points), PROJ_SPHERE_MERC};
346346
auto const wkb = geom_to_ewkb(geom);
347347
connection().exec_prepared("ins", edge.id, edge.width,
348-
get_name(names, edge.id), binary_param(wkb));
348+
get_name(names, edge.id),
349+
binary_param_t(wkb));
349350
}
350351
connection().exec("COMMIT");
351352
timer(m_timer_write).stop();

src/gen/gen-tile-raster.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ void gen_tile_raster_union_t::process(tile_t const &tile)
237237
timer(m_timer_write).start();
238238
for (auto const &geom : geometries) {
239239
auto const wkb = geom_to_ewkb(geom);
240-
connection().exec_prepared("insert_geoms", binary_param{wkb},
240+
connection().exec_prepared("insert_geoms", binary_param_t{wkb},
241241
tile.x(), tile.y(), param);
242242
}
243243
timer(m_timer_write).stop();

0 commit comments

Comments
 (0)