update pre-commit and format sources

This commit is contained in:
Mathis Logemann 2024-04-19 20:56:21 +02:00
parent 7ef431ece2
commit ab626ac052
39 changed files with 280 additions and 412 deletions

View file

@ -2,7 +2,7 @@
# See https://pre-commit.com/hooks.html for more hooks # See https://pre-commit.com/hooks.html for more hooks
repos: repos:
- repo: https://github.com/pre-commit/pre-commit-hooks - repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0 rev: v4.6.0
hooks: hooks:
- id: trailing-whitespace - id: trailing-whitespace
files: ^.*\.cmake|CMakeLists\.txt$ files: ^.*\.cmake|CMakeLists\.txt$
@ -10,7 +10,7 @@ repos:
files: ^.*\.cmake|CMakeLists\.txt$ files: ^.*\.cmake|CMakeLists\.txt$
- repo: https://github.com/pre-commit/mirrors-clang-format - repo: https://github.com/pre-commit/mirrors-clang-format
rev: v14.0.6 rev: v18.1.3
hooks: hooks:
- id: clang-format - id: clang-format
types_or: [c++, c] types_or: [c++, c]

View file

@ -38,7 +38,7 @@
// mapnik // mapnik
#ifndef Q_MOC_RUN // QT moc chokes on BOOST_JOIN #ifndef Q_MOC_RUN // QT moc chokes on BOOST_JOIN
//#include <mapnik/config_error.hpp> // #include <mapnik/config_error.hpp>
#include <mapnik/load_map.hpp> #include <mapnik/load_map.hpp>
#include <mapnik/save_map.hpp> #include <mapnik/save_map.hpp>
#include <mapnik/projection.hpp> #include <mapnik/projection.hpp>

View file

@ -96,10 +96,7 @@ class MAPNIK_DECL logger : public singleton<logger, CreateStatic>,
} }
// format // format
static std::string const& get_format() static std::string const& get_format() { return format_; }
{
return format_;
}
static void set_format(std::string const& format) static void set_format(std::string const& format)
{ {
@ -211,10 +208,7 @@ class base_log : public util::noncopyable
private: private:
#ifdef MAPNIK_LOG #ifdef MAPNIK_LOG
inline bool check_severity() inline bool check_severity() { return Severity >= logger::get_object_severity(object_name_); }
{
return Severity >= logger::get_object_severity(object_name_);
}
typename output_policy::stream_buffer streambuf_; typename output_policy::stream_buffer streambuf_;
std::string object_name_; std::string object_name_;

View file

@ -134,13 +134,13 @@ struct MAPNIK_DECL enumeration
std::map<enum_class, std::string> fnc_name##_lookup() \ std::map<enum_class, std::string> fnc_name##_lookup() \
{ \ { \
std::map<enum_class, std::string> val_map; \ std::map<enum_class, std::string> val_map; \
std::transform( \ std::transform(fnc_name##_map.begin(), \
fnc_name##_map.begin(), \ fnc_name##_map.end(), \
fnc_name##_map.end(), \ std::inserter(val_map, val_map.end()), \
std::inserter(val_map, val_map.end()), \ [](const mapnik::detail::EnumStringT<enum_class>& val) { \
[](const mapnik::detail::EnumStringT<enum_class>& val) { \ return std::pair<enum_class, std::string>{std::get<0>(val), \
return std::pair<enum_class, std::string>{std::get<0>(val), std::string{std::get<1>(val).data()}}; \ std::string{std::get<1>(val).data()}}; \
}); \ }); \
return val_map; \ return val_map; \
} }

View file

@ -28,7 +28,7 @@
#include <mapnik/value/types.hpp> #include <mapnik/value/types.hpp>
// boost // boost
//#include <boost/pool/pool_alloc.hpp> // #include <boost/pool/pool_alloc.hpp>
namespace mapnik { namespace mapnik {
struct feature_factory struct feature_factory

View file

@ -152,10 +152,7 @@ class hextree : private util::noncopyable
~hextree() {} ~hextree() {}
void setMaxColors(unsigned max_colors) void setMaxColors(unsigned max_colors) { max_colors_ = max_colors; }
{
max_colors_ = max_colors;
}
void setGamma(double g) void setGamma(double g)
{ {
@ -166,15 +163,9 @@ class hextree : private util::noncopyable
} }
} }
void setTransMode(unsigned t) void setTransMode(unsigned t) { trans_mode_ = t; }
{
trans_mode_ = t;
}
transparency_mode_t getTransMode() const transparency_mode_t getTransMode() const { return trans_mode_; }
{
return trans_mode_;
}
// process alpha value based on trans_mode_ // process alpha value based on trans_mode_
std::uint8_t preprocessAlpha(std::uint8_t a) const std::uint8_t preprocessAlpha(std::uint8_t a) const

View file

@ -561,15 +561,13 @@ struct offset_converter
if (bulge_steps == 0) if (bulge_steps == 0)
{ {
// inside turn (sharp/obtuse angle) // inside turn (sharp/obtuse angle)
MAPNIK_LOG_DEBUG(ctrans) << "offset_converter:" MAPNIK_LOG_DEBUG(ctrans) << "offset_converter:" << " Sharp joint [<< inside turn "
<< " Sharp joint [<< inside turn "
<< static_cast<int>(util::degrees(joint_angle)) << " degrees >>]"; << static_cast<int>(util::degrees(joint_angle)) << " degrees >>]";
} }
else else
{ {
// outside turn (reflex angle) // outside turn (reflex angle)
MAPNIK_LOG_DEBUG(ctrans) << "offset_converter:" MAPNIK_LOG_DEBUG(ctrans) << "offset_converter:" << " Bulge joint >)) outside turn "
<< " Bulge joint >)) outside turn "
<< static_cast<int>(util::degrees(joint_angle)) << " degrees ((< with " << static_cast<int>(util::degrees(joint_angle)) << " degrees ((< with "
<< bulge_steps << " segments"; << bulge_steps << " segments";
} }
@ -640,10 +638,7 @@ struct offset_converter
return cur_.cmd; return cur_.cmd;
} }
void push_vertex(vertex2d const& v) void push_vertex(vertex2d const& v) { vertices_.push_back(v); }
{
vertices_.push_back(v);
}
Geometry& geom_; Geometry& geom_;
double offset_; double offset_;

View file

@ -46,7 +46,7 @@ MAPNIK_DISABLE_WARNING_POP
#include <vector> #include <vector>
#include <tuple> #include <tuple>
#define U2RED(x) ((x)&0xff) #define U2RED(x) ((x) & 0xff)
#define U2GREEN(x) (((x) >> 8) & 0xff) #define U2GREEN(x) (((x) >> 8) & 0xff)
#define U2BLUE(x) (((x) >> 16) & 0xff) #define U2BLUE(x) (((x) >> 16) & 0xff)
#define U2ALPHA(x) (((x) >> 24) & 0xff) #define U2ALPHA(x) (((x) >> 24) & 0xff)

View file

@ -75,18 +75,18 @@ class MAPNIK_DECL parameters : public param_map
#ifdef _MSC_VER #ifdef _MSC_VER
template MAPNIK_DECL std::optional<std::string> parameters::get(std::string const& key) const; template MAPNIK_DECL std::optional<std::string> parameters::get(std::string const& key) const;
template MAPNIK_DECL std::optional<std::string> parameters::get(std::string const& key, template MAPNIK_DECL std::optional<std::string> parameters::get(std::string const& key,
std::string const& default_opt_value) const; std::string const& default_opt_value) const;
template MAPNIK_DECL std::optional<value_double> parameters::get(std::string const& key) const; template MAPNIK_DECL std::optional<value_double> parameters::get(std::string const& key) const;
template MAPNIK_DECL std::optional<value_double> parameters::get(std::string const& key, template MAPNIK_DECL std::optional<value_double> parameters::get(std::string const& key,
value_double const& default_opt_value) const; value_double const& default_opt_value) const;
template MAPNIK_DECL std::optional<value_integer> parameters::get(std::string const& key) const; template MAPNIK_DECL std::optional<value_integer> parameters::get(std::string const& key) const;
template MAPNIK_DECL std::optional<value_integer> parameters::get(std::string const& key, template MAPNIK_DECL std::optional<value_integer> parameters::get(std::string const& key,
value_integer const& default_opt_value) const; value_integer const& default_opt_value) const;
template MAPNIK_DECL std::optional<value_bool> parameters::get(std::string const& key) const; template MAPNIK_DECL std::optional<value_bool> parameters::get(std::string const& key) const;
template MAPNIK_DECL std::optional<value_bool> parameters::get(std::string const& key, template MAPNIK_DECL std::optional<value_bool> parameters::get(std::string const& key,
value_bool const& default_opt_value) const; value_bool const& default_opt_value) const;
template MAPNIK_DECL std::optional<mapnik::boolean_type> parameters::get(std::string const& key) const; template MAPNIK_DECL std::optional<mapnik::boolean_type> parameters::get(std::string const& key) const;
template MAPNIK_DECL std::optional<mapnik::boolean_type> template MAPNIK_DECL std::optional<mapnik::boolean_type>

View file

@ -72,10 +72,7 @@ struct extract_value<value_bool>
return std::nullopt; return std::nullopt;
} }
static inline std::optional<value_bool> do_extract_from_bool(value_bool const& source) static inline std::optional<value_bool> do_extract_from_bool(value_bool const& source) { return source; }
{
return source;
}
}; };
template<> template<>

View file

@ -26,7 +26,7 @@
#include <emmintrin.h> #include <emmintrin.h>
#include <xmmintrin.h> #include <xmmintrin.h>
#define ROUND_DOWN(x, s) ((x) & ~((s)-1)) #define ROUND_DOWN(x, s) ((x) & ~((s) - 1))
typedef union { typedef union {
__m128i v; __m128i v;

View file

@ -613,15 +613,9 @@ class renderer_agg : util::noncopyable
} }
#endif #endif
inline VertexSource& source() const inline VertexSource& source() const { return source_; }
{
return source_;
}
inline group const& svg_group() const inline group const& svg_group() const { return svg_group_; }
{
return svg_group_;
}
private: private:

View file

@ -464,8 +464,7 @@ struct set_symbolizer_property_impl<Symbolizer, T, true>
const auto [result_value, is_evaluated] = pre_evaluate_expression<value>(*val); const auto [result_value, is_evaluated] = pre_evaluate_expression<value>(*val);
if (is_evaluated) if (is_evaluated)
{ {
const auto enum_val2 = const auto enum_val2 = detail::enum_traits<value_type>::from_string(result_value.to_string());
detail::enum_traits<value_type>::from_string(result_value.to_string());
if (enum_val2) if (enum_val2)
{ {
put(sym, key, *enum_val); put(sym, key, *enum_val);

View file

@ -60,25 +60,13 @@ class file : public util::noncopyable
} }
} }
inline bool is_open() const inline bool is_open() const { return file_ ? true : false; }
{
return file_ ? true : false;
}
explicit operator bool() const explicit operator bool() const { return this->is_open(); }
{
return this->is_open();
}
inline std::FILE* get() const inline std::FILE* get() const { return file_.get(); }
{
return file_.get();
}
inline std::size_t size() const inline std::size_t size() const { return size_; }
{
return size_;
}
inline data_type data() const inline data_type data() const
{ {

View file

@ -77,10 +77,7 @@ class singleton
singleton(const singleton& rhs); singleton(const singleton& rhs);
singleton& operator=(const singleton&); singleton& operator=(const singleton&);
static void onDeadReference() static void onDeadReference() { throw std::runtime_error("dead reference!"); }
{
throw std::runtime_error("dead reference!");
}
static void DestroySingleton() static void DestroySingleton()
{ {

View file

@ -37,6 +37,6 @@
#define MAPNIK_VERSION_AT_LEAST(major, minor, patch) (MAPNIK_VERSION >= MAPNIK_VERSION_ENCODE(major, minor, patch)) #define MAPNIK_VERSION_AT_LEAST(major, minor, patch) (MAPNIK_VERSION >= MAPNIK_VERSION_ENCODE(major, minor, patch))
#define MAPNIK_VERSION_ENCODE(major, minor, patch) ((major)*100000 + (minor)*100 + (patch)) #define MAPNIK_VERSION_ENCODE(major, minor, patch) ((major) * 100000 + (minor) * 100 + (patch))
#endif // MAPNIK_VERSION_HPP #endif // MAPNIK_VERSION_HPP

View file

@ -47,7 +47,6 @@ MAPNIK_DISABLE_WARNING_POP
#include <iosfwd> #include <iosfwd>
#include <string> #include <string>
template<std::size_t Max, std::size_t Min> template<std::size_t Max, std::size_t Min>
struct csv_linear : boost::geometry::index::linear<Max, Min> struct csv_linear : boost::geometry::index::linear<Max, Min>
{}; {};

View file

@ -404,8 +404,8 @@ struct geobuf : util::noncopyable
} }
template<typename T> template<typename T>
geometry::multi_line_string<double> geometry::multi_line_string<double> read_multi_linestring(T& reader,
read_multi_linestring(T& reader, std::optional<std::vector<std::uint32_t>> const& lengths) std::optional<std::vector<std::uint32_t>> const& lengths)
{ {
geometry::multi_line_string<double> multi_line; geometry::multi_line_string<double> multi_line;
multi_line.reserve(!lengths ? 1 : lengths->size()); multi_line.reserve(!lengths ? 1 : lengths->size());

View file

@ -139,20 +139,11 @@ class ogr_layer_ptr
#endif #endif
} }
std::string const& layer_name() const std::string const& layer_name() const { return layer_name_; }
{
return layer_name_;
}
OGRLayer* layer() const OGRLayer* layer() const { return layer_; }
{
return layer_;
}
bool is_valid() const bool is_valid() const { return is_valid_; }
{
return is_valid_;
}
private: private:

View file

@ -160,10 +160,10 @@ typedef enum {
#define BANDTYPE_FLAG_RESERVED3 (1 << 4) #define BANDTYPE_FLAG_RESERVED3 (1 << 4)
#define BANDTYPE_PIXTYPE_MASK 0x0F #define BANDTYPE_PIXTYPE_MASK 0x0F
#define BANDTYPE_PIXTYPE(x) ((x)&BANDTYPE_PIXTYPE_MASK) #define BANDTYPE_PIXTYPE(x) ((x) & BANDTYPE_PIXTYPE_MASK)
#define BANDTYPE_IS_OFFDB(x) ((x)&BANDTYPE_FLAG_OFFDB) #define BANDTYPE_IS_OFFDB(x) ((x) & BANDTYPE_FLAG_OFFDB)
#define BANDTYPE_HAS_NODATA(x) ((x)&BANDTYPE_FLAG_HASNODATA) #define BANDTYPE_HAS_NODATA(x) ((x) & BANDTYPE_FLAG_HASNODATA)
#define BANDTYPE_IS_NODATA(x) ((x)&BANDTYPE_FLAG_ISNODATA) #define BANDTYPE_IS_NODATA(x) ((x) & BANDTYPE_FLAG_ISNODATA)
} // namespace } // namespace

View file

@ -236,20 +236,11 @@ class Connection
return std::make_shared<ResultSet>(result); return std::make_shared<ResultSet>(result);
} }
std::string client_encoding() const std::string client_encoding() const { return PQparameterStatus(conn_, "client_encoding"); }
{
return PQparameterStatus(conn_, "client_encoding");
}
bool isOK() const bool isOK() const { return (!closed_) && (PQstatus(conn_) != CONNECTION_BAD); }
{
return (!closed_) && (PQstatus(conn_) != CONNECTION_BAD);
}
bool isPending() const bool isPending() const { return pending_; }
{
return pending_;
}
void close() void close()
{ {

View file

@ -171,30 +171,15 @@ class shape_file : public mapnik::util::mapped_memory_file
file_.read(reinterpret_cast<char*>(&envelope), sizeof(envelope)); file_.read(reinterpret_cast<char*>(&envelope), sizeof(envelope));
} }
inline void rewind() inline void rewind() { seek(100); }
{
seek(100);
}
inline void seek(std::streampos pos) inline void seek(std::streampos pos) { file_.seekg(pos, std::ios::beg); }
{
file_.seekg(pos, std::ios::beg);
}
inline std::streampos pos() inline std::streampos pos() { return file_.tellg(); }
{
return file_.tellg();
}
inline bool is_eof() inline bool is_eof() { return file_.eof(); }
{
return file_.eof();
}
inline bool is_good() inline bool is_good() { return file_.good(); }
{
return file_.good();
}
}; };
#endif // SHAPEFILE_HPP #endif // SHAPEFILE_HPP

View file

@ -115,8 +115,7 @@ class sqlite_connection
s << "'" << sqlite3_errmsg(db_) << "'"; s << "'" << sqlite3_errmsg(db_) << "'";
else else
s << "unknown error, lost connection"; s << "unknown error, lost connection";
s << " (" << file_ << ")" s << " (" << file_ << ")" << "\nFull sql was: '" << sql << "'";
<< "\nFull sql was: '" << sql << "'";
throw mapnik::datasource_exception(s.str()); throw mapnik::datasource_exception(s.str());
} }
@ -160,10 +159,7 @@ class sqlite_connection
return rc; return rc;
} }
sqlite3* operator*() sqlite3* operator*() { return db_; }
{
return db_;
}
bool load_extension(std::string const& ext_path) bool load_extension(std::string const& ext_path)
{ {

View file

@ -260,9 +260,8 @@ sqlite_datasource::sqlite_datasource(parameters const& params)
if (geometry_field_.empty()) if (geometry_field_.empty())
{ {
std::ostringstream s; std::ostringstream s;
s << "Sqlite Plugin: unable to detect the column " s << "Sqlite Plugin: unable to detect the column " << "containing a valid geometry on table '"
<< "containing a valid geometry on table '" << geometry_table_ << "'. " << geometry_table_ << "'. " << "Please provide a column name by passing the 'geometry_field' option "
<< "Please provide a column name by passing the 'geometry_field' option "
<< "or indicate a different spatial table to use by passing the 'geometry_table' option"; << "or indicate a different spatial table to use by passing the 'geometry_table' option";
throw datasource_exception(s.str()); throw datasource_exception(s.str());
} }
@ -316,12 +315,9 @@ sqlite_datasource::sqlite_datasource(parameters const& params)
else else
{ {
std::ostringstream s; std::ostringstream s;
s << "Sqlite Plugin: could not generate spatial index" s << "Sqlite Plugin: could not generate spatial index" << " for table '" << geometry_table_ << "'"
<< " for table '" << geometry_table_ << "'" << " as no primary key can be detected." << " You should either declare an INTEGER PRIMARY KEY"
<< " as no primary key can be detected." << " or set the 'key_field' option to force a" << " given field to be used as the primary key";
<< " You should either declare an INTEGER PRIMARY KEY"
<< " or set the 'key_field' option to force a"
<< " given field to be used as the primary key";
throw datasource_exception(s.str()); throw datasource_exception(s.str());
} }
} }

View file

@ -144,6 +144,7 @@ class sqlite_utils
static void get_tables(std::shared_ptr<sqlite_connection> ds, std::vector<std::string>& tables) static void get_tables(std::shared_ptr<sqlite_connection> ds, std::vector<std::string>& tables)
{ {
std::ostringstream sql; std::ostringstream sql;
// clang-format off
// todo handle finding tables from attached db's // todo handle finding tables from attached db's
sql << " SELECT name FROM sqlite_master" sql << " SELECT name FROM sqlite_master"
<< " WHERE type IN ('table','view')" << " WHERE type IN ('table','view')"
@ -155,6 +156,7 @@ class sqlite_utils
<< " SELECT name FROM sqlite_temp_master" << " SELECT name FROM sqlite_temp_master"
<< " WHERE type IN ('table','view')" << " WHERE type IN ('table','view')"
<< " ORDER BY 1"; << " ORDER BY 1";
// clang-format on
sqlite3_stmt* stmt = 0; sqlite3_stmt* stmt = 0;
const int rc = sqlite3_prepare_v2(*(*ds), sql.str().c_str(), -1, &stmt, 0); const int rc = sqlite3_prepare_v2(*(*ds), sql.str().c_str(), -1, &stmt, 0);
if (rc == SQLITE_OK) if (rc == SQLITE_OK)
@ -352,8 +354,7 @@ class sqlite_utils
{ {
std::ostringstream error_msg; std::ostringstream error_msg;
error_msg << "Sqlite Plugin: invalid type for key field '" << rs->column_name(1) error_msg << "Sqlite Plugin: invalid type for key field '" << rs->column_name(1)
<< "' when creating index " << "' when creating index " << "type was: " << type_oid << "";
<< "type was: " << type_oid << "";
throw mapnik::datasource_exception(error_msg.str()); throw mapnik::datasource_exception(error_msg.str());
} }
const sqlite_int64 pkid = rs->column_integer64(1); const sqlite_int64 pkid = rs->column_integer64(1);

View file

@ -61,13 +61,12 @@ std::atomic<logger::severity_type> logger::severity_level_
bool logger::severity_env_check_{true}; bool logger::severity_env_check_{true};
bool logger::format_env_check_{true}; bool logger::format_env_check_{true};
logger::severity_type logger::severity_level_ logger::severity_type logger::severity_level_{
{
#endif #endif
#if MAPNIK_DEFAULT_LOG_SEVERITY == 0 #if MAPNIK_DEFAULT_LOG_SEVERITY == 0
logger::debug logger::debug
#elif MAPNIK_DEFAULT_LOG_SEVERITY == 1 #elif MAPNIK_DEFAULT_LOG_SEVERITY == 1
logger::warn logger::warn
#elif MAPNIK_DEFAULT_LOG_SEVERITY == 2 #elif MAPNIK_DEFAULT_LOG_SEVERITY == 2
logger::error logger::error
#elif MAPNIK_DEFAULT_LOG_SEVERITY == 3 #elif MAPNIK_DEFAULT_LOG_SEVERITY == 3

View file

@ -215,8 +215,8 @@ struct grid_render_marker_visitor
0.0, 0.0,
0.0, 0.0,
1.0, 1.0,
std::nullopt); // TODO: is 1.0 a valid default here, and do we even care in grid_renderer std::nullopt); // TODO: is 1.0 a valid default here, and do we even care in
// what the image looks like? // grid_renderer what the image looks like?
pixmap_.set_rectangle(feature_.id(), pixmap_.set_rectangle(feature_.id(),
target, target,
boost::math::iround(pos_.x - cx), boost::math::iround(pos_.x - cx),

View file

@ -555,8 +555,7 @@ void Map::zoom_all()
else else
{ {
std::ostringstream s; std::ostringstream s;
s << "could not zoom to combined layer extents " s << "could not zoom to combined layer extents " << "using zoom_all because proj4 could not "
<< "using zoom_all because proj4 could not "
<< "back project any layer extents into the map srs " << "back project any layer extents into the map srs "
<< "(set map 'maximum-extent' to override layer extents)"; << "(set map 'maximum-extent' to override layer extents)";
throw std::runtime_error(s.str()); throw std::runtime_error(s.str());

View file

@ -29,25 +29,24 @@
namespace mapnik { namespace mapnik {
template std::optional<std::string> parameters::get(std::string const& key) const; template std::optional<std::string> parameters::get(std::string const& key) const;
template std::optional<std::string> parameters::get(std::string const& key, template std::optional<std::string> parameters::get(std::string const& key, std::string const& default_opt_value) const;
std::string const& default_opt_value) const;
template std::optional<value_double> parameters::get(std::string const& key) const; template std::optional<value_double> parameters::get(std::string const& key) const;
template std::optional<value_double> parameters::get(std::string const& key, template std::optional<value_double> parameters::get(std::string const& key,
value_double const& default_opt_value) const; value_double const& default_opt_value) const;
template std::optional<value_bool> parameters::get(std::string const& key) const; template std::optional<value_bool> parameters::get(std::string const& key) const;
template std::optional<value_bool> parameters::get(std::string const& key, value_bool const& default_opt_value) const; template std::optional<value_bool> parameters::get(std::string const& key, value_bool const& default_opt_value) const;
template std::optional<boolean_type> parameters::get(std::string const& key) const; template std::optional<boolean_type> parameters::get(std::string const& key) const;
template std::optional<boolean_type> parameters::get(std::string const& key, template std::optional<boolean_type> parameters::get(std::string const& key,
boolean_type const& default_opt_value) const; boolean_type const& default_opt_value) const;
template std::optional<value_null> parameters::get(std::string const& key) const; template std::optional<value_null> parameters::get(std::string const& key) const;
template std::optional<value_null> parameters::get(std::string const& key, value_null const& default_opt_value) const; template std::optional<value_null> parameters::get(std::string const& key, value_null const& default_opt_value) const;
template std::optional<value_integer> parameters::get(std::string const& key) const; template std::optional<value_integer> parameters::get(std::string const& key) const;
template std::optional<value_integer> parameters::get(std::string const& key, template std::optional<value_integer> parameters::get(std::string const& key,
value_integer const& default_opt_value) const; value_integer const& default_opt_value) const;
} // namespace mapnik } // namespace mapnik

View file

@ -492,14 +492,14 @@ std::string proj_transform::definition() const
} }
else else
#endif #endif
if (wgs84_to_merc_) if (wgs84_to_merc_)
{ {
return "wgs84 => merc"; return "wgs84 => merc";
} }
else if (merc_to_wgs84_) else if (merc_to_wgs84_)
{ {
return "merc => wgs84"; return "merc => wgs84";
} }
return "unknown"; return "unknown";
} }

View file

@ -61,8 +61,8 @@ MAPNIK_DISABLE_WARNING_POP
#include <optional> #include <optional>
namespace mapnik { namespace mapnik {
using std::optional;
using boost::property_tree::ptree; using boost::property_tree::ptree;
using std::optional;
void serialize_text_placements(ptree& node, text_placements_ptr const& p, bool explicit_defaults) void serialize_text_placements(ptree& node, text_placements_ptr const& p, bool explicit_defaults)
{ {

View file

@ -95,49 +95,19 @@ class tiff_reader : public image_reader
unsigned width() const final; unsigned width() const final;
unsigned height() const final; unsigned height() const final;
std::optional<box2d<double>> bounding_box() const final; std::optional<box2d<double>> bounding_box() const final;
inline bool has_alpha() const final inline bool has_alpha() const final { return has_alpha_; }
{
return has_alpha_;
}
void read(unsigned x, unsigned y, image_rgba8& image) final; void read(unsigned x, unsigned y, image_rgba8& image) final;
image_any read(unsigned x, unsigned y, unsigned width, unsigned height) final; image_any read(unsigned x, unsigned y, unsigned width, unsigned height) final;
// methods specific to tiff reader // methods specific to tiff reader
unsigned bits_per_sample() const unsigned bits_per_sample() const { return bps_; }
{ unsigned sample_format() const { return sample_format_; }
return bps_; unsigned photometric() const { return photometric_; }
} bool is_tiled() const { return is_tiled_; }
unsigned sample_format() const unsigned tile_width() const { return tile_width_; }
{ unsigned tile_height() const { return tile_height_; }
return sample_format_; unsigned rows_per_strip() const { return rows_per_strip_; }
} unsigned planar_config() const { return planar_config_; }
unsigned photometric() const unsigned compression() const { return compression_; }
{
return photometric_;
}
bool is_tiled() const
{
return is_tiled_;
}
unsigned tile_width() const
{
return tile_width_;
}
unsigned tile_height() const
{
return tile_height_;
}
unsigned rows_per_strip() const
{
return rows_per_strip_;
}
unsigned planar_config() const
{
return planar_config_;
}
unsigned compression() const
{
return compression_;
}
private: private:
tiff_reader(const tiff_reader&); tiff_reader(const tiff_reader&);
@ -720,7 +690,8 @@ void tiff_reader<T>::read_stripped(std::size_t x0, std::size_t y0, ImageData& im
const std::size_t tx1{std::min(width + x0, width_)}; const std::size_t tx1{std::min(width + x0, width_)};
std::size_t row = 0; std::size_t row = 0;
const bool pick_first_band = (bands_ > 1) && (strip_size / (width_ * rows_per_strip_ * sizeof(pixel_type)) == bands_); const bool pick_first_band =
(bands_ > 1) && (strip_size / (width_ * rows_per_strip_ * sizeof(pixel_type)) == bands_);
for (std::size_t y = start_y; y < end_y; y += rows_per_strip_) for (std::size_t y = start_y; y < end_y; y += rows_per_strip_)
{ {
const std::size_t ty0 = std::max(y0, y) - y; const std::size_t ty0 = std::max(y0, y) - y;

View file

@ -58,7 +58,10 @@ struct name_trait
template<> \ template<> \
struct name_trait<type> \ struct name_trait<type> \
{ \ { \
static std::string name() { return std::string("type ") + type_name; } \ static std::string name() \
{ \
return std::string("type ") + type_name; \
} \
}; };
DEFINE_NAME_TRAIT(double, "double") DEFINE_NAME_TRAIT(double, "double")

View file

@ -809,7 +809,7 @@ constexpr auto operator"" _catch_sr(char const* rawChars, std::size_t size) noex
struct TypeList \ struct TypeList \
{}; \ {}; \
template<typename... Ts> \ template<typename... Ts> \
constexpr auto get_wrapper() noexcept->TypeList<Ts...> \ constexpr auto get_wrapper() noexcept -> TypeList<Ts...> \
{ \ { \
return {}; \ return {}; \
} \ } \
@ -817,7 +817,7 @@ constexpr auto operator"" _catch_sr(char const* rawChars, std::size_t size) noex
struct TemplateTypeList \ struct TemplateTypeList \
{}; \ {}; \
template<template<typename...> class... Cs> \ template<template<typename...> class... Cs> \
constexpr auto get_wrapper() noexcept->TemplateTypeList<Cs...> \ constexpr auto get_wrapper() noexcept -> TemplateTypeList<Cs...> \
{ \ { \
return {}; \ return {}; \
} \ } \
@ -883,7 +883,7 @@ constexpr auto operator"" _catch_sr(char const* rawChars, std::size_t size) noex
struct Nttp \ struct Nttp \
{}; \ {}; \
template<INTERNAL_CATCH_REMOVE_PARENS(signature)> \ template<INTERNAL_CATCH_REMOVE_PARENS(signature)> \
constexpr auto get_wrapper() noexcept->Nttp<__VA_ARGS__> \ constexpr auto get_wrapper() noexcept -> Nttp<__VA_ARGS__> \
{ \ { \
return {}; \ return {}; \
} \ } \
@ -891,7 +891,7 @@ constexpr auto operator"" _catch_sr(char const* rawChars, std::size_t size) noex
struct NttpTemplateTypeList \ struct NttpTemplateTypeList \
{}; \ {}; \
template<template<INTERNAL_CATCH_REMOVE_PARENS(signature)> class... Cs> \ template<template<INTERNAL_CATCH_REMOVE_PARENS(signature)> class... Cs> \
constexpr auto get_wrapper() noexcept->NttpTemplateTypeList<Cs...> \ constexpr auto get_wrapper() noexcept -> NttpTemplateTypeList<Cs...> \
{ \ { \
return {}; \ return {}; \
} \ } \
@ -1351,9 +1351,8 @@ struct AutoReg : NonCopyable
Signature, \ Signature, \
...) \ ...) \
namespace { \ namespace { \
namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName) \ namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName) { \
{ \ INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD(TestName, ClassName, INTERNAL_CATCH_REMOVE_PARENS(Signature)); \
INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD(TestName, ClassName, INTERNAL_CATCH_REMOVE_PARENS(Signature)); \
} \ } \
} \ } \
INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD(TestName, INTERNAL_CATCH_REMOVE_PARENS(Signature)) INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD(TestName, INTERNAL_CATCH_REMOVE_PARENS(Signature))
@ -1508,29 +1507,27 @@ struct AutoReg : NonCopyable
CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \ CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \
INTERNAL_CATCH_DECLARE_SIG_TEST(TestFunc, INTERNAL_CATCH_REMOVE_PARENS(Signature)); \ INTERNAL_CATCH_DECLARE_SIG_TEST(TestFunc, INTERNAL_CATCH_REMOVE_PARENS(Signature)); \
namespace { \ namespace { \
namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName) \ namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName) { \
INTERNAL_CATCH_TYPE_GEN \
INTERNAL_CATCH_NTTP_GEN(INTERNAL_CATCH_REMOVE_PARENS(Signature)) \
INTERNAL_CATCH_NTTP_REG_GEN(TestFunc, INTERNAL_CATCH_REMOVE_PARENS(Signature)) \
template<typename... Types> \
struct TestName \
{ \ { \
INTERNAL_CATCH_TYPE_GEN \ TestName() \
INTERNAL_CATCH_NTTP_GEN(INTERNAL_CATCH_REMOVE_PARENS(Signature)) \
INTERNAL_CATCH_NTTP_REG_GEN(TestFunc, INTERNAL_CATCH_REMOVE_PARENS(Signature)) \
template<typename... Types> \
struct TestName \
{ \ { \
TestName() \ int index = 0; \
{ \ constexpr char const* tmpl_types[] = { \
int index = 0; \ CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, __VA_ARGS__)}; \
constexpr char const* tmpl_types[] = { \ using expander = int[]; \
CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, __VA_ARGS__)}; \ (void)expander{(reg_test(Types{}, Catch::NameAndTags{Name " - " + std::string(tmpl_types[index]), Tags}), \
using expander = int[]; \ index++)...}; /* NOLINT */ \
(void)expander{ \ } \
(reg_test(Types{}, Catch::NameAndTags{Name " - " + std::string(tmpl_types[index]), Tags}), \ }; \
index++)...}; /* NOLINT */ \ static int INTERNAL_CATCH_UNIQUE_NAME(globalRegistrar) = []() { \
} \ TestName<INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(__VA_ARGS__)>(); \
}; \ return 0; \
static int INTERNAL_CATCH_UNIQUE_NAME(globalRegistrar) = []() { \ }(); \
TestName<INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(__VA_ARGS__)>(); \
return 0; \
}(); \
} \ } \
} \ } \
CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \ CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \
@ -1590,41 +1587,40 @@ struct AutoReg : NonCopyable
template<typename TestType> \ template<typename TestType> \
static void TestFuncName(); \ static void TestFuncName(); \
namespace { \ namespace { \
namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName) \ namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName) { \
INTERNAL_CATCH_TYPE_GEN \
INTERNAL_CATCH_NTTP_GEN(INTERNAL_CATCH_REMOVE_PARENS(Signature)) \
template<typename... Types> \
struct TestName \
{ \ { \
INTERNAL_CATCH_TYPE_GEN \ void reg_tests() \
INTERNAL_CATCH_NTTP_GEN(INTERNAL_CATCH_REMOVE_PARENS(Signature)) \
template<typename... Types> \
struct TestName \
{ \ { \
void reg_tests() \ int index = 0; \
{ \ using expander = int[]; \
int index = 0; \ constexpr char const* tmpl_types[] = { \
using expander = int[]; \ CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TmplTypes))}; \
constexpr char const* tmpl_types[] = { \ constexpr char const* types_list[] = { \
CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TmplTypes))}; \ CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TypesList))}; \
constexpr char const* types_list[] = { \ constexpr auto num_types = sizeof(types_list) / sizeof(types_list[0]); \
CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TypesList))}; \ (void)expander{ \
constexpr auto num_types = sizeof(types_list) / sizeof(types_list[0]); \ (Catch::AutoReg(Catch::makeTestInvoker(&TestFuncName<Types>), \
(void)expander{ \ CATCH_INTERNAL_LINEINFO, \
(Catch::AutoReg(Catch::makeTestInvoker(&TestFuncName<Types>), \ Catch::StringRef(), \
CATCH_INTERNAL_LINEINFO, \ Catch::NameAndTags{Name " - " + std::string(tmpl_types[index / num_types]) + "<" + \
Catch::StringRef(), \ std::string(types_list[index % num_types]) + ">", \
Catch::NameAndTags{Name " - " + std::string(tmpl_types[index / num_types]) + "<" + \ Tags}), \
std::string(types_list[index % num_types]) + ">", \ index++)...}; /* NOLINT */ \
Tags}), \ } \
index++)...}; /* NOLINT */ \ }; \
} \ static int INTERNAL_CATCH_UNIQUE_NAME(globalRegistrar) = []() { \
}; \ using TestInit = typename create< \
static int INTERNAL_CATCH_UNIQUE_NAME(globalRegistrar) = []() { \ TestName, \
using TestInit = typename create< \ decltype(get_wrapper<INTERNAL_CATCH_REMOVE_PARENS(TmplTypes)>()), \
TestName, \ TypeList<INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(INTERNAL_CATCH_REMOVE_PARENS(TypesList))>>::type; \
decltype(get_wrapper<INTERNAL_CATCH_REMOVE_PARENS(TmplTypes)>()), \ TestInit t; \
TypeList<INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(INTERNAL_CATCH_REMOVE_PARENS(TypesList))>>::type; \ t.reg_tests(); \
TestInit t; \ return 0; \
t.reg_tests(); \ }(); \
return 0; \
}(); \
} \ } \
} \ } \
CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \ CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \
@ -1678,32 +1674,31 @@ struct AutoReg : NonCopyable
template<typename TestType> \ template<typename TestType> \
static void TestFunc(); \ static void TestFunc(); \
namespace { \ namespace { \
namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName) \ namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName) { \
INTERNAL_CATCH_TYPE_GEN \
template<typename... Types> \
struct TestName \
{ \ { \
INTERNAL_CATCH_TYPE_GEN \ void reg_tests() \
template<typename... Types> \
struct TestName \
{ \ { \
void reg_tests() \ int index = 0; \
{ \ using expander = int[]; \
int index = 0; \ (void)expander{ \
using expander = int[]; \ (Catch::AutoReg(Catch::makeTestInvoker(&TestFunc<Types>), \
(void)expander{ \ CATCH_INTERNAL_LINEINFO, \
(Catch::AutoReg(Catch::makeTestInvoker(&TestFunc<Types>), \ Catch::StringRef(), \
CATCH_INTERNAL_LINEINFO, \ Catch::NameAndTags{Name " - " + std::string(INTERNAL_CATCH_STRINGIZE(TmplList)) + \
Catch::StringRef(), \ " - " + std::to_string(index), \
Catch::NameAndTags{Name " - " + std::string(INTERNAL_CATCH_STRINGIZE(TmplList)) + \ Tags}), \
" - " + std::to_string(index), \ index++)...}; /* NOLINT */ \
Tags}), \ } \
index++)...}; /* NOLINT */ \ }; \
} \ static int INTERNAL_CATCH_UNIQUE_NAME(globalRegistrar) = []() { \
}; \ using TestInit = typename convert<TestName, TmplList>::type; \
static int INTERNAL_CATCH_UNIQUE_NAME(globalRegistrar) = []() { \ TestInit t; \
using TestInit = typename convert<TestName, TmplList>::type; \ t.reg_tests(); \
TestInit t; \ return 0; \
t.reg_tests(); \ }(); \
return 0; \
}(); \
} \ } \
} \ } \
CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \ CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \
@ -1724,31 +1719,29 @@ struct AutoReg : NonCopyable
CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \ CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \
CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \ CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \
namespace { \ namespace { \
namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName) \ namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName) { \
INTERNAL_CATCH_TYPE_GEN \
INTERNAL_CATCH_NTTP_GEN(INTERNAL_CATCH_REMOVE_PARENS(Signature)) \
INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD(TestName, ClassName, INTERNAL_CATCH_REMOVE_PARENS(Signature)); \
INTERNAL_CATCH_NTTP_REG_METHOD_GEN(TestName, INTERNAL_CATCH_REMOVE_PARENS(Signature)) \
template<typename... Types> \
struct TestNameClass \
{ \ { \
INTERNAL_CATCH_TYPE_GEN \ TestNameClass() \
INTERNAL_CATCH_NTTP_GEN(INTERNAL_CATCH_REMOVE_PARENS(Signature)) \
INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD(TestName, ClassName, INTERNAL_CATCH_REMOVE_PARENS(Signature)); \
INTERNAL_CATCH_NTTP_REG_METHOD_GEN(TestName, INTERNAL_CATCH_REMOVE_PARENS(Signature)) \
template<typename... Types> \
struct TestNameClass \
{ \ { \
TestNameClass() \ int index = 0; \
{ \ constexpr char const* tmpl_types[] = { \
int index = 0; \ CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, __VA_ARGS__)}; \
constexpr char const* tmpl_types[] = { \ using expander = int[]; \
CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, __VA_ARGS__)}; \ (void)expander{ \
using expander = int[]; \ (reg_test(Types{}, #ClassName, Catch::NameAndTags{Name " - " + std::string(tmpl_types[index]), Tags}), \
(void)expander{(reg_test(Types{}, \ index++)...}; /* NOLINT */ \
#ClassName, \ } \
Catch::NameAndTags{Name " - " + std::string(tmpl_types[index]), Tags}), \ }; \
index++)...}; /* NOLINT */ \ static int INTERNAL_CATCH_UNIQUE_NAME(globalRegistrar) = []() { \
} \ TestNameClass<INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(__VA_ARGS__)>(); \
}; \ return 0; \
static int INTERNAL_CATCH_UNIQUE_NAME(globalRegistrar) = []() { \ }(); \
TestNameClass<INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(__VA_ARGS__)>(); \
return 0; \
}(); \
} \ } \
} \ } \
CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \ CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \
@ -1816,41 +1809,40 @@ struct AutoReg : NonCopyable
void test(); \ void test(); \
}; \ }; \
namespace { \ namespace { \
namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestNameClass) \ namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestNameClass) { \
INTERNAL_CATCH_TYPE_GEN \
INTERNAL_CATCH_NTTP_GEN(INTERNAL_CATCH_REMOVE_PARENS(Signature)) \
template<typename... Types> \
struct TestNameClass \
{ \ { \
INTERNAL_CATCH_TYPE_GEN \ void reg_tests() \
INTERNAL_CATCH_NTTP_GEN(INTERNAL_CATCH_REMOVE_PARENS(Signature)) \
template<typename... Types> \
struct TestNameClass \
{ \ { \
void reg_tests() \ int index = 0; \
{ \ using expander = int[]; \
int index = 0; \ constexpr char const* tmpl_types[] = { \
using expander = int[]; \ CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TmplTypes))}; \
constexpr char const* tmpl_types[] = { \ constexpr char const* types_list[] = { \
CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TmplTypes))}; \ CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TypesList))}; \
constexpr char const* types_list[] = { \ constexpr auto num_types = sizeof(types_list) / sizeof(types_list[0]); \
CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TypesList))}; \ (void)expander{ \
constexpr auto num_types = sizeof(types_list) / sizeof(types_list[0]); \ (Catch::AutoReg(Catch::makeTestInvoker(&TestName<Types>::test), \
(void)expander{ \ CATCH_INTERNAL_LINEINFO, \
(Catch::AutoReg(Catch::makeTestInvoker(&TestName<Types>::test), \ #ClassName, \
CATCH_INTERNAL_LINEINFO, \ Catch::NameAndTags{Name " - " + std::string(tmpl_types[index / num_types]) + "<" + \
#ClassName, \ std::string(types_list[index % num_types]) + ">", \
Catch::NameAndTags{Name " - " + std::string(tmpl_types[index / num_types]) + "<" + \ Tags}), \
std::string(types_list[index % num_types]) + ">", \ index++)...}; /* NOLINT */ \
Tags}), \ } \
index++)...}; /* NOLINT */ \ }; \
} \ static int INTERNAL_CATCH_UNIQUE_NAME(globalRegistrar) = []() { \
}; \ using TestInit = typename create< \
static int INTERNAL_CATCH_UNIQUE_NAME(globalRegistrar) = []() { \ TestNameClass, \
using TestInit = typename create< \ decltype(get_wrapper<INTERNAL_CATCH_REMOVE_PARENS(TmplTypes)>()), \
TestNameClass, \ TypeList<INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(INTERNAL_CATCH_REMOVE_PARENS(TypesList))>>::type; \
decltype(get_wrapper<INTERNAL_CATCH_REMOVE_PARENS(TmplTypes)>()), \ TestInit t; \
TypeList<INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(INTERNAL_CATCH_REMOVE_PARENS(TypesList))>>::type; \ t.reg_tests(); \
TestInit t; \ return 0; \
t.reg_tests(); \ }(); \
return 0; \
}(); \
} \ } \
} \ } \
CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \ CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \
@ -1911,32 +1903,31 @@ struct AutoReg : NonCopyable
void test(); \ void test(); \
}; \ }; \
namespace { \ namespace { \
namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName) \ namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName) { \
INTERNAL_CATCH_TYPE_GEN \
template<typename... Types> \
struct TestNameClass \
{ \ { \
INTERNAL_CATCH_TYPE_GEN \ void reg_tests() \
template<typename... Types> \
struct TestNameClass \
{ \ { \
void reg_tests() \ int index = 0; \
{ \ using expander = int[]; \
int index = 0; \ (void)expander{ \
using expander = int[]; \ (Catch::AutoReg(Catch::makeTestInvoker(&TestName<Types>::test), \
(void)expander{ \ CATCH_INTERNAL_LINEINFO, \
(Catch::AutoReg(Catch::makeTestInvoker(&TestName<Types>::test), \ #ClassName, \
CATCH_INTERNAL_LINEINFO, \ Catch::NameAndTags{Name " - " + std::string(INTERNAL_CATCH_STRINGIZE(TmplList)) + \
#ClassName, \ " - " + std::to_string(index), \
Catch::NameAndTags{Name " - " + std::string(INTERNAL_CATCH_STRINGIZE(TmplList)) + \ Tags}), \
" - " + std::to_string(index), \ index++)...}; /* NOLINT */ \
Tags}), \ } \
index++)...}; /* NOLINT */ \ }; \
} \ static int INTERNAL_CATCH_UNIQUE_NAME(globalRegistrar) = []() { \
}; \ using TestInit = typename convert<TestNameClass, TmplList>::type; \
static int INTERNAL_CATCH_UNIQUE_NAME(globalRegistrar) = []() { \ TestInit t; \
using TestInit = typename convert<TestNameClass, TmplList>::type; \ t.reg_tests(); \
TestInit t; \ return 0; \
t.reg_tests(); \ }(); \
return 0; \
}(); \
} \ } \
} \ } \
CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \ CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \
@ -3217,8 +3208,8 @@ struct IResultCapture
virtual void sectionEnded(SectionEndInfo const& endInfo) = 0; virtual void sectionEnded(SectionEndInfo const& endInfo) = 0;
virtual void sectionEndedEarly(SectionEndInfo const& endInfo) = 0; virtual void sectionEndedEarly(SectionEndInfo const& endInfo) = 0;
virtual auto acquireGeneratorTracker(StringRef generatorName, SourceLineInfo const& lineInfo) virtual auto acquireGeneratorTracker(StringRef generatorName,
-> IGeneratorTracker& = 0; SourceLineInfo const& lineInfo) -> IGeneratorTracker& = 0;
#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING) #if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)
virtual void benchmarkPreparing(std::string const& name) = 0; virtual void benchmarkPreparing(std::string const& name) = 0;
@ -4693,8 +4684,9 @@ using StringMatcher = Matchers::Impl::MatcherBase<std::string>;
void handleExceptionMatchExpr(AssertionHandler& handler, StringMatcher const& matcher, StringRef const& matcherString); void handleExceptionMatchExpr(AssertionHandler& handler, StringMatcher const& matcher, StringRef const& matcherString);
template<typename ArgT, typename MatcherT> template<typename ArgT, typename MatcherT>
auto makeMatchExpr(ArgT const& arg, MatcherT const& matcher, StringRef const& matcherString) auto makeMatchExpr(ArgT const& arg,
-> MatchExpr<ArgT, MatcherT> MatcherT const& matcher,
StringRef const& matcherString) -> MatchExpr<ArgT, MatcherT>
{ {
return MatchExpr<ArgT, MatcherT>(arg, matcher, matcherString); return MatchExpr<ArgT, MatcherT>(arg, matcher, matcherString);
} }
@ -5010,8 +5002,9 @@ template<typename L>
// Note: The type after -> is weird, because VS2015 cannot parse // Note: The type after -> is weird, because VS2015 cannot parse
// the expression used in the typedef inside, when it is in // the expression used in the typedef inside, when it is in
// return type. Yeah. // return type. Yeah.
auto generate(StringRef generatorName, SourceLineInfo const& lineInfo, L const& generatorExpression) auto generate(StringRef generatorName,
-> decltype(std::declval<decltype(generatorExpression())>().get()) SourceLineInfo const& lineInfo,
L const& generatorExpression) -> decltype(std::declval<decltype(generatorExpression())>().get())
{ {
using UnderlyingType = typename decltype(generatorExpression())::type; using UnderlyingType = typename decltype(generatorExpression())::type;
@ -5376,10 +5369,10 @@ class Option
: nullableValue(nullptr) : nullableValue(nullptr)
{} {}
Option(T const& _value) Option(T const& _value)
: nullableValue(new (storage) T(_value)) : nullableValue(new(storage) T(_value))
{} {}
Option(Option const& _other) Option(Option const& _other)
: nullableValue(_other ? new (storage) T(*_other) : nullptr) : nullableValue(_other ? new(storage) T(*_other) : nullptr)
{} {}
~Option() { reset(); } ~Option() { reset(); }
@ -9283,8 +9276,8 @@ class RunContext : public IResultCapture,
void sectionEnded(SectionEndInfo const& endInfo) override; void sectionEnded(SectionEndInfo const& endInfo) override;
void sectionEndedEarly(SectionEndInfo const& endInfo) override; void sectionEndedEarly(SectionEndInfo const& endInfo) override;
auto acquireGeneratorTracker(StringRef generatorName, SourceLineInfo const& lineInfo) auto acquireGeneratorTracker(StringRef generatorName,
-> IGeneratorTracker& override; SourceLineInfo const& lineInfo) -> IGeneratorTracker& override;
#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING) #if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)
void benchmarkPreparing(std::string const& name) override; void benchmarkPreparing(std::string const& name) override;
@ -10840,7 +10833,7 @@ struct Help : Opt
return ParserResult::ok(ParseResultType::ShortCircuitAll); return ParserResult::ok(ParseResultType::ShortCircuitAll);
}) })
{ {
static_cast<Opt&> (*this)("display usage information")["-?"]["-h"]["--help"].optional(); static_cast<Opt&>(*this)("display usage information")["-?"]["-h"]["--help"].optional();
} }
}; };
@ -12362,8 +12355,7 @@ FatalConditionHandler::FatalConditionHandler()
{ {
// We do not want to fully error out, because needing // We do not want to fully error out, because needing
// the stack reserve should be rare enough anyway. // the stack reserve should be rare enough anyway.
Catch::cerr() << "Failed to reserve piece of stack." Catch::cerr() << "Failed to reserve piece of stack." << " Stack overflows will not be reported successfully.";
<< " Stack overflows will not be reported successfully.";
} }
} }
@ -14191,10 +14183,7 @@ class RegistryHub : public IRegistryHub,
CATCH_INTERNAL_ERROR("Attempted to register active exception under CATCH_CONFIG_DISABLE_EXCEPTIONS!"); CATCH_INTERNAL_ERROR("Attempted to register active exception under CATCH_CONFIG_DISABLE_EXCEPTIONS!");
#endif #endif
} }
IMutableEnumValuesRegistry& getMutableEnumValuesRegistry() override IMutableEnumValuesRegistry& getMutableEnumValuesRegistry() override { return m_enumValuesRegistry; }
{
return m_enumValuesRegistry;
}
private: private:
TestRegistry m_testCaseRegistry; TestRegistry m_testCaseRegistry;
@ -15241,12 +15230,9 @@ void Session::showHelp() const
} }
void Session::libIdentify() void Session::libIdentify()
{ {
Catch::cout() << std::left << std::setw(16) << "description: " Catch::cout() << std::left << std::setw(16) << "description: " << "A Catch2 test executable\n"
<< "A Catch2 test executable\n" << std::left << std::setw(16) << "category: " << "testframework\n"
<< std::left << std::setw(16) << "category: " << std::left << std::setw(16) << "framework: " << "Catch Test\n"
<< "testframework\n"
<< std::left << std::setw(16) << "framework: "
<< "Catch Test\n"
<< std::left << std::setw(16) << "version: " << libraryVersion() << std::endl; << std::left << std::setw(16) << "version: " << libraryVersion() << std::endl;
} }
@ -19364,8 +19350,7 @@ void JunitReporter::writeAssertion(AssertionStats const& stats)
ReusableStringStream rss; ReusableStringStream rss;
if (stats.totals.assertions.total() > 0) if (stats.totals.assertions.total() > 0)
{ {
rss << "FAILED" rss << "FAILED" << ":\n";
<< ":\n";
if (result.hasExpression()) if (result.hasExpression())
{ {
rss << " "; rss << " ";

View file

@ -68,13 +68,12 @@ class tmp_dir
} }
catch (const std::exception& e) catch (const std::exception& e)
{ {
std::cerr << "Exception caught while trying to remove " std::cerr << "Exception caught while trying to remove " << "temporary directory " << m_path << ": "
<< "temporary directory " << m_path << ": " << e.what() << "\n"; << e.what() << "\n";
} }
catch (...) catch (...)
{ {
std::cerr << "Unknown exception caught while trying to " std::cerr << "Unknown exception caught while trying to " << "remove temporary directory " << m_path << "\n";
<< "remove temporary directory " << m_path << "\n";
} }
} }

View file

@ -73,7 +73,7 @@ TEST_CASE("CSS color")
CHECK(c.green() == 0x00); CHECK(c.green() == 0x00);
CHECK(c.blue() == 0xff); CHECK(c.blue() == 0xff);
// rgba (fractional percent) // rgba (fractional percent)
std::string s2("rgb(50.5%,0.5%,99.5%)"); //#8101fe80 std::string s2("rgb(50.5%,0.5%,99.5%)"); // #8101fe80
CHECK(boost::spirit::x3::phrase_parse(s2.cbegin(), s2.cend(), color_grammar, space, c)); CHECK(boost::spirit::x3::phrase_parse(s2.cbegin(), s2.cend(), color_grammar, space, c));
CHECK(c.alpha() == 0x80); CHECK(c.alpha() == 0x80);
CHECK(c.red() == 0x81); CHECK(c.red() == 0x81);

View file

@ -55,8 +55,8 @@ std::ostream& operator<<(std::ostream& os, mapnik::gradient const& gr)
double cx, cy, fx, fy, r; double cx, cy, fx, fy, r;
gr.get_control_points(fx, fy, cx, cy, r); gr.get_control_points(fx, fy, cx, cy, r);
os << "<gradient cx=\"" << cx << "\" cy=\"" << cy << "\"" os << "<gradient cx=\"" << cx << "\" cy=\"" << cy << "\"" << " fx=\"" << fx << "\" fy=\"" << fy << "\" r=\"" << r
<< " fx=\"" << fx << "\" fy=\"" << fy << "\" r=\"" << r << "\">\n"; << "\">\n";
for (auto const& stop : gr.get_stop_array()) for (auto const& stop : gr.get_stop_array())
{ {
os << " <stop offset=\"" << std::get<0>(stop) << "\" color=\"" << std::get<1>(stop) << "\"/>\n"; os << " <stop offset=\"" << std::get<0>(stop) << "\" color=\"" << std::get<1>(stop) << "\"/>\n";

View file

@ -212,8 +212,7 @@ int main(int argc, char** argv)
catch (...) catch (...)
{ {
std::clog << "unknown exception..." std::clog << "unknown exception..." << "\n";
<< "\n";
return -1; return -1;
} }
} }

View file

@ -27,7 +27,7 @@
#include <mapnik/version.hpp> #include <mapnik/version.hpp>
#include <mapnik/util/fs.hpp> #include <mapnik/util/fs.hpp>
#include <mapnik/quad_tree.hpp> #include <mapnik/quad_tree.hpp>
//#include <mapnik/util/spatial_index.hpp> // #include <mapnik/util/spatial_index.hpp>
#include <mapnik/geometry/envelope.hpp> #include <mapnik/geometry/envelope.hpp>
#include "shapefile.hpp" #include "shapefile.hpp"
#include "shape_io.hpp" #include "shape_io.hpp"