Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Pimenov <m@maps.me>2019-09-23 14:09:56 +0300
committerTatiana Yan <tatiana.kondakova@gmail.com>2019-09-23 17:03:29 +0300
commitcf6549a6fa01d3c0142360aa4802fc74cd06798a (patch)
tree10b4b6fc2719fc7be6377edce522cf3de5a1025a
parentfc4a42c0ed8943c47b022c87477508a758b526f0 (diff)
Got rid of the old style std/ includes for several files, mostly in software_renderer/.
-rw-r--r--3party/jansson/jansson_handle.hpp4
-rw-r--r--3party/sdf_image/sdf_image.cpp51
-rw-r--r--3party/sdf_image/sdf_image.h19
-rw-r--r--coding/dd_vector.hpp10
-rw-r--r--drape/glyph_manager.cpp2
-rw-r--r--drape/visual_scale.hpp2
-rw-r--r--partners_api/opentable_api.cpp6
-rw-r--r--partners_api/opentable_api.hpp4
-rw-r--r--partners_api/partners_api_tests/taxi_engine_tests.cpp12
-rw-r--r--partners_api/uber_api.cpp45
-rw-r--r--partners_api/uber_api.hpp39
-rw-r--r--software_renderer/area_info.hpp11
-rw-r--r--software_renderer/cpu_drawer.cpp12
-rw-r--r--software_renderer/cpu_drawer.hpp69
-rw-r--r--software_renderer/feature_processor.cpp7
-rw-r--r--software_renderer/feature_processor.hpp12
-rw-r--r--software_renderer/feature_styler.cpp21
-rw-r--r--software_renderer/feature_styler.hpp7
-rw-r--r--software_renderer/frame_image.hpp8
-rw-r--r--software_renderer/geometry_processors.cpp12
-rw-r--r--software_renderer/geometry_processors.hpp23
-rw-r--r--software_renderer/glyph_cache.cpp15
-rw-r--r--software_renderer/glyph_cache.hpp38
-rw-r--r--software_renderer/glyph_cache_impl.cpp96
-rw-r--r--software_renderer/glyph_cache_impl.hpp51
-rw-r--r--software_renderer/icon_info.hpp12
-rw-r--r--software_renderer/path_info.hpp12
-rw-r--r--software_renderer/proto_to_styles.cpp18
-rw-r--r--software_renderer/proto_to_styles.hpp4
-rw-r--r--software_renderer/rect.h3
-rw-r--r--software_renderer/text_engine.cpp5
-rw-r--r--software_renderer/text_engine.h34
-rw-r--r--storage/storage_integration_tests/storage_3levels_tests.cpp4
33 files changed, 327 insertions, 341 deletions
diff --git a/3party/jansson/jansson_handle.hpp b/3party/jansson/jansson_handle.hpp
index 565c5323d3..b6ba745b10 100644
--- a/3party/jansson/jansson_handle.hpp
+++ b/3party/jansson/jansson_handle.hpp
@@ -1,6 +1,6 @@
#pragma once
-#include "std/algorithm.hpp"
+#include <algorithm>
struct json_struct_t;
@@ -36,7 +36,7 @@ public:
void swap(JsonHandle & json)
{
- ::swap(m_pJson, json.m_pJson);
+ std::swap(m_pJson, json.m_pJson);
}
json_struct_t * get() const
diff --git a/3party/sdf_image/sdf_image.cpp b/3party/sdf_image/sdf_image.cpp
index 5def20aa5f..928991fd9b 100644
--- a/3party/sdf_image/sdf_image.cpp
+++ b/3party/sdf_image/sdf_image.cpp
@@ -17,18 +17,18 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
-#include "sdf_image.h"
+#include "3party/sdf_image/sdf_image.h"
#include "base/math.hpp"
#include "base/scope_guard.hpp"
-#include "std/algorithm.hpp"
-#include "std/limits.hpp"
-#include "std/bind.hpp"
+#include <algorithm>
+#include <limits>
+
+using namespace std::placeholders;
namespace sdf_image
{
-
namespace
{
float const SQRT2 = 1.4142136f;
@@ -44,7 +44,7 @@ namespace
}
}
-#define BIND_GRADIENT(f) bind(&f, _1, _2, _3, _4, _5, _6, _7, _8)
+#define BIND_GRADIENT(f) std::bind(&f, _1, _2, _3, _4, _5, _6, _7, _8)
#define TRANSFORM(offset, dx, dy) \
if (Transform(i, offset, dx, dy, xDist, yDist, oldDist)) \
{ \
@@ -94,10 +94,10 @@ uint32_t SdfImage::GetHeight() const
return m_height;
}
-void SdfImage::GetData(vector<uint8_t> & dst)
+void SdfImage::GetData(std::vector<uint8_t> & dst)
{
ASSERT(m_data.size() <= dst.size(), ());
- transform(m_data.begin(), m_data.end(), dst.begin(), [](float const & node)
+ std::transform(m_data.begin(), m_data.end(), dst.begin(), [](float const & node)
{
return static_cast<uint8_t>(node * 255.0f);
});
@@ -105,17 +105,17 @@ void SdfImage::GetData(vector<uint8_t> & dst)
void SdfImage::Scale()
{
- float maxi = numeric_limits<float>::min();
- float mini = numeric_limits<float>::max();
+ float maxi = std::numeric_limits<float>::min();
+ float mini = std::numeric_limits<float>::max();
- for_each(m_data.begin(), m_data.end(), [&maxi, &mini](float const & node)
+ std::for_each(m_data.begin(), m_data.end(), [&maxi, &mini](float const & node)
{
- maxi = max(maxi, node);
- mini = min(mini, node);
+ maxi = std::max(maxi, node);
+ mini = std::min(mini, node);
});
maxi -= mini;
- for_each(m_data.begin(), m_data.end(), [&maxi, &mini](float & node)
+ std::for_each(m_data.begin(), m_data.end(), [&maxi, &mini](float & node)
{
node = (node - mini) / maxi;
});
@@ -123,7 +123,7 @@ void SdfImage::Scale()
void SdfImage::Invert()
{
- for_each(m_data.begin(), m_data.end(), [](float & node)
+ std::for_each(m_data.begin(), m_data.end(), [](float & node)
{
node = 1.0f - node;
});
@@ -132,7 +132,7 @@ void SdfImage::Invert()
void SdfImage::Minus(SdfImage & im)
{
ASSERT(m_data.size() == im.m_data.size(), ());
- transform(m_data.begin(), m_data.end(), im.m_data.begin(), m_data.begin(), [](float const & n1, float const & n2)
+ std::transform(m_data.begin(), m_data.end(), im.m_data.begin(), m_data.begin(), [](float const & n1, float const & n2)
{
return n1 - n2;
});
@@ -140,7 +140,7 @@ void SdfImage::Minus(SdfImage & im)
void SdfImage::Distquant()
{
- for_each(m_data.begin(), m_data.end(), [](float & node)
+ std::for_each(m_data.begin(), m_data.end(), [](float & node)
{
node = base::Clamp(0.5f + node * 0.0325f, 0.0f, 1.0f);
});
@@ -154,8 +154,8 @@ void SdfImage::GenerateSDF(float sc)
SdfImage inside(m_height, m_width);
size_t shortCount = m_width * m_height;
- vector<short> xDist;
- vector<short> yDist;
+ std::vector<short> xDist;
+ std::vector<short> yDist;
xDist.resize(shortCount, 0);
yDist.resize(shortCount, 0);
@@ -244,7 +244,7 @@ float SdfImage::ComputeGradient(uint32_t x, uint32_t y, SdfImage::TComputeFn con
return 0.0;
}
-void SdfImage::MexFunction(SdfImage const & img, vector<short> & xDist, vector<short> & yDist, SdfImage & out)
+void SdfImage::MexFunction(SdfImage const & img, std::vector<short> & xDist, std::vector<short> & yDist, SdfImage & out)
{
ASSERT_EQUAL(img.GetWidth(), out.GetWidth(), ());
ASSERT_EQUAL(img.GetHeight(), out.GetHeight(), ());
@@ -252,9 +252,9 @@ void SdfImage::MexFunction(SdfImage const & img, vector<short> & xDist, vector<s
img.EdtaA3(xDist, yDist, out);
// Pixels with grayscale>0.5 will have a negative distance.
// This is correct, but we don't want values <0 returned here.
- for_each(out.m_data.begin(), out.m_data.end(), [](float & n)
+ std::for_each(out.m_data.begin(), out.m_data.end(), [](float & n)
{
- n = max(0.0f, n);
+ n = std::max(0.0f, n);
});
}
@@ -318,7 +318,7 @@ double SdfImage::EdgeDf(double gx, double gy, double a) const
gx = fabs(gx);
gy = fabs(gy);
if (gx < gy)
- swap(gx, gy);
+ std::swap(gx, gy);
double a1 = 0.5 * gy / gx;
if (a < a1)
@@ -332,7 +332,7 @@ double SdfImage::EdgeDf(double gx, double gy, double a) const
return df;
}
-void SdfImage::EdtaA3(vector<short> & xDist, vector<short> & yDist, SdfImage & dist) const
+void SdfImage::EdtaA3(std::vector<short> & xDist, std::vector<short> & yDist, SdfImage & dist) const
{
ASSERT_EQUAL(dist.GetHeight(), GetHeight(), ());
ASSERT_EQUAL(dist.GetWidth(), GetWidth(), ());
@@ -479,7 +479,7 @@ void SdfImage::EdtaA3(vector<short> & xDist, vector<short> & yDist, SdfImage & d
while(changed);
}
-bool SdfImage::Transform(int baseIndex, int offset, int dx, int dy, vector<short> & xDist, vector<short> & yDist, float & oldDist) const
+bool SdfImage::Transform(int baseIndex, int offset, int dx, int dy, std::vector<short> & xDist, std::vector<short> & yDist, float & oldDist) const
{
double const epsilon = 1e-3;
ASSERT_EQUAL(xDist.size(), yDist.size(), ());
@@ -505,5 +505,4 @@ bool SdfImage::Transform(int baseIndex, int offset, int dx, int dy, vector<short
return false;
}
-
} // namespace sdf_image
diff --git a/3party/sdf_image/sdf_image.h b/3party/sdf_image/sdf_image.h
index 2497b56ae3..2bb49fb17d 100644
--- a/3party/sdf_image/sdf_image.h
+++ b/3party/sdf_image/sdf_image.h
@@ -30,12 +30,12 @@ THE SOFTWARE.
#include "base/buffer_vector.hpp"
-#include "std/vector.hpp"
-#include "std/function.hpp"
+#include <cstdint>
+#include <functional>
+#include <vector>
namespace sdf_image
{
-
class SdfImage
{
public:
@@ -63,18 +63,19 @@ private:
/// d = down
/// dr = down right
/// ul u ur l r dl d dr
- typedef function<float (float, float, float, float, float, float, float, float)> TComputeFn;
+ using TComputeFn = std::function<float (float, float, float, float, float, float, float, float)>;
float ComputeGradient(uint32_t x, uint32_t y, TComputeFn const & fn) const;
- void MexFunction(SdfImage const & img, vector<short> & xDist, vector<short> & yDist, SdfImage & out);
+ void MexFunction(SdfImage const & img, std::vector<short> & xDist, std::vector<short> & yDist,
+ SdfImage & out);
float DistaA3(int c, int xc, int yc, int xi, int yi) const;
double EdgeDf(double gx, double gy, double a) const;
- void EdtaA3(vector<short> & xDist, vector<short> & yDist, SdfImage & dist) const;
- bool Transform(int baseIndex, int offset, int dx, int dy, vector<short> & xDist, vector<short> & yDist, float & oldDist) const;
+ void EdtaA3(std::vector<short> & xDist, std::vector<short> & yDist, SdfImage & dist) const;
+ bool Transform(int baseIndex, int offset, int dx, int dy, std::vector<short> & xDist,
+ std::vector<short> & yDist, float & oldDist) const;
private:
uint32_t m_height = 0;
uint32_t m_width = 0;
buffer_vector<float, 512> m_data;
};
-
-} // namespace sdf_image
+} // namespace sdf_image
diff --git a/coding/dd_vector.hpp b/coding/dd_vector.hpp
index 0f65a5a24c..a196dd82fc 100644
--- a/coding/dd_vector.hpp
+++ b/coding/dd_vector.hpp
@@ -1,13 +1,14 @@
#pragma once
+
#include "coding/reader.hpp"
#include "base/assert.hpp"
#include "base/exception.hpp"
-#include "std/iterator_facade.hpp"
-
#include <type_traits>
+#include <boost/iterator/iterator_facade.hpp>
+
// Disk-driven vector.
template <typename T, class TReader, typename TSize = uint32_t>
class DDVector
@@ -43,10 +44,10 @@ public:
return ReadPrimitiveFromPos<T>(m_reader, static_cast<uint64_t>(i) * sizeof(T));
}
- class const_iterator : public iterator_facade<
+ class const_iterator : public boost::iterator_facade<
const_iterator,
value_type const,
- random_access_traversal_tag>
+ boost::random_access_traversal_tag>
{
public:
const_iterator() : m_pReader(NULL), m_I(0), m_bValueRead(false)
@@ -144,7 +145,6 @@ public:
#else
return const_iterator(&m_reader, m_Size);
#endif
-
}
void Read(size_type i, T & result) const
diff --git a/drape/glyph_manager.cpp b/drape/glyph_manager.cpp
index e016ed91e7..a8774c5f37 100644
--- a/drape/glyph_manager.cpp
+++ b/drape/glyph_manager.cpp
@@ -258,7 +258,7 @@ public:
return result;
}
- void GetCharcodes(vector<FT_ULong> & charcodes)
+ void GetCharcodes(std::vector<FT_ULong> & charcodes)
{
FT_UInt gindex;
charcodes.push_back(FT_Get_First_Char(m_fontFace, &gindex));
diff --git a/drape/visual_scale.hpp b/drape/visual_scale.hpp
index beb8f3e72e..68518196ab 100644
--- a/drape/visual_scale.hpp
+++ b/drape/visual_scale.hpp
@@ -12,6 +12,6 @@ inline double VisualScale(double exactDensityDPI)
// For some old devices (for example iPad 2) the density could be less than 160 DPI.
// Returns one in that case to keep readable text on the map.
- return max(1.35, exactDensityDPI / kMdpiDensityDPI);
+ return std::max(1.35, exactDensityDPI / kMdpiDensityDPI);
}
} // namespace dp
diff --git a/partners_api/opentable_api.cpp b/partners_api/opentable_api.cpp
index 9454cef63b..d6d1650f12 100644
--- a/partners_api/opentable_api.cpp
+++ b/partners_api/opentable_api.cpp
@@ -1,6 +1,6 @@
#include "partners_api/opentable_api.hpp"
-#include "std/sstream.hpp"
+#include <sstream>
#include "private.h"
@@ -12,9 +12,9 @@ namespace
namespace opentable
{
// static
-string Api::GetBookTableUrl(string const & restaurantId)
+std::string Api::GetBookTableUrl(std::string const & restaurantId)
{
- stringstream ss;
+ std::stringstream ss;
ss << kOpentableBaseUrl << restaurantId << "?ref=" << OPENTABLE_AFFILATE_ID;
return ss.str();
}
diff --git a/partners_api/opentable_api.hpp b/partners_api/opentable_api.hpp
index b298fafdd7..9e75188a1b 100644
--- a/partners_api/opentable_api.hpp
+++ b/partners_api/opentable_api.hpp
@@ -1,12 +1,12 @@
#pragma once
-#include "std/string.hpp"
+#include <string>
namespace opentable
{
class Api
{
public:
- static string GetBookTableUrl(string const & restaurantId);
+ static std::string GetBookTableUrl(std::string const & restaurantId);
};
} // namespace opentable
diff --git a/partners_api/partners_api_tests/taxi_engine_tests.cpp b/partners_api/partners_api_tests/taxi_engine_tests.cpp
index 061b1863f3..d255a78e41 100644
--- a/partners_api/partners_api_tests/taxi_engine_tests.cpp
+++ b/partners_api/partners_api_tests/taxi_engine_tests.cpp
@@ -114,7 +114,7 @@ std::vector<taxi::Product> GetUberSynchronous(ms::LatLon const & from, ms::LatLo
maker.SetTimes(reqId, times);
maker.SetPrices(reqId, prices);
maker.MakeProducts(
- reqId, [&uberProducts](vector<taxi::Product> const & products) { uberProducts = products; },
+ reqId, [&uberProducts](std::vector<taxi::Product> const & products) { uberProducts = products; },
[](taxi::ErrorCode const code) { TEST(false, (code)); });
return uberProducts;
@@ -230,7 +230,7 @@ bool CompareProviders(taxi::ProvidersContainer const & lhs, taxi::ProvidersConta
auto const m = lhs.size();
- vector<bool> used(m);
+ std::vector<bool> used(m);
// TODO (@y) Change it to algorithm, based on bipartite graphs.
for (auto const & rItem : rhs)
{
@@ -457,25 +457,25 @@ UNIT_CLASS_TEST(AsyncGuiThread, TaxiEngine_Smoke)
{
{
- lock_guard<mutex> lock(resultsMutex);
+ std::lock_guard<std::mutex> lock(resultsMutex);
reqId = engine.GetAvailableProducts(ms::LatLon(55.753960, 37.624513),
ms::LatLon(55.765866, 37.661270), standardCallback,
errorPossibleCallback);
}
{
- lock_guard<mutex> lock(resultsMutex);
+ std::lock_guard<std::mutex> lock(resultsMutex);
reqId = engine.GetAvailableProducts(ms::LatLon(59.922445, 30.367201),
ms::LatLon(59.943675, 30.361123), standardCallback,
errorPossibleCallback);
}
{
- lock_guard<mutex> lock(resultsMutex);
+ std::lock_guard<std::mutex> lock(resultsMutex);
reqId = engine.GetAvailableProducts(ms::LatLon(52.509621, 13.450067),
ms::LatLon(52.510811, 13.409490), standardCallback,
errorPossibleCallback);
}
{
- lock_guard<mutex> lock(resultsMutex);
+ std::lock_guard<std::mutex> lock(resultsMutex);
reqId = engine.GetAvailableProducts(from, to, lastCallback, errorCallback);
}
}
diff --git a/partners_api/uber_api.cpp b/partners_api/uber_api.cpp
index b629e67590..57938e9bfc 100644
--- a/partners_api/uber_api.cpp
+++ b/partners_api/uber_api.cpp
@@ -9,7 +9,6 @@
#include "base/thread.hpp"
#include <iomanip>
-#include <memory>
#include <sstream>
#include <string>
#include <utility>
@@ -53,7 +52,7 @@ bool IsIncomplete(taxi::Product const & p)
return p.m_name.empty() || p.m_productId.empty() || p.m_time.empty() || p.m_price.empty();
}
-void FillProducts(json_t const * time, json_t const * price, vector<taxi::Product> & products)
+void FillProducts(json_t const * time, json_t const * price, std::vector<taxi::Product> & products)
{
// Fill data from time.
auto const timeSize = json_array_size(time);
@@ -72,7 +71,7 @@ void FillProducts(json_t const * time, json_t const * price, vector<taxi::Produc
auto const priceSize = json_array_size(price);
for (size_t i = 0; i < priceSize; ++i)
{
- string name;
+ std::string name;
auto const item = json_array_get(price, i);
FromJSONObject(item, "display_name", name);
@@ -96,7 +95,7 @@ void FillProducts(json_t const * time, json_t const * price, vector<taxi::Produc
products.erase(remove_if(products.begin(), products.end(), IsIncomplete), products.end());
}
-void MakeFromJson(char const * times, char const * prices, vector<taxi::Product> & products)
+void MakeFromJson(char const * times, char const * prices, std::vector<taxi::Product> & products)
{
products.clear();
try
@@ -122,11 +121,11 @@ namespace taxi
{
namespace uber
{
-string const kEstimatesUrl = "https://api.uber.com/v1/estimates";
-string const kProductsUrl = "https://api.uber.com/v1/products";
+std::string const kEstimatesUrl = "https://api.uber.com/v1/estimates";
+std::string const kProductsUrl = "https://api.uber.com/v1/products";
// static
-bool RawApi::GetProducts(ms::LatLon const & pos, string & result,
+bool RawApi::GetProducts(ms::LatLon const & pos, std::string & result,
std::string const & baseUrl /* = kProductsUrl */)
{
std::ostringstream url;
@@ -137,7 +136,7 @@ bool RawApi::GetProducts(ms::LatLon const & pos, string & result,
}
// static
-bool RawApi::GetEstimatedTime(ms::LatLon const & pos, string & result,
+bool RawApi::GetEstimatedTime(ms::LatLon const & pos, std::string & result,
std::string const & baseUrl /* = kEstimatesUrl */)
{
std::ostringstream url;
@@ -148,7 +147,7 @@ bool RawApi::GetEstimatedTime(ms::LatLon const & pos, string & result,
}
// static
-bool RawApi::GetEstimatedPrice(ms::LatLon const & from, ms::LatLon const & to, string & result,
+bool RawApi::GetEstimatedPrice(ms::LatLon const & from, ms::LatLon const & to, std::string & result,
std::string const & baseUrl /* = kEstimatesUrl */)
{
std::ostringstream url;
@@ -162,41 +161,41 @@ bool RawApi::GetEstimatedPrice(ms::LatLon const & from, ms::LatLon const & to, s
void ProductMaker::Reset(uint64_t const requestId)
{
- lock_guard<mutex> lock(m_mutex);
+ std::lock_guard<std::mutex> lock(m_mutex);
m_requestId = requestId;
m_times.reset();
m_prices.reset();
}
-void ProductMaker::SetTimes(uint64_t const requestId, string const & times)
+void ProductMaker::SetTimes(uint64_t const requestId, std::string const & times)
{
- lock_guard<mutex> lock(m_mutex);
+ std::lock_guard<std::mutex> lock(m_mutex);
if (requestId != m_requestId)
return;
- m_times = make_unique<string>(times);
+ m_times = std::make_unique<std::string>(times);
}
-void ProductMaker::SetPrices(uint64_t const requestId, string const & prices)
+void ProductMaker::SetPrices(uint64_t const requestId, std::string const & prices)
{
- lock_guard<mutex> lock(m_mutex);
+ std::lock_guard<std::mutex> lock(m_mutex);
if (requestId != m_requestId)
return;
- m_prices = make_unique<string>(prices);
+ m_prices = std::make_unique<std::string>(prices);
}
void ProductMaker::SetError(uint64_t const requestId, taxi::ErrorCode code)
{
- lock_guard<mutex> lock(m_mutex);
+ std::lock_guard<std::mutex> lock(m_mutex);
if (requestId != m_requestId)
return;
- m_error = make_unique<taxi::ErrorCode>(code);
+ m_error = std::make_unique<taxi::ErrorCode>(code);
}
void ProductMaker::MakeProducts(uint64_t const requestId, ProductsCallback const & successFn,
@@ -205,10 +204,10 @@ void ProductMaker::MakeProducts(uint64_t const requestId, ProductsCallback const
ASSERT(successFn, ());
ASSERT(errorFn, ());
- vector<Product> products;
- unique_ptr<taxi::ErrorCode> error;
+ std::vector<Product> products;
+ std::unique_ptr<taxi::ErrorCode> error;
{
- lock_guard<mutex> lock(m_mutex);
+ std::lock_guard<std::mutex> lock(m_mutex);
if (requestId != m_requestId || !m_times || !m_prices)
return;
@@ -258,7 +257,7 @@ void Api::GetAvailableProducts(ms::LatLon const & from, ms::LatLon const & to,
GetPlatform().RunTask(Platform::Thread::Network, [maker, from, reqId, baseUrl, successFn, errorFn]()
{
- string result;
+ std::string result;
if (!RawApi::GetEstimatedTime(from, result, baseUrl))
maker->SetError(reqId, ErrorCode::RemoteError);
@@ -268,7 +267,7 @@ void Api::GetAvailableProducts(ms::LatLon const & from, ms::LatLon const & to,
GetPlatform().RunTask(Platform::Thread::Network, [maker, from, to, reqId, baseUrl, successFn, errorFn]()
{
- string result;
+ std::string result;
if (!RawApi::GetEstimatedPrice(from, to, result, baseUrl))
maker->SetError(reqId, ErrorCode::RemoteError);
diff --git a/partners_api/uber_api.hpp b/partners_api/uber_api.hpp
index 3a5ef7e11a..c2051f0f3b 100644
--- a/partners_api/uber_api.hpp
+++ b/partners_api/uber_api.hpp
@@ -2,12 +2,11 @@
#include "partners_api/taxi_base.hpp"
-#include "std/function.hpp"
-#include "std/mutex.hpp"
-#include "std/shared_ptr.hpp"
-#include "std/string.hpp"
-#include "std/unique_ptr.hpp"
-#include "std/vector.hpp"
+#include <cstdint>
+#include <functional>
+#include <memory>
+#include <mutex>
+#include <string>
namespace ms
{
@@ -23,8 +22,8 @@ namespace taxi
{
namespace uber
{
-extern string const kEstimatesUrl;
-extern string const kProductsUrl;
+extern std::string const kEstimatesUrl;
+extern std::string const kProductsUrl;
/// Uber api wrapper based on synchronous http requests.
class RawApi
{
@@ -33,7 +32,7 @@ public:
/// otherwise returns false. The response contains the display name and other details about each
/// product, and lists the products in the proper display order. This endpoint does not reflect
/// real-time availability of the products.
- static bool GetProducts(ms::LatLon const & pos, string & result,
+ static bool GetProducts(ms::LatLon const & pos, std::string & result,
std::string const & url = kProductsUrl);
/// Returns true when http request was executed successfully and response copied into @result,
/// otherwise returns false. The response contains ETAs for all products currently available
@@ -41,13 +40,13 @@ public:
/// product returned from GetProducts is not returned from this endpoint for a given
/// latitude/longitude pair then there are currently none of that product available to request.
/// Call this endpoint every minute to provide the most accurate, up-to-date ETAs.
- static bool GetEstimatedTime(ms::LatLon const & pos, string & result,
+ static bool GetEstimatedTime(ms::LatLon const & pos, std::string & result,
std::string const & url = kEstimatesUrl);
/// Returns true when http request was executed successfully and response copied into @result,
/// otherwise returns false. The response contains an estimated price range for each product
/// offered at a given location. The price estimate is provided as a formatted string with the
/// full price range and the localized currency symbol.
- static bool GetEstimatedPrice(ms::LatLon const & from, ms::LatLon const & to, string & result,
+ static bool GetEstimatedPrice(ms::LatLon const & from, ms::LatLon const & to, std::string & result,
std::string const & url = kEstimatesUrl);
};
@@ -56,18 +55,18 @@ class ProductMaker
{
public:
void Reset(uint64_t const requestId);
- void SetTimes(uint64_t const requestId, string const & times);
- void SetPrices(uint64_t const requestId, string const & prices);
+ void SetTimes(uint64_t const requestId, std::string const & times);
+ void SetPrices(uint64_t const requestId, std::string const & prices);
void SetError(uint64_t const requestId, taxi::ErrorCode code);
void MakeProducts(uint64_t const requestId, ProductsCallback const & successFn,
ErrorProviderCallback const & errorFn);
private:
uint64_t m_requestId = 0;
- unique_ptr<string> m_times;
- unique_ptr<string> m_prices;
- unique_ptr<taxi::ErrorCode> m_error;
- mutex m_mutex;
+ std::unique_ptr<std::string> m_times;
+ std::unique_ptr<std::string> m_prices;
+ std::unique_ptr<taxi::ErrorCode> m_error;
+ std::mutex m_mutex;
};
class Api : public ApiBase
@@ -81,14 +80,14 @@ public:
ErrorProviderCallback const & errorFn) override;
/// Returns link which allows you to launch the Uber app.
- RideRequestLinks GetRideRequestLinks(string const & productId, ms::LatLon const & from,
+ RideRequestLinks GetRideRequestLinks(std::string const & productId, ms::LatLon const & from,
ms::LatLon const & to) const override;
private:
- shared_ptr<ProductMaker> m_maker = make_shared<ProductMaker>();
+ std::shared_ptr<ProductMaker> m_maker = std::make_shared<ProductMaker>();
uint64_t m_requestId = 0;
};
-void SetUberUrlForTesting(string const & url);
+void SetUberUrlForTesting(std::string const & url);
} // namespace uber
} // namespace taxi
diff --git a/software_renderer/area_info.hpp b/software_renderer/area_info.hpp
index f087980aaf..4310bcb829 100644
--- a/software_renderer/area_info.hpp
+++ b/software_renderer/area_info.hpp
@@ -2,18 +2,18 @@
#include "geometry/point2d.hpp"
-#include "std/vector.hpp"
-#include "std/algorithm.hpp"
+#include <algorithm>
+#include <cstddef>
+#include <vector>
namespace software_renderer
{
-
class AreaInfo
{
m2::PointD m_center;
public:
- vector<m2::PointD> m_path;
+ std::vector<m2::PointD> m_path;
void reserve(size_t ptsCount)
{
@@ -36,8 +36,7 @@ public:
void SetCenter(m2::PointD const & p) { m_center = p; }
m2::PointD GetCenter() const { return m_center; }
};
-
-}
+} // namespace software_renderer
inline void swap(software_renderer::AreaInfo & p1, software_renderer::AreaInfo & p2)
{
diff --git a/software_renderer/cpu_drawer.cpp b/software_renderer/cpu_drawer.cpp
index 9ea1c88e42..f553482b01 100644
--- a/software_renderer/cpu_drawer.cpp
+++ b/software_renderer/cpu_drawer.cpp
@@ -1,6 +1,8 @@
#include "software_renderer/cpu_drawer.hpp"
+
#include "software_renderer/proto_to_styles.hpp"
#include "software_renderer/software_renderer.hpp"
+
#include "drape_frontend/navigator.hpp"
#include "drape_frontend/visual_params.hpp"
@@ -14,12 +16,13 @@
#include "base/macros.hpp"
#include "base/logging.hpp"
-#include "std/algorithm.hpp"
-#include "std/bind.hpp"
+#include <algorithm>
+#include <vector>
+
+using namespace std;
namespace
{
-
void CorrectFont(dp::FontDecl & font)
{
font.m_size = font.m_size * 0.75;
@@ -828,5 +831,4 @@ void CPUDrawer::Draw(FeatureData const & data)
DrawFeatureEnd(data.m_id);
}
-
-}
+} // namespace software_renderer
diff --git a/software_renderer/cpu_drawer.hpp b/software_renderer/cpu_drawer.hpp
index 7d5886de86..2942915886 100644
--- a/software_renderer/cpu_drawer.hpp
+++ b/software_renderer/cpu_drawer.hpp
@@ -9,27 +9,28 @@
#include "geometry/screenbase.hpp"
-#include "std/function.hpp"
-#include "std/list.hpp"
-#include "std/unique_ptr.hpp"
+#include <cstdint>
+#include <functional>
+#include <list>
+#include <map>
+#include <memory>
+#include <string>
namespace software_renderer
{
-
class SoftwareRenderer;
class CPUDrawer
{
-
public:
struct Params
{
- Params(string const & resourcesPrefix, double visualScale)
+ Params(std::string const & resourcesPrefix, double visualScale)
: m_resourcesPrefix(resourcesPrefix)
, m_visualScale(visualScale)
{}
- string m_resourcesPrefix;
+ std::string m_resourcesPrefix;
double m_visualScale;
};
@@ -62,10 +63,11 @@ protected:
void DrawPathText(PathInfo const & info, FeatureStyler const & fs, DrawRule const & rule);
void DrawPathNumber(PathInfo const & path, FeatureStyler const & fs, DrawRule const & rule);
- using TRoadNumberCallbackFn = function<void (m2::PointD const & pt, dp::FontDecl const & font,
- string const & text)>;
- void GenerateRoadNumbers(PathInfo const & path, dp::FontDecl const & font, FeatureStyler const & fs,
- TRoadNumberCallbackFn const & fn);
+ using TRoadNumberCallbackFn = std::function<void(m2::PointD const & pt, dp::FontDecl const & font,
+ std::string const & text)>;
+
+ void GenerateRoadNumbers(PathInfo const & path, dp::FontDecl const & font,
+ FeatureStyler const & fs, TRoadNumberCallbackFn const & fn);
void DrawFeatureStart(FeatureID const & id);
void DrawFeatureEnd(FeatureID const & id);
@@ -76,13 +78,13 @@ protected:
FeatureID const & Insert(PathInfo const & info);
FeatureID const & Insert(AreaInfo const & info);
FeatureID const & Insert(FeatureStyler const & styler);
- FeatureID const & Insert(string const & text);
+ FeatureID const & Insert(std::string const & text);
private:
void Render();
private:
- unique_ptr<SoftwareRenderer> m_renderer;
+ std::unique_ptr<SoftwareRenderer> m_renderer;
int m_generationCounter;
enum EShapeType
@@ -178,42 +180,43 @@ private:
BaseShape const * m_rules[2];
size_t m_ruleCount;
- vector<m2::RectD> m_rects;
+ std::vector<m2::RectD> m_rects;
m2::RectD m_boundRect;
};
OverlayWrapper & AddOverlay(BaseShape const * shape1, BaseShape const * shape2 = nullptr);
- using TTextRendererCall = function<void (m2::PointD const &, dp::Anchor,
- dp::FontDecl const &, dp::FontDecl const &,
- strings::UniString const &, strings::UniString const &)>;
+ using TTextRendererCall =
+ std::function<void(m2::PointD const &, dp::Anchor, dp::FontDecl const &, dp::FontDecl const &,
+ strings::UniString const &, strings::UniString const &)>;
+
void CallTextRendererFn(TextShape const * shape, TTextRendererCall const & fn);
- using TRoadNumberRendererCall = function<void (m2::PointD const &, dp::Anchor,
- dp::FontDecl const &, strings::UniString const &)>;
+ using TRoadNumberRendererCall = std::function<void(
+ m2::PointD const &, dp::Anchor, dp::FontDecl const &, strings::UniString const &)>;
+
void CallTextRendererFn(TextShape const * shape, TRoadNumberRendererCall const & fn);
- using TPathTextRendererCall = function<void (PathInfo const &, dp::FontDecl const &,
- strings::UniString const & text)>;
+ using TPathTextRendererCall = std::function<void (PathInfo const &, dp::FontDecl const &,
+ strings::UniString const & text)>;
void CallTextRendererFn(ComplexShape const * shape, TPathTextRendererCall const & fn);
- list<ComplexShape> m_areaPathShapes;
+ std::list<ComplexShape> m_areaPathShapes;
// overlay part
- list<PointShape> m_pointShapes;
- list<ComplexShape> m_pathTextShapes;
- list<TextShape> m_textShapes;
- list<OverlayWrapper> m_overlayList;
-
- map<FeatureID, FeatureStyler> m_stylers;
- map<FeatureID, AreaInfo> m_areasGeometry;
- map<FeatureID, PathInfo> m_pathGeometry;
- map<FeatureID, string> m_roadNames;
+ std::list<PointShape> m_pointShapes;
+ std::list<ComplexShape> m_pathTextShapes;
+ std::list<TextShape> m_textShapes;
+ std::list<OverlayWrapper> m_overlayList;
+
+ std::map<FeatureID, FeatureStyler> m_stylers;
+ std::map<FeatureID, AreaInfo> m_areasGeometry;
+ std::map<FeatureID, PathInfo> m_pathGeometry;
+ std::map<FeatureID, string> m_roadNames;
dp::FontDecl m_roadNumberFont;
double m_visualScale;
FeatureID m_currentFeatureID;
};
-
-}
+} // namespace software_renderer
diff --git a/software_renderer/feature_processor.cpp b/software_renderer/feature_processor.cpp
index 7ed22a61e9..1b48a7a573 100644
--- a/software_renderer/feature_processor.cpp
+++ b/software_renderer/feature_processor.cpp
@@ -1,4 +1,5 @@
#include "software_renderer/feature_processor.hpp"
+
#include "software_renderer/geometry_processors.hpp"
#include "software_renderer/feature_styler.hpp"
#include "software_renderer/cpu_drawer.hpp"
@@ -8,7 +9,6 @@
namespace software_renderer
{
-
namespace
{
template <class TSrc> void assign_point(FeatureData & data, TSrc & src)
@@ -28,7 +28,7 @@ namespace
ASSERT(!data.m_areas.empty(), ());
data.m_areas.back().SetCenter(src.GetCenter());
}
-}
+} // namespace
FeatureProcessor::FeatureProcessor(ref_ptr<CPUDrawer> drawer,
m2::RectD const & r,
@@ -165,5 +165,4 @@ bool FeatureProcessor::operator()(FeatureType const & f)
return true;
}
-
-}
+} // namespace software_renderer
diff --git a/software_renderer/feature_processor.hpp b/software_renderer/feature_processor.hpp
index e888f8c516..5a963e03be 100644
--- a/software_renderer/feature_processor.hpp
+++ b/software_renderer/feature_processor.hpp
@@ -13,7 +13,8 @@
#include "geometry/rect2d.hpp"
-#include "std/list.hpp"
+#include <list>
+#include <vector>
class ScreenBase;
@@ -25,8 +26,8 @@ struct FeatureData
FeatureStyler m_styler;
FeatureID m_id;
- list<PathInfo> m_pathes;
- list<AreaInfo> m_areas;
+ std::list<PathInfo> m_pathes;
+ std::list<AreaInfo> m_areas;
m2::PointD m_point;
};
@@ -50,7 +51,6 @@ private:
int m_zoom;
bool m_hasAnyFeature;
- void PreProcessKeys(vector<drule::Key> & keys) const;
+ void PreProcessKeys(std::vector<drule::Key> & keys) const;
};
-
-}
+} // namespace software_renderer
diff --git a/software_renderer/feature_styler.cpp b/software_renderer/feature_styler.cpp
index 623d5621b9..174b1ddde6 100644
--- a/software_renderer/feature_styler.cpp
+++ b/software_renderer/feature_styler.cpp
@@ -1,4 +1,5 @@
#include "software_renderer/feature_styler.hpp"
+
#include "software_renderer/proto_to_styles.hpp"
#include "software_renderer/glyph_cache.hpp"
#include "software_renderer/geometry_processors.hpp"
@@ -15,11 +16,13 @@
#include "base/logging.hpp"
#include "base/stl_helpers.hpp"
-#include "std/iterator_facade.hpp"
+#include <string>
+#include <utility>
+
+#include <boost/iterator/iterator_facade.hpp>
namespace
{
-
struct less_depth
{
bool operator() (software_renderer::DrawRule const & r1, software_renderer::DrawRule const & r2) const
@@ -27,8 +30,7 @@ struct less_depth
return (r1.m_depth < r2.m_depth);
}
};
-
-}
+} // namespace
namespace software_renderer
{
@@ -61,7 +63,7 @@ FeatureStyler::FeatureStyler(FeatureType const & f,
m_rect(rect)
{
drule::KeysT keys;
- pair<int, bool> type = feature::GetDrawRule(f, zoom, keys);
+ std::pair<int, bool> type = feature::GetDrawRule(f, zoom, keys);
// don't try to do anything to invisible feature
if (keys.empty())
@@ -89,7 +91,7 @@ FeatureStyler::FeatureStyler(FeatureType const & f,
// m_primaryText.clear();
//}
- string houseNumber;
+ std::string houseNumber;
if (ftypes::IsBuildingChecker::Instance()(f))
{
houseNumber = f.GetHouseNumber();
@@ -264,9 +266,9 @@ FeatureStyler::FeatureStyler(FeatureType const & f,
sort(m_rules.begin(), m_rules.end(), less_depth());
}
-typedef pair<double, double> RangeT;
+typedef std::pair<double, double> RangeT;
template <class IterT> class RangeIterT :
- public iterator_facade<RangeIterT<IterT>, RangeT, forward_traversal_tag, RangeT>
+ public boost::iterator_facade<RangeIterT<IterT>, RangeT, forward_traversal_tag, RangeT>
{
IterT m_iter;
public:
@@ -404,5 +406,4 @@ bool FeatureStyler::FilterTextSize(drule::BaseRule const * pRule) const
return true;
}
}
-
-}
+} // namespace software_renderer
diff --git a/software_renderer/feature_styler.hpp b/software_renderer/feature_styler.hpp
index 0b736c77ab..385afd436a 100644
--- a/software_renderer/feature_styler.hpp
+++ b/software_renderer/feature_styler.hpp
@@ -4,14 +4,14 @@
#include "geometry/rect2d.hpp"
-#include "std/vector.hpp"
+#include <cstddef>
+#include <cstdint>
class FeatureType;
class ScreenBase;
namespace software_renderer
{
-
const int maxDepth = 20000;
const int minDepth = -20000;
@@ -78,5 +78,4 @@ private:
uint8_t GetTextFontSize(drule::BaseRule const * pRule) const;
void LayoutTexts(double pathLength);
};
-
-}
+} // namespace software_renderer
diff --git a/software_renderer/frame_image.hpp b/software_renderer/frame_image.hpp
index a9ab458080..cd6a197706 100644
--- a/software_renderer/frame_image.hpp
+++ b/software_renderer/frame_image.hpp
@@ -2,12 +2,11 @@
#include "geometry/point2d.hpp"
-#include "std/cstdint.hpp"
-#include "std/vector.hpp"
+#include <cstdint>
+#include <vector>
namespace software_renderer
{
-
struct FrameSymbols
{
m2::PointD m_searchResult;
@@ -25,5 +24,4 @@ struct FrameImage
uint32_t m_height = 0; // pixel height of image
uint32_t m_stride = 0; // row stride in bytes
};
-
-}
+} // namespace software_renderer
diff --git a/software_renderer/geometry_processors.cpp b/software_renderer/geometry_processors.cpp
index 21251a1c3c..895e2edaf3 100644
--- a/software_renderer/geometry_processors.cpp
+++ b/software_renderer/geometry_processors.cpp
@@ -1,10 +1,9 @@
-#include "geometry_processors.hpp"
+#include "software_renderer/geometry_processors.hpp"
-#include "std/bind.hpp"
+#include <functional>
namespace software_renderer
{
-
base_screen::base_screen(params const & p)
: base(p)
{
@@ -129,7 +128,7 @@ bool cut_path_intervals::IsExist()
{
// finally, assign whole length to every cutted path
for_each(m_points.begin(), m_points.end(),
- bind(&PathInfo::SetFullLength, _1, m_length));
+ std::bind(&PathInfo::SetFullLength, std::placeholders::_1, m_length));
return !m_points.empty();
}
@@ -243,7 +242,7 @@ bool path_points::IsExist()
{
// finally, assign whole length to every cutted path
for_each(m_points.begin(), m_points.end(),
- bind(&PathInfo::SetFullLength, _1, m_length));
+ std::bind(&PathInfo::SetFullLength, std::placeholders::_1, m_length));
EndPL();
return base_type::IsExist();
@@ -272,5 +271,4 @@ bool area_tess_points::IsExist() const
{
return !m_points.empty();
}
-
-}
+} // namespace software_renderer
diff --git a/software_renderer/geometry_processors.hpp b/software_renderer/geometry_processors.hpp
index 59b657747e..fc17f5b819 100644
--- a/software_renderer/geometry_processors.hpp
+++ b/software_renderer/geometry_processors.hpp
@@ -1,32 +1,30 @@
#pragma once
-#include "area_info.hpp"
-#include "path_info.hpp"
+#include "software_renderer/area_info.hpp"
+#include "software_renderer/path_info.hpp"
-#include "indexer/cell_id.hpp" // CoordPointT
+#include "indexer/cell_id.hpp"
#include "geometry/point2d.hpp"
#include "geometry/rect2d.hpp"
#include "geometry/rect_intersect.hpp"
#include "geometry/screenbase.hpp"
-#include "std/list.hpp"
-#include "std/limits.hpp"
-
#include "base/buffer_vector.hpp"
+#include <limits>
+#include <list>
+
class ScreenBase;
namespace software_renderer
{
-
/// @name Base class policies (use by inheritance) for points processing.
/// Containt next functions:\n
/// - make_point - convert from Feature point to Screen point
/// - convert_point - convert point to screen coordinates;\n
/// - m_rect - clip rect;\n
-//@{
struct base
{
struct params
@@ -91,8 +89,6 @@ struct base_screen : public base
}
};
-//@}
-
template <typename TBase>
struct calc_length : public TBase
{
@@ -147,7 +143,7 @@ template <class TInfo, class TBase>
struct geometry_base : public TBase
{
public:
- list<TInfo> m_points;
+ std::list<TInfo> m_points;
typedef typename TBase::params params;
@@ -310,7 +306,7 @@ public:
explicit filter_screenpts_adapter(params const & p)
: TBase(p),
- m_prev(numeric_limits<double>::min(), numeric_limits<double>::min()), m_center(0, 0)
+ m_prev(std::numeric_limits<double>::min(), std::numeric_limits<double>::min()), m_center(0, 0)
{
}
@@ -339,5 +335,4 @@ public:
m2::PointD GetCenter() const { return m_center; }
void SetCenter(m2::PointD const & p) { m_center = this->g2p(p); }
};
-
-}
+} // namespace software_renderer
diff --git a/software_renderer/glyph_cache.cpp b/software_renderer/glyph_cache.cpp
index b8bcc22673..dea432516c 100644
--- a/software_renderer/glyph_cache.cpp
+++ b/software_renderer/glyph_cache.cpp
@@ -1,9 +1,9 @@
#include "software_renderer/glyph_cache.hpp"
+
#include "software_renderer/glyph_cache_impl.hpp"
namespace software_renderer
{
-
GlyphKey::GlyphKey(strings::UniChar symbolCode,
int fontSize,
bool isMask,
@@ -40,9 +40,9 @@ bool operator!=(GlyphKey const & l, GlyphKey const & r)
|| !(l.m_color == r.m_color);
}
-GlyphCache::Params::Params(string const & blocksFile,
- string const & whiteListFile,
- string const & blackListFile,
+GlyphCache::Params::Params(std::string const & blocksFile,
+ std::string const & whiteListFile,
+ std::string const & blackListFile,
size_t maxSize,
double visualScale,
bool isDebugging)
@@ -61,7 +61,7 @@ GlyphCache::GlyphCache(Params const & params) : m_impl(new GlyphCacheImpl(params
{
}
-void GlyphCache::addFonts(vector<string> const & fontNames)
+void GlyphCache::addFonts(std::vector<std::string> const & fontNames)
{
m_impl->addFonts(fontNames);
}
@@ -81,7 +81,7 @@ shared_ptr<GlyphBitmap> const GlyphCache::getGlyphBitmap(GlyphKey const & key)
return m_impl->getGlyphBitmap(key);
}
-double GlyphCache::getTextLength(double fontSize, string const & text)
+double GlyphCache::getTextLength(double fontSize, std::string const & text)
{
strings::UniString const s = strings::MakeUniString(text);
double len = 0;
@@ -93,5 +93,4 @@ double GlyphCache::getTextLength(double fontSize, string const & text)
return len;
}
-
-}
+} // namespace software_renderer
diff --git a/software_renderer/glyph_cache.hpp b/software_renderer/glyph_cache.hpp
index 3756569234..d886a2c651 100644
--- a/software_renderer/glyph_cache.hpp
+++ b/software_renderer/glyph_cache.hpp
@@ -4,14 +4,13 @@
#include "base/string_utils.hpp"
-#include "std/shared_ptr.hpp"
-#include "std/vector.hpp"
-#include "std/string.hpp"
-#include "std/utility.hpp"
+#include <memory>
+#include <string>
+#include <utility>
+#include <vector>
namespace software_renderer
{
-
/// metrics of the single glyph
struct GlyphMetrics
{
@@ -28,7 +27,7 @@ struct GlyphBitmap
unsigned m_width;
unsigned m_height;
unsigned m_pitch;
- vector<unsigned char> m_data;
+ std::vector<unsigned char> m_data;
};
struct GlyphKey
@@ -55,22 +54,20 @@ struct GlyphCacheImpl;
class GlyphCache
{
private:
-
- shared_ptr<GlyphCacheImpl> m_impl;
+ std::shared_ptr<GlyphCacheImpl> m_impl;
public:
-
struct Params
{
- string m_blocksFile;
- string m_whiteListFile;
- string m_blackListFile;
+ std::string m_blocksFile;
+ std::string m_whiteListFile;
+ std::string m_blackListFile;
size_t m_maxSize;
double m_visualScale;
bool m_isDebugging;
- Params(string const & blocksFile,
- string const & whiteListFile,
- string const & blackListFile,
+ Params(std::string const & blocksFile,
+ std::string const & whiteListFile,
+ std::string const & blackListFile,
size_t maxSize,
double visualScale,
bool isDebugging);
@@ -80,15 +77,14 @@ public:
GlyphCache(Params const & params);
void reset();
- void addFonts(vector<string> const & fontNames);
+ void addFonts(std::vector<std::string> const & fontNames);
- pair<Font*, int> getCharIDX(GlyphKey const & key);
+ std::pair<Font*, int> getCharIDX(GlyphKey const & key);
- shared_ptr<GlyphBitmap> const getGlyphBitmap(GlyphKey const & key);
+ std::shared_ptr<GlyphBitmap> const getGlyphBitmap(GlyphKey const & key);
/// return control box(could be slightly larger than the precise bound box).
GlyphMetrics const getGlyphMetrics(GlyphKey const & key);
- double getTextLength(double fontSize, string const & text);
+ double getTextLength(double fontSize, std::string const & text);
};
-
-}
+} // namespace software_renderer
diff --git a/software_renderer/glyph_cache_impl.cpp b/software_renderer/glyph_cache_impl.cpp
index 92e6b44fb0..e08bbfad62 100644
--- a/software_renderer/glyph_cache_impl.cpp
+++ b/software_renderer/glyph_cache_impl.cpp
@@ -7,8 +7,12 @@
#include "base/assert.hpp"
#include "base/logging.hpp"
-#include "std/bind.hpp"
-#include "std/cstring.hpp"
+#include <algorithm>
+#include <cstring>
+#include <functional>
+#include <sstream>
+#include <string>
+#include <utility>
#include <freetype/ftcache.h>
@@ -17,8 +21,7 @@
namespace software_renderer
{
-
-UnicodeBlock::UnicodeBlock(string const & name, strings::UniChar start, strings::UniChar end)
+UnicodeBlock::UnicodeBlock(std::string const & name, strings::UniChar start, strings::UniChar end)
: m_name(name), m_start(start), m_end(end)
{}
@@ -78,9 +81,9 @@ FT_Error Font::CreateFaceID(FT_Library library, FT_Face * face)
//return FT_New_Memory_Face(library, (unsigned char*)m_fontData.data(), m_fontData.size(), 0, face);
}
-void GlyphCacheImpl::initBlocks(string const & fileName)
+void GlyphCacheImpl::initBlocks(std::string const & fileName)
{
- string buffer;
+ std::string buffer;
try
{
ReaderPtr<Reader>(GetPlatform().GetReader(fileName)).ReadAsString(buffer);
@@ -91,10 +94,10 @@ void GlyphCacheImpl::initBlocks(string const & fileName)
return;
}
- istringstream fin(buffer);
+ std::istringstream fin(buffer);
while (true)
{
- string name;
+ std::string name;
strings::UniChar start;
strings::UniChar end;
fin >> name >> std::hex >> start >> std::hex >> end;
@@ -107,15 +110,15 @@ void GlyphCacheImpl::initBlocks(string const & fileName)
m_lastUsedBlock = m_unicodeBlocks.end();
}
-bool find_ub_by_name(string const & ubName, UnicodeBlock const & ub)
+bool find_ub_by_name(std::string const & ubName, UnicodeBlock const & ub)
{
return ubName == ub.m_name;
}
-void GlyphCacheImpl::initFonts(string const & whiteListFile, string const & blackListFile)
+void GlyphCacheImpl::initFonts(std::string const & whiteListFile, std::string const & blackListFile)
{
{
- string buffer;
+ std::string buffer;
try
{
ReaderPtr<Reader>(GetPlatform().GetReader(whiteListFile)).ReadAsString(buffer);
@@ -126,11 +129,11 @@ void GlyphCacheImpl::initFonts(string const & whiteListFile, string const & blac
return;
}
- istringstream fin(buffer);
+ std::istringstream fin(buffer);
while (true)
{
- string ubName;
- string fontName;
+ std::string ubName;
+ std::string fontName;
fin >> ubName >> fontName;
if (!fin)
break;
@@ -142,7 +145,9 @@ void GlyphCacheImpl::initFonts(string const & whiteListFile, string const & blac
it->m_whitelist.push_back(fontName);
else
{
- unicode_blocks_t::iterator it = find_if(m_unicodeBlocks.begin(), m_unicodeBlocks.end(), bind(&find_ub_by_name, ubName, _1));
+ unicode_blocks_t::iterator it =
+ std::find_if(m_unicodeBlocks.begin(), m_unicodeBlocks.end(),
+ std::bind(&find_ub_by_name, ubName, std::placeholders::_1));
if (it != m_unicodeBlocks.end())
it->m_whitelist.push_back(fontName);
}
@@ -150,7 +155,7 @@ void GlyphCacheImpl::initFonts(string const & whiteListFile, string const & blac
}
{
- string buffer;
+ std::string buffer;
try
{
ReaderPtr<Reader>(GetPlatform().GetReader(blackListFile)).ReadAsString(buffer);
@@ -161,11 +166,11 @@ void GlyphCacheImpl::initFonts(string const & whiteListFile, string const & blac
return;
}
- istringstream fin(buffer);
+ std::istringstream fin(buffer);
while (true)
{
- string ubName;
- string fontName;
+ std::string ubName;
+ std::string fontName;
fin >> ubName >> fontName;
if (!fin)
break;
@@ -177,7 +182,9 @@ void GlyphCacheImpl::initFonts(string const & whiteListFile, string const & blac
it->m_blacklist.push_back(fontName);
else
{
- unicode_blocks_t::iterator it = find_if(m_unicodeBlocks.begin(), m_unicodeBlocks.end(), bind(&find_ub_by_name, ubName, _1));
+ unicode_blocks_t::iterator it =
+ std::find_if(m_unicodeBlocks.begin(), m_unicodeBlocks.end(),
+ std::bind(&find_ub_by_name, ubName, std::placeholders::_1));
if (it != m_unicodeBlocks.end())
it->m_blacklist.push_back(fontName);
}
@@ -185,12 +192,13 @@ void GlyphCacheImpl::initFonts(string const & whiteListFile, string const & blac
}
}
-bool greater_coverage(pair<int, shared_ptr<Font> > const & l, pair<int, shared_ptr<Font> > const & r)
+bool greater_coverage(std::pair<int, std::shared_ptr<Font>> const & l,
+ std::pair<int, std::shared_ptr<Font>> const & r)
{
return l.first > r.first;
}
-void GlyphCacheImpl::addFonts(vector<string> const & fontNames)
+void GlyphCacheImpl::addFonts(std::vector<std::string> const & fontNames)
{
if (m_isDebugging)
return;
@@ -213,7 +221,7 @@ void GlyphCacheImpl::addFont(char const * fileName)
if (m_isDebugging)
return;
- shared_ptr<Font> pFont(new Font(GetPlatform().GetReader(fileName)));
+ std::shared_ptr<Font> pFont(new Font(GetPlatform().GetReader(fileName)));
// Obtaining all glyphs, supported by this font. Call to FTCHECKRETURN functions may return
// from routine, so add font to fonts array only in the end.
@@ -221,15 +229,15 @@ void GlyphCacheImpl::addFont(char const * fileName)
FT_Face face;
FREETYPE_CHECK_RETURN(pFont->CreateFaceID(m_lib, &face), fileName);
- vector<FT_ULong> charcodes;
+ std::vector<FT_ULong> charcodes;
FT_UInt gindex;
charcodes.push_back(FT_Get_First_Char(face, &gindex));
while (gindex)
charcodes.push_back(FT_Get_Next_Char(face, charcodes.back(), &gindex));
- sort(charcodes.begin(), charcodes.end());
- charcodes.erase(unique(charcodes.begin(), charcodes.end()), charcodes.end());
+ std::sort(charcodes.begin(), charcodes.end());
+ charcodes.erase(std::unique(charcodes.begin(), charcodes.end()), charcodes.end());
FREETYPE_CHECK_RETURN(FT_Done_Face(face), fileName);
@@ -237,7 +245,7 @@ void GlyphCacheImpl::addFont(char const * fileName)
// modifying the m_unicodeBlocks
unicode_blocks_t::iterator ubIt = m_unicodeBlocks.begin();
- vector<FT_ULong>::iterator ccIt = charcodes.begin();
+ std::vector<FT_ULong>::iterator ccIt = charcodes.begin();
while (ccIt != charcodes.end())
{
@@ -296,13 +304,13 @@ void GlyphCacheImpl::addFont(char const * fileName)
size_t const count = ubIt->m_fonts.size();
- vector<pair<int, shared_ptr<Font> > > sortData;
+ std::vector<std::pair<int, std::shared_ptr<Font>>> sortData;
sortData.reserve(count);
for (size_t i = 0; i < count; ++i)
- sortData.push_back(make_pair(ubIt->m_coverage[i], ubIt->m_fonts[i]));
+ sortData.push_back(std::make_pair(ubIt->m_coverage[i], ubIt->m_fonts[i]));
- sort(sortData.begin(), sortData.end(), &greater_coverage);
+ std::sort(sortData.begin(), sortData.end(), &greater_coverage);
for (size_t i = 0; i < count; ++i)
{
@@ -328,15 +336,15 @@ struct sym_in_block
}
};
-vector<shared_ptr<Font> > & GlyphCacheImpl::getFonts(strings::UniChar sym)
+std::vector<std::shared_ptr<Font>> & GlyphCacheImpl::getFonts(strings::UniChar sym)
{
if ((m_lastUsedBlock != m_unicodeBlocks.end()) && m_lastUsedBlock->hasSymbol(sym))
return m_lastUsedBlock->m_fonts;
- unicode_blocks_t::iterator it = lower_bound(m_unicodeBlocks.begin(),
- m_unicodeBlocks.end(),
- sym,
- sym_in_block());
+ unicode_blocks_t::iterator it = std::lower_bound(m_unicodeBlocks.begin(),
+ m_unicodeBlocks.end(),
+ sym,
+ sym_in_block());
if (it == m_unicodeBlocks.end())
it = m_unicodeBlocks.end()-1;
@@ -362,7 +370,6 @@ vector<shared_ptr<Font> > & GlyphCacheImpl::getFonts(strings::UniChar sym)
return m_fonts;
}
-
GlyphCacheImpl::GlyphCacheImpl(GlyphCache::Params const & params)
{
m_isDebugging = params.m_isDebugging;
@@ -420,12 +427,12 @@ int GlyphCacheImpl::getCharIDX(shared_ptr<Font> const & font, strings::UniChar s
);
}
-pair<Font*, int> const GlyphCacheImpl::getCharIDX(GlyphKey const & key)
+std::pair<Font*, int> const GlyphCacheImpl::getCharIDX(GlyphKey const & key)
{
if (m_isDebugging)
- return make_pair((Font*)0, 0);
+ return std::make_pair((Font*)0, 0);
- vector<shared_ptr<Font> > & fonts = getFonts(key.m_symbolCode);
+ std::vector<std::shared_ptr<Font> > & fonts = getFonts(key.m_symbolCode);
Font * font = 0;
@@ -436,7 +443,7 @@ pair<Font*, int> const GlyphCacheImpl::getCharIDX(GlyphKey const & key)
charIDX = getCharIDX(fonts[i], key.m_symbolCode);
if (charIDX != 0)
- return make_pair(fonts[i].get(), charIDX);
+ return std::make_pair(fonts[i].get(), charIDX);
}
#ifdef DEBUG
@@ -459,7 +466,7 @@ pair<Font*, int> const GlyphCacheImpl::getCharIDX(GlyphKey const & key)
if (charIDX == 0)
charIDX = getCharIDX(fonts.front(), 32);
- return make_pair(font, charIDX);
+ return std::make_pair(font, charIDX);
}
GlyphMetrics const GlyphCacheImpl::getGlyphMetrics(GlyphKey const & key)
@@ -516,9 +523,9 @@ GlyphMetrics const GlyphCacheImpl::getGlyphMetrics(GlyphKey const & key)
return m;
}
-shared_ptr<GlyphBitmap> const GlyphCacheImpl::getGlyphBitmap(GlyphKey const & key)
+std::shared_ptr<GlyphBitmap> const GlyphCacheImpl::getGlyphBitmap(GlyphKey const & key)
{
- pair<Font *, int> charIDX = getCharIDX(key);
+ std::pair<Font *, int> charIDX = getCharIDX(key);
FTC_ScalerRec fontScaler =
{
@@ -584,5 +591,4 @@ FT_Error GlyphCacheImpl::RequestFace(FTC_FaceID faceID, FT_Library library, FT_P
Font * font = reinterpret_cast<Font*>(faceID);
return font->CreateFaceID(library, face);
}
-
-}
+} // namespace software_renderer
diff --git a/software_renderer/glyph_cache_impl.hpp b/software_renderer/glyph_cache_impl.hpp
index e24bc69b6a..818fdfaeb5 100644
--- a/software_renderer/glyph_cache_impl.hpp
+++ b/software_renderer/glyph_cache_impl.hpp
@@ -2,6 +2,15 @@
#include "software_renderer/glyph_cache.hpp"
+#include "coding/reader.hpp"
+
+#include "base/string_utils.hpp"
+
+#include <memory>
+#include <string>
+#include <utility>
+#include <vector>
+
#include <ft2build.h>
#include FT_TYPES_H
#include FT_SYSTEM_H
@@ -9,17 +18,8 @@
#include FT_STROKER_H
#include FT_CACHE_H
-#include "base/string_utils.hpp"
-
-#include "coding/reader.hpp"
-
-#include "std/string.hpp"
-#include "std/vector.hpp"
-#include "std/shared_ptr.hpp"
-
namespace software_renderer
{
-
struct Font
{
FT_Stream m_fontStream;
@@ -37,24 +37,24 @@ struct Font
/// Information about single unicode block.
struct UnicodeBlock
{
- string m_name;
+ std::string m_name;
/// @{ font matching tuning
/// whitelist has priority over the blacklist in case of duplicates.
/// this fonts are promoted to the top of the font list for this block.
- vector<string> m_whitelist;
+ std::vector<std::string> m_whitelist;
/// this fonts are removed from the font list for this block.
- vector<string> m_blacklist;
+ std::vector<std::string> m_blacklist;
/// @}
strings::UniChar m_start;
strings::UniChar m_end;
/// sorted indices in m_fonts, from the best to the worst
- vector<shared_ptr<Font> > m_fonts;
+ std::vector<std::shared_ptr<Font> > m_fonts;
/// coverage of each font, in symbols
- vector<int> m_coverage;
+ std::vector<int> m_coverage;
- UnicodeBlock(string const & name, strings::UniChar start, strings::UniChar end);
+ UnicodeBlock(std::string const & name, strings::UniChar start, strings::UniChar end);
bool hasSymbol(strings::UniChar sym) const;
};
@@ -73,30 +73,29 @@ struct GlyphCacheImpl
FTC_CMapCache m_charMapCache; //< cache of glyphID -> glyphIdx mapping
- typedef vector<UnicodeBlock> unicode_blocks_t;
+ typedef std::vector<UnicodeBlock> unicode_blocks_t;
unicode_blocks_t m_unicodeBlocks;
unicode_blocks_t::iterator m_lastUsedBlock;
bool m_isDebugging;
- typedef vector<shared_ptr<Font> > TFonts;
+ typedef std::vector<std::shared_ptr<Font> > TFonts;
TFonts m_fonts;
static FT_Error RequestFace(FTC_FaceID faceID, FT_Library library, FT_Pointer requestData, FT_Face * face);
- void initBlocks(string const & fileName);
- void initFonts(string const & whiteListFile, string const & blackListFile);
+ void initBlocks(std::string const & fileName);
+ void initFonts(std::string const & whiteListFile, std::string const & blackListFile);
- vector<shared_ptr<Font> > & getFonts(strings::UniChar sym);
+ std::vector<std::shared_ptr<Font> > & getFonts(strings::UniChar sym);
void addFont(char const * fileName);
- void addFonts(vector<string> const & fontNames);
+ void addFonts(std::vector<std::string> const & fontNames);
- int getCharIDX(shared_ptr<Font> const & font, strings::UniChar symbolCode);
- pair<Font*, int> const getCharIDX(GlyphKey const & key);
+ int getCharIDX(std::shared_ptr<Font> const & font, strings::UniChar symbolCode);
+ std::pair<Font*, int> const getCharIDX(GlyphKey const & key);
GlyphMetrics const getGlyphMetrics(GlyphKey const & key);
- shared_ptr<GlyphBitmap> const getGlyphBitmap(GlyphKey const & key);
+ std::shared_ptr<GlyphBitmap> const getGlyphBitmap(GlyphKey const & key);
GlyphCacheImpl(GlyphCache::Params const & params);
~GlyphCacheImpl();
};
-
-}
+} // namespace software_renderer
diff --git a/software_renderer/icon_info.hpp b/software_renderer/icon_info.hpp
index 23fdc83d4c..9460decca8 100644
--- a/software_renderer/icon_info.hpp
+++ b/software_renderer/icon_info.hpp
@@ -1,16 +1,14 @@
#pragma once
-#include "std/string.hpp"
+#include <string>
namespace software_renderer
{
-
struct IconInfo
{
- string m_name;
-
IconInfo() = default;
- explicit IconInfo(string const & name) : m_name(name) {}
-};
+ explicit IconInfo(std::string const & name) : m_name(name) {}
-}
+ std::string m_name;
+};
+} // namespace software_renderer
diff --git a/software_renderer/path_info.hpp b/software_renderer/path_info.hpp
index 2c558d51ed..200b3446d9 100644
--- a/software_renderer/path_info.hpp
+++ b/software_renderer/path_info.hpp
@@ -3,19 +3,20 @@
#include "geometry/point2d.hpp"
#include "geometry/rect2d.hpp"
-#include "std/vector.hpp"
-#include "std/algorithm.hpp"
+#include "base/assert.hpp"
+
+#include <algorithm>
+#include <vector>
namespace software_renderer
{
-
class PathInfo
{
double m_fullL;
double m_offset;
public:
- vector<m2::PointD> m_path;
+ std::vector<m2::PointD> m_path;
// -1.0 means "not" initialized
explicit PathInfo(double offset = -1.0) : m_fullL(-1.0), m_offset(offset) {}
@@ -89,8 +90,7 @@ public:
return rect;
}
};
-
-}
+} // namespace software_renderer
inline void swap(software_renderer::PathInfo & p1, software_renderer::PathInfo & p2)
{
diff --git a/software_renderer/proto_to_styles.cpp b/software_renderer/proto_to_styles.cpp
index e13841d2ba..ec4fa7353f 100644
--- a/software_renderer/proto_to_styles.cpp
+++ b/software_renderer/proto_to_styles.cpp
@@ -1,23 +1,20 @@
-#include "proto_to_styles.hpp"
+#include "software_renderer/proto_to_styles.hpp"
#include "indexer/drules_include.hpp"
-#include "std/algorithm.hpp"
-#include "std/vector.hpp"
+#include <algorithm>
+#include <vector>
namespace
{
-
double ConvertWidth(double w, double scale)
{
- return max(w * scale, 1.0);
-}
-
+ return std::max(w * scale, 1.0);
}
+} // namespace
namespace software_renderer
{
-
dp::Color ConvertColor(uint32_t c)
{
return dp::Extract(c, 255 - (c >> 24));
@@ -26,7 +23,7 @@ dp::Color ConvertColor(uint32_t c)
void ConvertStyle(LineDefProto const * pSrc, double scale, PenInfo & dest)
{
double offset = 0.0;
- vector<double> v;
+ std::vector<double> v;
if (pSrc->has_dashdot())
{
@@ -129,5 +126,4 @@ uint8_t GetFontSize(CaptionDefProto const * pSrc)
{
return pSrc->height();
}
-
-}
+} // namespace software_renderer
diff --git a/software_renderer/proto_to_styles.hpp b/software_renderer/proto_to_styles.hpp
index a4dccb05ac..825847bed5 100644
--- a/software_renderer/proto_to_styles.hpp
+++ b/software_renderer/proto_to_styles.hpp
@@ -17,7 +17,6 @@ class ShieldRuleProto;
namespace software_renderer
{
-
dp::Color ConvertColor(uint32_t c);
void ConvertStyle(LineDefProto const * pSrc, double scale, PenInfo & dest);
@@ -27,5 +26,4 @@ void ConvertStyle(CaptionDefProto const * pSrc, double scale, dp::FontDecl & des
void ConvertStyle(ShieldRuleProto const * pSrc, double scale, dp::FontDecl & dest);
uint8_t GetFontSize(CaptionDefProto const * pSrc);
-
-}
+} // namespace software_renderer
diff --git a/software_renderer/rect.h b/software_renderer/rect.h
index 2a56b38b5c..8e780132a0 100644
--- a/software_renderer/rect.h
+++ b/software_renderer/rect.h
@@ -1,7 +1,8 @@
#ifndef __IA__RECT__
#define __IA__RECT__
-#include "point.h"
+#include "software_renderer/point.h"
+
#include <iostream>
#include <climits>
diff --git a/software_renderer/text_engine.cpp b/software_renderer/text_engine.cpp
index c6ea397534..d89d4b8efd 100644
--- a/software_renderer/text_engine.cpp
+++ b/software_renderer/text_engine.cpp
@@ -1,6 +1,7 @@
-#include "text_engine.h"
+#include "software_renderer/text_engine.h"
#include <sstream>
+
#include <boost/format.hpp>
extern "C" const char default_font_data[741536];
@@ -459,4 +460,4 @@ text_engine::text_engine()
load_face("default", default_font_data, sizeof(default_font_data));
// face("default",16);
}
-}
+} // namespace ml
diff --git a/software_renderer/text_engine.h b/software_renderer/text_engine.h
index 2b8dd59f8b..0cb2211db7 100644
--- a/software_renderer/text_engine.h
+++ b/software_renderer/text_engine.h
@@ -1,25 +1,26 @@
#pragma once
+
#ifndef __ML__TEXT_ENGINE_H__
#define __ML__TEXT_ENGINE_H__
-#include <string>
-#include <stdexcept>
+
+#include "software_renderer/point.h"
+#include "software_renderer/rect.h"
+
+#include "base/string_utils.hpp"
+
+#include <cstdint>
#include <map>
+#include <stdexcept>
+#include <string>
+#include <utility>
#include <vector>
-#include <iostream>
#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_GLYPH_H
#include FT_STROKER_H
-#include "point.h"
-#include "rect.h"
-
-#include "base/string_utils.hpp"
-
-#include "std/utility.hpp"
-
namespace ml
{
class text_engine;
@@ -47,12 +48,12 @@ public:
void flip_y(bool f) { m_flip_y = f; }
face(ml::text_engine & e, std::string const & name, size_t size);
- inline std::string const & face_name() const { return m_face_name; }
- inline size_t face_size() const { return m_face_size; }
+ std::string const & face_name() const { return m_face_name; }
+ size_t face_size() const { return m_face_size; }
FT_Glyph glyph(unsigned int code, unsigned int prev_code = 0, ml::point_d * kerning = NULL);
- inline double ascender() const { return m_ascender; }
- inline double descender() const { return m_descender; }
- inline double height() const { return m_height; }
+ double ascender() const { return m_ascender; }
+ double descender() const { return m_descender; }
+ double height() const { return m_height; }
};
struct text_engine_exception : public std::runtime_error
@@ -199,7 +200,7 @@ protected:
class text_engine
{
typedef std::map<std::string, FT_Face> face_map_type;
- typedef std::map<pair<size_t, size_t>, face> face_cache_type;
+ typedef std::map<std::pair<size_t, size_t>, face> face_cache_type;
FT_Library m_library;
face_map_type m_faces;
FT_Face m_current_face;
@@ -218,7 +219,6 @@ public:
text_engine();
// ~text_engine() {} // TODO: destroy all faces before exit
};
-
} // namespace ml
#endif // __ML__TEXT_ENGINE_H__
diff --git a/storage/storage_integration_tests/storage_3levels_tests.cpp b/storage/storage_integration_tests/storage_3levels_tests.cpp
index 95bfe53022..47400a6aea 100644
--- a/storage/storage_integration_tests/storage_3levels_tests.cpp
+++ b/storage/storage_integration_tests/storage_3levels_tests.cpp
@@ -9,6 +9,7 @@
#include "base/file_name_utils.hpp"
+#include <algorithm>
#include <string>
#include "defines.hpp"
@@ -26,10 +27,9 @@ int GetLevelCount(Storage & storage, CountryId const & countryId)
storage.GetChildren(countryId, children);
int level = 0;
for (auto const & child : children)
- level = max(level, GetLevelCount(storage, child));
+ level = std::max(level, GetLevelCount(storage, child));
return 1 + level;
}
-
} // namespace
UNIT_TEST(SmallMwms_3levels_Test)