[tidy] modernize-use-using

This commit is contained in:
Bruno de Oliveira Abinader
2017-05-10 18:51:52 +03:00
parent fa36110dfb
commit 25b2250c32
13 changed files with 67 additions and 38 deletions

View File

@@ -17,7 +17,7 @@ protected:
};
} // namespace non_copyable_
typedef non_copyable_::noncopyable noncopyable;
using noncopyable = non_copyable_::noncopyable;
} // namespace util
} // namespace mbgl

View File

@@ -16,7 +16,7 @@
namespace mbgl {
namespace util {
typedef void * LOOP_HANDLE;
using LOOP_HANDLE = void *;
class RunLoop : public Scheduler,
private util::noncopyable {

View File

@@ -26,10 +26,6 @@
#include <boost/geometry/index/rtree.hpp>
#pragma GCC diagnostic pop
// Make Boost Geometry aware of our LatLng type
BOOST_GEOMETRY_REGISTER_POINT_2D_CONST(mbgl::LatLng, double, boost::geometry::cs::cartesian, longitude(), latitude())
BOOST_GEOMETRY_REGISTER_BOX(mbgl::LatLngBounds, mbgl::LatLng, southwest(), northeast())
namespace mbgl {
class AnnotationTileLayer;
@@ -47,9 +43,42 @@ public:
} // namespace mbgl
// Tell Boost Geometry how to access a std::shared_ptr<mbgl::SymbolAnnotation> object.
namespace boost {
namespace geometry {
// Make Boost Geometry aware of our LatLng type
namespace traits {
template<> struct tag<mbgl::LatLng> { using type = point_tag; };
template<> struct dimension<mbgl::LatLng> : boost::mpl::int_<2> {};
template<> struct coordinate_type<mbgl::LatLng> { using type = double; };
template<> struct coordinate_system<mbgl::LatLng> { using type = boost::geometry::cs::cartesian; };
template<> struct access<mbgl::LatLng, 0> { static inline double get(mbgl::LatLng const& p) { return p.longitude(); } };
template<> struct access<mbgl::LatLng, 1> { static inline double get(mbgl::LatLng const& p) { return p.latitude(); } };
template<> struct tag<mbgl::LatLngBounds> { using type = box_tag; };
template<> struct point_type<mbgl::LatLngBounds> { using type = mbgl::LatLng; };
template <size_t D>
struct indexed_access<mbgl::LatLngBounds, min_corner, D>
{
using ct = coordinate_type<mbgl::LatLng>::type;
static inline ct get(mbgl::LatLngBounds const& b) { return geometry::get<D>(b.southwest()); }
static inline void set(mbgl::LatLngBounds& b, ct const& value) { geometry::set<D>(b.southwest(), value); }
};
template <size_t D>
struct indexed_access<mbgl::LatLngBounds, max_corner, D>
{
using ct = coordinate_type<mbgl::LatLng>::type;
static inline ct get(mbgl::LatLngBounds const& b) { return geometry::get<D>(b.northeast()); }
static inline void set(mbgl::LatLngBounds& b, ct const& value) { geometry::set<D>(b.northeast(), value); }
};
} // namespace traits
// Tell Boost Geometry how to access a std::shared_ptr<mbgl::SymbolAnnotation> object.
namespace index {
template <>
@@ -61,6 +90,7 @@ struct indexable<std::shared_ptr<const mbgl::SymbolAnnotationImpl>> {
}
};
} // end namespace index
} // end namespace geometry
} // end namespace boost
} // namespace index
} // namespace geometry
} // namespace boost

View File

@@ -17,6 +17,6 @@ public:
: point(x_, y_), angle(angle_), scale(scale_), segment(segment_) {}
};
typedef std::vector<Anchor> Anchors;
using Anchors = std::vector<Anchor>;
} // namespace mbgl

View File

@@ -53,13 +53,13 @@ namespace extension {
class Debugging {
public:
typedef void (*Callback)(GLenum source,
GLenum type,
GLuint id,
GLenum severity,
GLsizei length,
const GLchar* message,
const void* userParam);
using Callback = void (*)(GLenum source,
GLenum type,
GLuint id,
GLenum severity,
GLsizei length,
const GLchar* message,
const void* userParam);
static void DebugCallback(GLenum source,
GLenum type,

View File

@@ -38,8 +38,8 @@ public:
float height;
};
typedef std::map<std::string, SpriteAtlasElement> IconMap;
typedef std::set<std::string> IconDependencies;
using IconMap = std::map<std::string, SpriteAtlasElement>;
using IconDependencies = std::set<std::string>;
class IconRequestor {
public:

View File

@@ -28,10 +28,10 @@ namespace mbgl {
namespace bg = boost::geometry;
namespace bgm = bg::model;
namespace bgi = bg::index;
typedef bgm::point<float, 2, bg::cs::cartesian> CollisionPoint;
typedef bgm::box<CollisionPoint> Box;
typedef std::tuple<Box, CollisionBox, IndexedSubfeature> CollisionTreeBox;
typedef bgi::rtree<CollisionTreeBox, bgi::linear<16, 4>> Tree;
using CollisionPoint = bgm::point<float, 2, bg::cs::cartesian>;
using Box = bgm::box<CollisionPoint>;
using CollisionTreeBox = std::tuple<Box, CollisionBox, IndexedSubfeature>;
using Tree = bgi::rtree<CollisionTreeBox, bgi::linear<16, 4>>;
class IndexedSubfeature;

View File

@@ -13,8 +13,8 @@
namespace mbgl {
typedef char16_t GlyphID;
typedef std::set<GlyphID> GlyphIDs;
using GlyphID = char16_t;
using GlyphIDs = std::set<GlyphID>;
// Note: this only works for the BMP
GlyphRange getGlyphRange(GlyphID glyph);
@@ -40,8 +40,8 @@ struct Glyph {
GlyphMetrics metrics;
};
typedef std::map<GlyphID, optional<Glyph>> GlyphPositions;
typedef std::map<FontStack, GlyphPositions> GlyphPositionMap;
using GlyphPositions = std::map<GlyphID, optional<Glyph>>;
using GlyphPositionMap = std::map<FontStack, GlyphPositions>;
class PositionedGlyph {
public:
@@ -97,8 +97,7 @@ constexpr WritingModeType operator~(WritingModeType value) {
return WritingModeType(~mbgl::underlying_type(value));
}
typedef std::map<FontStack,GlyphIDs> GlyphDependencies;
typedef std::map<FontStack,GlyphRangeSet> GlyphRangeDependencies;
using GlyphDependencies = std::map<FontStack,GlyphIDs>;
using GlyphRangeDependencies = std::map<FontStack,GlyphRangeSet>;
} // end namespace mbgl

View File

@@ -7,7 +7,7 @@
namespace mbgl {
typedef std::pair<uint16_t, uint16_t> GlyphRange;
using GlyphRange = std::pair<uint16_t, uint16_t>;
struct GlyphRangeHash {
std::size_t operator()(const GlyphRange& glyphRange) const {
@@ -15,7 +15,7 @@ struct GlyphRangeHash {
}
};
typedef std::unordered_set<GlyphRange, GlyphRangeHash> GlyphRangeSet;
using GlyphRangeSet = std::unordered_set<GlyphRange, GlyphRangeHash>;
constexpr uint32_t GLYPHS_PER_GLYPH_RANGE = 256;
constexpr uint32_t GLYPH_RANGES_PER_FONT_STACK = 256;

View File

@@ -108,7 +108,7 @@ struct GlyphInstance {
const float angle = 0.0f;
};
typedef std::vector<GlyphInstance> GlyphInstances;
using GlyphInstances = std::vector<GlyphInstance>;
struct VirtualSegment {
Point<float> anchor;

View File

@@ -49,7 +49,7 @@ public:
WritingModeType writingMode;
};
typedef std::vector<SymbolQuad> SymbolQuads;
using SymbolQuads = std::vector<SymbolQuad>;
SymbolQuad getIconQuad(const Anchor& anchor,
const PositionedIcon& shapedIcon,

View File

@@ -26,7 +26,7 @@
namespace mbgl {
typedef std::array<double, 4> mat2;
using mat2 = std::array<double, 4>;
namespace matrix {

View File

@@ -16,8 +16,8 @@
using namespace mbgl;
typedef std::pair<uint32_t, std::string> Message;
typedef std::vector<Message> Messages;
using Message = std::pair<uint32_t, std::string>;
using Messages = std::vector<Message>;
class StyleParserTest : public ::testing::TestWithParam<std::string> {};