summaryrefslogtreecommitdiff
path: root/include/mbgl
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2016-06-17 13:07:27 +0300
committerBruno de Oliveira Abinader <bruno@mapbox.com>2016-06-18 23:46:50 +0300
commitc20c1d6a6b3eb301db88ca3e74993f445cc4d839 (patch)
tree7011952bc5cc49d62b2be4b96ba3c3c7bbd3e54d /include/mbgl
parent41497e9c4174d310f3a62548f3cfeb9da2852849 (diff)
downloadqtlocation-mapboxgl-c20c1d6a6b3eb301db88ca3e74993f445cc4d839.tar.gz
[core] Avoid redundant 'inline' usage
Diffstat (limited to 'include/mbgl')
-rw-r--r--include/mbgl/gl/gl.hpp4
-rw-r--r--include/mbgl/gl/gl_helper.hpp4
-rw-r--r--include/mbgl/gl/gl_values.hpp84
-rw-r--r--include/mbgl/map/camera.hpp4
-rw-r--r--include/mbgl/platform/log.hpp10
-rw-r--r--include/mbgl/style/filter_evaluator.hpp2
-rw-r--r--include/mbgl/util/color.hpp6
-rw-r--r--include/mbgl/util/exception.hpp16
-rw-r--r--include/mbgl/util/projection.hpp6
-rw-r--r--include/mbgl/util/range.hpp4
10 files changed, 70 insertions, 70 deletions
diff --git a/include/mbgl/gl/gl.hpp b/include/mbgl/gl/gl.hpp
index 6d601d8a23..0f54b96110 100644
--- a/include/mbgl/gl/gl.hpp
+++ b/include/mbgl/gl/gl.hpp
@@ -60,14 +60,14 @@ namespace gl {
#endif
struct Error : ::std::runtime_error {
- inline Error(GLenum err, const std::string &msg) : ::std::runtime_error(msg), code(err) {};
+ Error(GLenum err, const std::string &msg) : ::std::runtime_error(msg), code(err) {};
const GLenum code;
};
void checkError(const char *cmd, const char *file, int line);
#if defined(DEBUG)
-#define MBGL_CHECK_ERROR(cmd) ([&]() { struct __MBGL_C_E { inline ~__MBGL_C_E() { ::mbgl::gl::checkError(#cmd, __FILE__, __LINE__); } } __MBGL_C_E; return cmd; }())
+#define MBGL_CHECK_ERROR(cmd) ([&]() { struct __MBGL_C_E { ~__MBGL_C_E() { ::mbgl::gl::checkError(#cmd, __FILE__, __LINE__); } } __MBGL_C_E; return cmd; }())
#else
#define MBGL_CHECK_ERROR(cmd) (cmd)
#endif
diff --git a/include/mbgl/gl/gl_helper.hpp b/include/mbgl/gl/gl_helper.hpp
index 893c73e0c3..9d46d018c3 100644
--- a/include/mbgl/gl/gl_helper.hpp
+++ b/include/mbgl/gl/gl_helper.hpp
@@ -6,9 +6,9 @@ namespace gl {
template <typename T>
class Preserve {
public:
- inline Preserve() : data(T::Get()) {
+ Preserve() : data(T::Get()) {
}
- inline ~Preserve() {
+ ~Preserve() {
T::Set(data);
}
diff --git a/include/mbgl/gl/gl_values.hpp b/include/mbgl/gl/gl_values.hpp
index 0d7d294cf7..03ae46a60e 100644
--- a/include/mbgl/gl/gl_values.hpp
+++ b/include/mbgl/gl/gl_values.hpp
@@ -13,10 +13,10 @@ namespace gl {
struct ClearDepth {
using Type = GLfloat;
static const Type Default;
- inline static void Set(const Type& value) {
+ static void Set(const Type& value) {
MBGL_CHECK_ERROR(glClearDepth(value));
}
- inline static Type Get() {
+ static Type Get() {
Type clearDepth;
MBGL_CHECK_ERROR(glGetFloatv(GL_DEPTH_CLEAR_VALUE, &clearDepth));
return clearDepth;
@@ -26,10 +26,10 @@ struct ClearDepth {
struct ClearColor {
using Type = Color;
static const Type Default;
- inline static void Set(const Type& value) {
+ static void Set(const Type& value) {
MBGL_CHECK_ERROR(glClearColor(value.r, value.g, value.b, value.a));
}
- inline static Type Get() {
+ static Type Get() {
GLfloat floats[4];
MBGL_CHECK_ERROR(glGetFloatv(GL_COLOR_CLEAR_VALUE, floats));
return { floats[0], floats[1], floats[2], floats[3] };
@@ -39,10 +39,10 @@ struct ClearColor {
struct ClearStencil {
using Type = GLint;
static const Type Default;
- inline static void Set(const Type& value) {
+ static void Set(const Type& value) {
MBGL_CHECK_ERROR(glClearStencil(value));
}
- inline static Type Get() {
+ static Type Get() {
Type clearStencil;
MBGL_CHECK_ERROR(glGetIntegerv(GL_STENCIL_CLEAR_VALUE, &clearStencil));
return clearStencil;
@@ -52,10 +52,10 @@ struct ClearStencil {
struct StencilMask {
using Type = GLuint;
static const Type Default;
- inline static void Set(const Type& value) {
+ static void Set(const Type& value) {
MBGL_CHECK_ERROR(glStencilMask(value));
}
- inline static Type Get() {
+ static Type Get() {
GLint stencilMask;
MBGL_CHECK_ERROR(glGetIntegerv(GL_STENCIL_WRITEMASK, &stencilMask));
return stencilMask;
@@ -65,10 +65,10 @@ struct StencilMask {
struct DepthMask {
using Type = GLboolean;
static const Type Default;
- inline static void Set(const Type& value) {
+ static void Set(const Type& value) {
MBGL_CHECK_ERROR(glDepthMask(value));
}
- inline static Type Get() {
+ static Type Get() {
Type depthMask;
MBGL_CHECK_ERROR(glGetBooleanv(GL_DEPTH_WRITEMASK, &depthMask));
return depthMask;
@@ -78,10 +78,10 @@ struct DepthMask {
struct ColorMask {
struct Type { bool r, g, b, a; };
static const Type Default;
- inline static void Set(const Type& value) {
+ static void Set(const Type& value) {
MBGL_CHECK_ERROR(glColorMask(value.r, value.g, value.b, value.a));
}
- inline static Type Get() {
+ static Type Get() {
GLboolean bools[4];
MBGL_CHECK_ERROR(glGetBooleanv(GL_COLOR_WRITEMASK, bools));
return { static_cast<bool>(bools[0]), static_cast<bool>(bools[1]),
@@ -89,17 +89,17 @@ struct ColorMask {
}
};
-inline bool operator!=(const ColorMask::Type& a, const ColorMask::Type& b) {
+constexpr bool operator!=(const ColorMask::Type& a, const ColorMask::Type& b) {
return a.r != b.r || a.g != b.g || a.b != b.b || a.a != b.a;
}
struct StencilFunc {
struct Type { GLenum func; GLint ref; GLuint mask; };
static const Type Default;
- inline static void Set(const Type& value) {
+ static void Set(const Type& value) {
MBGL_CHECK_ERROR(glStencilFunc(value.func, value.ref, value.mask));
}
- inline static Type Get() {
+ static Type Get() {
GLint func, ref, mask;
MBGL_CHECK_ERROR(glGetIntegerv(GL_STENCIL_FUNC, &func));
MBGL_CHECK_ERROR(glGetIntegerv(GL_STENCIL_REF, &ref));
@@ -108,17 +108,17 @@ struct StencilFunc {
}
};
-inline bool operator!=(const StencilFunc::Type& a, const StencilFunc::Type& b) {
+constexpr bool operator!=(const StencilFunc::Type& a, const StencilFunc::Type& b) {
return a.func != b.func || a.ref != b.ref || a.mask != b.mask;
}
struct StencilTest {
using Type = bool;
static const Type Default;
- inline static void Set(const Type& value) {
+ static void Set(const Type& value) {
MBGL_CHECK_ERROR(value ? glEnable(GL_STENCIL_TEST) : glDisable(GL_STENCIL_TEST));
}
- inline static Type Get() {
+ static Type Get() {
Type stencilTest;
MBGL_CHECK_ERROR(stencilTest = glIsEnabled(GL_STENCIL_TEST));
return stencilTest;
@@ -128,10 +128,10 @@ struct StencilTest {
struct StencilOp {
struct Type { GLenum sfail, dpfail, dppass; };
static const Type Default;
- inline static void Set(const Type& value) {
+ static void Set(const Type& value) {
MBGL_CHECK_ERROR(glStencilOp(value.sfail, value.dpfail, value.dppass));
}
- inline static Type Get() {
+ static Type Get() {
GLint sfail, dpfail, dppass;
MBGL_CHECK_ERROR(glGetIntegerv(GL_STENCIL_FAIL, &sfail));
MBGL_CHECK_ERROR(glGetIntegerv(GL_STENCIL_PASS_DEPTH_FAIL, &dpfail));
@@ -143,27 +143,27 @@ struct StencilOp {
struct DepthRange {
struct Type { GLfloat near, far; };
static const Type Default;
- inline static void Set(const Type& value) {
+ static void Set(const Type& value) {
MBGL_CHECK_ERROR(glDepthRange(value.near, value.far));
}
- inline static Type Get() {
+ static Type Get() {
GLfloat floats[2];
MBGL_CHECK_ERROR(glGetFloatv(GL_DEPTH_RANGE, floats));
return { floats[0], floats[1] };
}
};
-inline bool operator!=(const DepthRange::Type& a, const DepthRange::Type& b) {
+constexpr bool operator!=(const DepthRange::Type& a, const DepthRange::Type& b) {
return a.near != b.near || a.far != b.far;
}
struct DepthTest {
using Type = bool;
static const Type Default;
- inline static void Set(const Type& value) {
+ static void Set(const Type& value) {
MBGL_CHECK_ERROR(value ? glEnable(GL_DEPTH_TEST) : glDisable(GL_DEPTH_TEST));
}
- inline static Type Get() {
+ static Type Get() {
Type depthTest;
MBGL_CHECK_ERROR(depthTest = glIsEnabled(GL_DEPTH_TEST));
return depthTest;
@@ -173,10 +173,10 @@ struct DepthTest {
struct DepthFunc {
using Type = GLenum;
static const Type Default;
- inline static void Set(const Type& value) {
+ static void Set(const Type& value) {
MBGL_CHECK_ERROR(glDepthFunc(value));
}
- inline static Type Get() {
+ static Type Get() {
GLint depthFunc;
MBGL_CHECK_ERROR(glGetIntegerv(GL_DEPTH_FUNC, &depthFunc));
return depthFunc;
@@ -186,10 +186,10 @@ struct DepthFunc {
struct Blend {
using Type = bool;
static const Type Default;
- inline static void Set(const Type& value) {
+ static void Set(const Type& value) {
MBGL_CHECK_ERROR(value ? glEnable(GL_BLEND) : glDisable(GL_BLEND));
}
- inline static Type Get() {
+ static Type Get() {
Type blend;
MBGL_CHECK_ERROR(blend = glIsEnabled(GL_BLEND));
return blend;
@@ -199,10 +199,10 @@ struct Blend {
struct BlendFunc {
struct Type { GLenum sfactor, dfactor; };
static const Type Default;
- inline static void Set(const Type& value) {
+ static void Set(const Type& value) {
MBGL_CHECK_ERROR(glBlendFunc(value.sfactor, value.dfactor));
}
- inline static Type Get() {
+ static Type Get() {
GLint sfactor, dfactor;
MBGL_CHECK_ERROR(glGetIntegerv(GL_BLEND_SRC_ALPHA, &sfactor));
MBGL_CHECK_ERROR(glGetIntegerv(GL_BLEND_DST_ALPHA, &dfactor));
@@ -213,10 +213,10 @@ struct BlendFunc {
struct Program {
using Type = GLuint;
static const Type Default;
- inline static void Set(const Type& value) {
+ static void Set(const Type& value) {
MBGL_CHECK_ERROR(glUseProgram(value));
}
- inline static Type Get() {
+ static Type Get() {
GLint program;
MBGL_CHECK_ERROR(glGetIntegerv(GL_CURRENT_PROGRAM, &program));
return program;
@@ -226,10 +226,10 @@ struct Program {
struct LineWidth {
using Type = GLfloat;
static const Type Default;
- inline static void Set(const Type& value) {
+ static void Set(const Type& value) {
MBGL_CHECK_ERROR(glLineWidth(value));
}
- inline static Type Get() {
+ static Type Get() {
Type lineWidth;
MBGL_CHECK_ERROR(glGetFloatv(GL_LINE_WIDTH, &lineWidth));
return lineWidth;
@@ -239,10 +239,10 @@ struct LineWidth {
struct ActiveTexture {
using Type = GLint;
static const Type Default;
- inline static void Set(const Type& value) {
+ static void Set(const Type& value) {
MBGL_CHECK_ERROR(glActiveTexture(value));
}
- inline static Type Get() {
+ static Type Get() {
Type activeTexture;
MBGL_CHECK_ERROR(glGetIntegerv(GL_ACTIVE_TEXTURE, &activeTexture));
return activeTexture;
@@ -254,10 +254,10 @@ struct ActiveTexture {
struct PixelZoom {
struct Type { GLfloat xfactor; GLfloat yfactor; };
static const Type Default;
- inline static void Set(const Type& value) {
+ static void Set(const Type& value) {
MBGL_CHECK_ERROR(glPixelZoom(value.xfactor, value.yfactor));
}
- inline static Type Get() {
+ static Type Get() {
Type value;
MBGL_CHECK_ERROR(glGetFloatv(GL_ZOOM_X, &value.xfactor));
MBGL_CHECK_ERROR(glGetFloatv(GL_ZOOM_Y, &value.yfactor));
@@ -265,17 +265,17 @@ struct PixelZoom {
}
};
-inline bool operator!=(const PixelZoom::Type& a, const PixelZoom::Type& b) {
+constexpr bool operator!=(const PixelZoom::Type& a, const PixelZoom::Type& b) {
return a.xfactor != b.xfactor || a.yfactor != b.yfactor;
}
struct RasterPos {
using Type = std::array<GLdouble, 4>;
static const Type Default;
- inline static void Set(const Type& value) {
+ static void Set(const Type& value) {
MBGL_CHECK_ERROR(glRasterPos4d(value[0], value[1], value[2], value[3]));
}
- inline static Type Get() {
+ static Type Get() {
Type pos;
MBGL_CHECK_ERROR(glGetDoublev(GL_CURRENT_RASTER_POSITION, pos.data()));
return pos;
diff --git a/include/mbgl/map/camera.hpp b/include/mbgl/map/camera.hpp
index 4520321655..3f39ca2dc9 100644
--- a/include/mbgl/map/camera.hpp
+++ b/include/mbgl/map/camera.hpp
@@ -67,10 +67,10 @@ struct AnimationOptions {
std::function<void()> transitionFinishFn;
/** Creates an animation with no options specified. */
- inline AnimationOptions() {}
+ AnimationOptions() {}
/** Creates an animation with the specified duration. */
- inline AnimationOptions(Duration d)
+ AnimationOptions(Duration d)
: duration(d) {}
};
diff --git a/include/mbgl/platform/log.hpp b/include/mbgl/platform/log.hpp
index 48b9e3dc70..d5bb1c2fcc 100644
--- a/include/mbgl/platform/log.hpp
+++ b/include/mbgl/platform/log.hpp
@@ -37,27 +37,27 @@ private:
public:
template <typename ...Args>
- static inline void Debug(Event event, Args&& ...args) {
+ static void Debug(Event event, Args&& ...args) {
Record(EventSeverity::Debug, event, ::std::forward<Args>(args)...);
}
template <typename ...Args>
- static inline void Info(Event event, Args&& ...args) {
+ static void Info(Event event, Args&& ...args) {
Record(EventSeverity::Info, event, ::std::forward<Args>(args)...);
}
template <typename ...Args>
- static inline void Warning(Event event, Args&& ...args) {
+ static void Warning(Event event, Args&& ...args) {
Record(EventSeverity::Warning, event, ::std::forward<Args>(args)...);
}
template <typename ...Args>
- static inline void Error(Event event, Args&& ...args) {
+ static void Error(Event event, Args&& ...args) {
Record(EventSeverity::Error, event, ::std::forward<Args>(args)...);
}
template <typename ...Args>
- static inline void Record(EventSeverity severity, Event event, Args&& ...args) {
+ static void Record(EventSeverity severity, Event event, Args&& ...args) {
if (!includes(severity, disabledEventSeverities) &&
!includes(event, disabledEvents) &&
!includes({ severity, event }, disabledEventPermutations)) {
diff --git a/include/mbgl/style/filter_evaluator.hpp b/include/mbgl/style/filter_evaluator.hpp
index a458a2807b..e7b6e0f5a0 100644
--- a/include/mbgl/style/filter_evaluator.hpp
+++ b/include/mbgl/style/filter_evaluator.hpp
@@ -173,7 +173,7 @@ private:
};
template <class PropertyAccessor>
-inline bool Filter::operator()(FeatureType type, PropertyAccessor accessor) const {
+bool Filter::operator()(FeatureType type, PropertyAccessor accessor) const {
return FilterBase::visit(*this, FilterEvaluator<PropertyAccessor> { type, accessor });
}
diff --git a/include/mbgl/util/color.hpp b/include/mbgl/util/color.hpp
index 6491f75801..4be380fde3 100644
--- a/include/mbgl/util/color.hpp
+++ b/include/mbgl/util/color.hpp
@@ -20,15 +20,15 @@ public:
static optional<Color> parse(const std::string&);
};
-inline bool operator==(const Color& colorA, const Color& colorB) {
+constexpr bool operator==(const Color& colorA, const Color& colorB) {
return colorA.r == colorB.r && colorA.g == colorB.g && colorA.b == colorB.b && colorA.a == colorB.a;
}
-inline bool operator!=(const Color& colorA, const Color& colorB) {
+constexpr bool operator!=(const Color& colorA, const Color& colorB) {
return !(colorA == colorB);
}
-inline Color operator*(const Color& color, float alpha) {
+constexpr Color operator*(const Color& color, float alpha) {
return {
color.r * alpha,
color.g * alpha,
diff --git a/include/mbgl/util/exception.hpp b/include/mbgl/util/exception.hpp
index b73a94fcd2..7c331636d4 100644
--- a/include/mbgl/util/exception.hpp
+++ b/include/mbgl/util/exception.hpp
@@ -6,23 +6,23 @@ namespace mbgl {
namespace util {
struct Exception : std::runtime_error {
- inline Exception(const char *msg) : std::runtime_error(msg) {}
- inline Exception(const std::string &msg) : std::runtime_error(msg) {}
+ Exception(const char *msg) : std::runtime_error(msg) {}
+ Exception(const std::string &msg) : std::runtime_error(msg) {}
};
struct SpriteImageException : Exception {
- inline SpriteImageException(const char *msg) : Exception(msg) {}
- inline SpriteImageException(const std::string &msg) : Exception(msg) {}
+ SpriteImageException(const char *msg) : Exception(msg) {}
+ SpriteImageException(const std::string &msg) : Exception(msg) {}
};
struct MisuseException : Exception {
- inline MisuseException(const char *msg) : Exception(msg) {}
- inline MisuseException(const std::string &msg) : Exception(msg) {}
+ MisuseException(const char *msg) : Exception(msg) {}
+ MisuseException(const std::string &msg) : Exception(msg) {}
};
struct ShaderException : Exception {
- inline ShaderException(const char *msg) : Exception(msg) {}
- inline ShaderException(const std::string &msg) : Exception(msg) {}
+ ShaderException(const char *msg) : Exception(msg) {}
+ ShaderException(const std::string &msg) : Exception(msg) {}
};
} // namespace util
diff --git a/include/mbgl/util/projection.hpp b/include/mbgl/util/projection.hpp
index 76c60f5cd8..eb45088580 100644
--- a/include/mbgl/util/projection.hpp
+++ b/include/mbgl/util/projection.hpp
@@ -11,14 +11,14 @@ namespace mbgl {
class Projection {
public:
- static inline double getMetersPerPixelAtLatitude(double lat, double zoom) {
+ static double getMetersPerPixelAtLatitude(double lat, double zoom) {
const double constrainedZoom = util::clamp(zoom, util::MIN_ZOOM, util::MAX_ZOOM);
const double mapPixelWidthAtZoom = std::pow(2.0, constrainedZoom) * util::tileSize;
const double constrainedLatitude = util::clamp(lat, -util::LATITUDE_MAX, util::LATITUDE_MAX);
return std::cos(constrainedLatitude * util::DEG2RAD) * util::M2PI * util::EARTH_RADIUS_M / mapPixelWidthAtZoom;
}
- static inline ProjectedMeters projectedMetersForLatLng(const LatLng& latLng) {
+ static ProjectedMeters projectedMetersForLatLng(const LatLng& latLng) {
const double constrainedLatitude = util::clamp(latLng.latitude, -util::LATITUDE_MAX, util::LATITUDE_MAX);
const double constrainedLongitude = util::clamp(latLng.longitude, -util::LONGITUDE_MAX, util::LONGITUDE_MAX);
@@ -31,7 +31,7 @@ public:
return ProjectedMeters(northing, easting);
}
- static inline LatLng latLngForProjectedMeters(const ProjectedMeters& projectedMeters) {
+ static LatLng latLngForProjectedMeters(const ProjectedMeters& projectedMeters) {
double latitude = (2 * std::atan(std::exp(projectedMeters.northing / util::EARTH_RADIUS_M)) - (M_PI / 2)) * util::RAD2DEG;
double longitude = projectedMeters.easting * util::RAD2DEG / util::EARTH_RADIUS_M;
diff --git a/include/mbgl/util/range.hpp b/include/mbgl/util/range.hpp
index d04164afb7..8da2dd45bb 100644
--- a/include/mbgl/util/range.hpp
+++ b/include/mbgl/util/range.hpp
@@ -13,12 +13,12 @@ public:
};
template <class T>
-inline bool operator==(const Range<T>& a, const Range<T>& b) {
+bool operator==(const Range<T>& a, const Range<T>& b) {
return a.min == b.min && a.max == b.max;
}
template <class T>
-inline bool operator!=(const Range<T>& a, const Range<T>& b) {
+bool operator!=(const Range<T>& a, const Range<T>& b) {
return !(a == b);
}