@@ -84,14 +84,7 @@ class flex_table_t
8484
8585 void set_id_type (osmium::item_type type) noexcept { m_id_type = type; }
8686
87- bool has_id_column () const noexcept
88- {
89- if (m_columns.empty ()) {
90- return false ;
91- }
92- return (m_columns[0 ].type () == table_column_type::id_type) ||
93- (m_columns[0 ].type () == table_column_type::id_num);
94- }
87+ bool has_id_column () const noexcept ;
9588
9689 std::size_t num_columns () const noexcept { return m_columns.size (); }
9790
@@ -110,13 +103,7 @@ class flex_table_t
110103 return m_geom_column != std::numeric_limits<std::size_t >::max ();
111104 }
112105
113- bool has_hstore_column () const noexcept
114- {
115- auto const it = std::find_if (begin (), end (), [&](auto const &column) {
116- return column.type () == table_column_type::hstore;
117- });
118- return it != end ();
119- }
106+ bool has_hstore_column () const noexcept ;
120107
121108 // / Get the (first, if there are multiple) geometry column.
122109 flex_table_column_t const &geom_column () const noexcept
@@ -140,55 +127,10 @@ class flex_table_t
140127 std::string build_sql_create_id_index () const ;
141128
142129 // / Does this table take objects of the specified type?
143- bool matches_type (osmium::item_type type) const noexcept
144- {
145- // This table takes any type -> okay
146- if (m_id_type == osmium::item_type::undefined) {
147- return true ;
148- }
149-
150- // Type and table type match -> okay
151- if (type == m_id_type) {
152- return true ;
153- }
154-
155- // Relations can be written as linestrings into way tables -> okay
156- if (type == osmium::item_type::relation &&
157- m_id_type == osmium::item_type::way) {
158- return true ;
159- }
160-
161- // Area tables can take ways or relations, but not nodes
162- return m_id_type == osmium::item_type::area &&
163- type != osmium::item_type::node;
164- }
130+ bool matches_type (osmium::item_type type) const noexcept ;
165131
166132 // / Map way/node/relation ID to id value used in database table column
167- osmid_t map_id (osmium::item_type type, osmid_t id) const noexcept
168- {
169- if (m_id_type == osmium::item_type::undefined) {
170- if (has_multicolumn_id_index ()) {
171- return id;
172- }
173-
174- switch (type) {
175- case osmium::item_type::node:
176- return id;
177- case osmium::item_type::way:
178- return -id;
179- case osmium::item_type::relation:
180- return -id - 100000000000000000LL ;
181- default :
182- assert (false );
183- }
184- }
185-
186- if (m_id_type != osmium::item_type::relation &&
187- type == osmium::item_type::relation) {
188- return -id;
189- }
190- return id;
191- }
133+ osmid_t map_id (osmium::item_type type, osmid_t id) const noexcept ;
192134
193135 flex_table_column_t &add_column (std::string const &name,
194136 std::string const &type,
0 commit comments