Skip to content

Commit 76d34ae

Browse files
authored
Merge pull request #2400 from joto/lua-wrapper-class-suffix
Add _t suffix to various Lua wrapper classes
2 parents 9aaf629 + 010c717 commit 76d34ae

8 files changed

+42
-42
lines changed

src/flex-lua-expire-output.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ int setup_flex_expire_output(lua_State *lua_state,
9797
/**
9898
* Define the osm2pgsql.ExpireOutput class/metatable.
9999
*/
100-
void lua_wrapper_expire_output::init(lua_State *lua_state)
100+
void lua_wrapper_expire_output_t::init(lua_State *lua_state)
101101
{
102102
luaX_set_up_metatable(
103103
lua_state, "ExpireOutput", OSM2PGSQL_EXPIRE_OUTPUT_CLASS,
@@ -109,7 +109,7 @@ void lua_wrapper_expire_output::init(lua_State *lua_state)
109109
{"table", lua_trampoline_expire_output_table}});
110110
}
111111

112-
int lua_wrapper_expire_output::tostring() const
112+
int lua_wrapper_expire_output_t::tostring() const
113113
{
114114
std::string const str =
115115
fmt::format("osm2pgsql.ExpireOutput[minzoom={},maxzoom={},filename={},"
@@ -121,31 +121,31 @@ int lua_wrapper_expire_output::tostring() const
121121
return 1;
122122
}
123123

124-
int lua_wrapper_expire_output::filename() const noexcept
124+
int lua_wrapper_expire_output_t::filename() const noexcept
125125
{
126126
luaX_pushstring(lua_state(), self().filename());
127127
return 1;
128128
}
129129

130-
int lua_wrapper_expire_output::maxzoom() const noexcept
130+
int lua_wrapper_expire_output_t::maxzoom() const noexcept
131131
{
132132
lua_pushinteger(lua_state(), self().maxzoom());
133133
return 1;
134134
}
135135

136-
int lua_wrapper_expire_output::minzoom() const noexcept
136+
int lua_wrapper_expire_output_t::minzoom() const noexcept
137137
{
138138
lua_pushinteger(lua_state(), self().minzoom());
139139
return 1;
140140
}
141141

142-
int lua_wrapper_expire_output::schema() const noexcept
142+
int lua_wrapper_expire_output_t::schema() const noexcept
143143
{
144144
luaX_pushstring(lua_state(), self().schema());
145145
return 1;
146146
}
147147

148-
int lua_wrapper_expire_output::table() const noexcept
148+
int lua_wrapper_expire_output_t::table() const noexcept
149149
{
150150
luaX_pushstring(lua_state(), self().table());
151151
return 1;

src/flex-lua-expire-output.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ int setup_flex_expire_output(lua_State *lua_state,
2525
std::string const &default_schema,
2626
std::vector<expire_output_t> *expire_outputs);
2727

28-
class lua_wrapper_expire_output : public lua_wrapper_base<expire_output_t>
28+
class lua_wrapper_expire_output_t : public lua_wrapper_base_t<expire_output_t>
2929
{
3030
public:
3131
static void init(lua_State *lua_state);
3232

33-
lua_wrapper_expire_output(lua_State *lua_state,
34-
expire_output_t *expire_output)
35-
: lua_wrapper_base(lua_state, expire_output)
33+
lua_wrapper_expire_output_t(lua_State *lua_state,
34+
expire_output_t *expire_output)
35+
: lua_wrapper_base_t(lua_state, expire_output)
3636
{
3737
}
3838

@@ -43,6 +43,6 @@ class lua_wrapper_expire_output : public lua_wrapper_base<expire_output_t>
4343
int schema() const noexcept;
4444
int table() const noexcept;
4545

46-
}; // class lua_wrapper_expire_output
46+
}; // class lua_wrapper_expire_output_t
4747

4848
#endif // OSM2PGSQL_FLEX_LUA_EXPIRE_OUTPUT_HPP

src/flex-lua-locator.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ TRAMPOLINE_WRAPPED_OBJECT(locator, first_intersecting)
4545

4646
} // anonymous namespace
4747

48-
connection_params_t lua_wrapper_locator::s_connection_params;
48+
connection_params_t lua_wrapper_locator_t::s_connection_params;
4949

5050
int setup_flex_locator(lua_State *lua_state, std::vector<locator_t> *locators)
5151
{
@@ -65,8 +65,8 @@ int setup_flex_locator(lua_State *lua_state, std::vector<locator_t> *locators)
6565
return 1;
6666
}
6767

68-
void lua_wrapper_locator::init(lua_State *lua_state,
69-
connection_params_t const &connection_params)
68+
void lua_wrapper_locator_t::init(lua_State *lua_state,
69+
connection_params_t const &connection_params)
7070
{
7171
s_connection_params = connection_params;
7272

@@ -80,21 +80,21 @@ void lua_wrapper_locator::init(lua_State *lua_state,
8080
{"first_intersecting", lua_trampoline_locator_first_intersecting}});
8181
}
8282

83-
int lua_wrapper_locator::tostring() const
83+
int lua_wrapper_locator_t::tostring() const
8484
{
8585
std::string const str{fmt::format("osm2pgsql.Locator[name={},size={}]",
8686
self().name(), self().size())};
8787
luaX_pushstring(lua_state(), str);
8888
return 1;
8989
}
9090

91-
int lua_wrapper_locator::name() const noexcept
91+
int lua_wrapper_locator_t::name() const noexcept
9292
{
9393
luaX_pushstring(lua_state(), self().name());
9494
return 1;
9595
}
9696

97-
int lua_wrapper_locator::add_bbox()
97+
int lua_wrapper_locator_t::add_bbox()
9898
{
9999
if (lua_gettop(lua_state()) < 5) {
100100
throw fmt_error("Need locator, name and 4 coordinates as arguments");
@@ -111,7 +111,7 @@ int lua_wrapper_locator::add_bbox()
111111
return 0;
112112
}
113113

114-
int lua_wrapper_locator::add_from_db()
114+
int lua_wrapper_locator_t::add_from_db()
115115
{
116116
if (lua_gettop(lua_state()) < 1) {
117117
throw fmt_error("Need locator and SQL query arguments");
@@ -125,7 +125,7 @@ int lua_wrapper_locator::add_from_db()
125125
return 0;
126126
}
127127

128-
int lua_wrapper_locator::all_intersecting()
128+
int lua_wrapper_locator_t::all_intersecting()
129129
{
130130
if (lua_gettop(lua_state()) < 1) {
131131
throw fmt_error("Need locator and geometry arguments");
@@ -149,7 +149,7 @@ int lua_wrapper_locator::all_intersecting()
149149
return 1;
150150
}
151151

152-
int lua_wrapper_locator::first_intersecting()
152+
int lua_wrapper_locator_t::first_intersecting()
153153
{
154154
if (lua_gettop(lua_state()) < 1) {
155155
throw fmt_error("Need locator and geometry arguments");

src/flex-lua-locator.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ static char const *const OSM2PGSQL_LOCATOR_CLASS = "osm2pgsql.Locator";
2727

2828
int setup_flex_locator(lua_State *lua_state, std::vector<locator_t> *locators);
2929

30-
class lua_wrapper_locator : public lua_wrapper_base<locator_t>
30+
class lua_wrapper_locator_t : public lua_wrapper_base_t<locator_t>
3131
{
3232
public:
3333
static void init(lua_State *lua_state,
3434
connection_params_t const &connection_params);
3535

36-
lua_wrapper_locator(lua_State *lua_state, locator_t *locator)
37-
: lua_wrapper_base(lua_state, locator)
36+
lua_wrapper_locator_t(lua_State *lua_state, locator_t *locator)
37+
: lua_wrapper_base_t(lua_state, locator)
3838
{
3939
}
4040

@@ -48,6 +48,6 @@ class lua_wrapper_locator : public lua_wrapper_base<locator_t>
4848
private:
4949
static connection_params_t s_connection_params;
5050

51-
}; // class lua_wrapper_locator
51+
}; // class lua_wrapper_locator_t
5252

5353
#endif // OSM2PGSQL_FLEX_LUA_LOCATOR_HPP

src/flex-lua-table.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ int setup_flex_table(lua_State *lua_state, std::vector<flex_table_t> *tables,
454454
/**
455455
* Define the osm2pgsql.Table class/metatable.
456456
*/
457-
void lua_wrapper_table::init(lua_State *lua_state)
457+
void lua_wrapper_table_t::init(lua_State *lua_state)
458458
{
459459
luaX_set_up_metatable(lua_state, "Table", OSM2PGSQL_TABLE_CLASS,
460460
{{"__tostring", lua_trampoline_table_tostring},
@@ -465,21 +465,21 @@ void lua_wrapper_table::init(lua_State *lua_state)
465465
{"columns", lua_trampoline_table_columns}});
466466
}
467467

468-
int lua_wrapper_table::tostring() const
468+
int lua_wrapper_table_t::tostring() const
469469
{
470470
std::string const str{fmt::format("osm2pgsql.Table[{}]", self().name())};
471471
luaX_pushstring(lua_state(), str);
472472

473473
return 1;
474474
}
475475

476-
int lua_wrapper_table::cluster() const noexcept
476+
int lua_wrapper_table_t::cluster() const noexcept
477477
{
478478
lua_pushboolean(lua_state(), self().cluster_by_geom());
479479
return 1;
480480
}
481481

482-
int lua_wrapper_table::columns() const
482+
int lua_wrapper_table_t::columns() const
483483
{
484484
lua_createtable(lua_state(), (int)self().num_columns(), 0);
485485

@@ -502,13 +502,13 @@ int lua_wrapper_table::columns() const
502502
return 1;
503503
}
504504

505-
int lua_wrapper_table::name() const noexcept
505+
int lua_wrapper_table_t::name() const noexcept
506506
{
507507
luaX_pushstring(lua_state(), self().name());
508508
return 1;
509509
}
510510

511-
int lua_wrapper_table::schema() const noexcept
511+
int lua_wrapper_table_t::schema() const noexcept
512512
{
513513
luaX_pushstring(lua_state(), self().schema());
514514
return 1;

src/flex-lua-table.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ int setup_flex_table(lua_State *lua_state, std::vector<flex_table_t> *tables,
2626
std::string const &default_schema, bool updatable,
2727
bool append_mode);
2828

29-
class lua_wrapper_table : public lua_wrapper_base<flex_table_t>
29+
class lua_wrapper_table_t : public lua_wrapper_base_t<flex_table_t>
3030
{
3131
public:
3232
static void init(lua_State *lua_state);
3333

34-
lua_wrapper_table(lua_State *lua_state, flex_table_t *table)
35-
: lua_wrapper_base(lua_state, table)
34+
lua_wrapper_table_t(lua_State *lua_state, flex_table_t *table)
35+
: lua_wrapper_base_t(lua_state, table)
3636
{
3737
}
3838

@@ -42,6 +42,6 @@ class lua_wrapper_table : public lua_wrapper_base<flex_table_t>
4242
int name() const noexcept;
4343
int schema() const noexcept;
4444

45-
}; // class lua_wrapper_table
45+
}; // class lua_wrapper_table_t
4646

4747
#endif // OSM2PGSQL_FLEX_LUA_TABLE_HPP

src/flex-lua-wrapper.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
auto *flex = \
2424
static_cast<output_flex_t *>(luaX_get_context(lua_state)); \
2525
auto &obj = flex->get_##obj_name##_from_param(); \
26-
return lua_wrapper_##obj_name{lua_state, &obj}.func_name(); \
26+
return lua_wrapper_##obj_name##_t{lua_state, &obj}.func_name(); \
2727
} catch (std::exception const &e) { \
2828
return luaL_error(lua_state, "Error in '" #func_name "': %s\n", \
2929
e.what()); \
@@ -39,10 +39,10 @@ struct lua_State;
3939
* Helper class for wrapping C++ classes in Lua "classes".
4040
*/
4141
template <typename WRAPPED>
42-
class lua_wrapper_base
42+
class lua_wrapper_base_t
4343
{
4444
public:
45-
lua_wrapper_base(lua_State *lua_state, WRAPPED *wrapped)
45+
lua_wrapper_base_t(lua_State *lua_state, WRAPPED *wrapped)
4646
: m_lua_state(lua_state), m_self(wrapped)
4747
{
4848
assert(lua_state);
@@ -59,6 +59,6 @@ class lua_wrapper_base
5959
lua_State *m_lua_state;
6060
WRAPPED *m_self;
6161

62-
}; // class lua_wrapper_base;
62+
}; // class lua_wrapper_base_t
6363

6464
#endif // OSM2PGSQL_FLEX_LUA_WRAPPER_HPP

src/output-flex.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1306,9 +1306,9 @@ void output_flex_t::init_lua(std::string const &filename,
13061306
luaX_add_table_func(lua_state(), "define_expire_output",
13071307
lua_trampoline_app_define_expire_output);
13081308

1309-
lua_wrapper_expire_output::init(lua_state());
1310-
lua_wrapper_locator::init(lua_state(), get_options()->connection_params);
1311-
lua_wrapper_table::init(lua_state());
1309+
lua_wrapper_expire_output_t::init(lua_state());
1310+
lua_wrapper_locator_t::init(lua_state(), get_options()->connection_params);
1311+
lua_wrapper_table_t::init(lua_state());
13121312

13131313
// Clean up stack
13141314
lua_settop(lua_state(), 0);

0 commit comments

Comments
 (0)