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
path: root/coding
diff options
context:
space:
mode:
authortatiana-yan <tatiana.kondakova@gmail.com>2019-04-12 15:52:08 +0300
committermpimenov <mpimenov@users.noreply.github.com>2019-04-12 18:30:29 +0300
commita685936cae13b6a51028d1db0d023c5ab8ba09ca (patch)
treebeaa4ed74e5283b4ed7362f6362279ba86f07946 /coding
parentce150f2169b1539eda6e845230102c8eca6e4d3a (diff)
[std] Use new include style for coding, fixes.
Diffstat (limited to 'coding')
-rw-r--r--coding/bit_streams.hpp24
-rw-r--r--coding/coding_tests/bit_streams_test.cpp10
-rw-r--r--coding/coding_tests/diff_test.cpp12
-rw-r--r--coding/coding_tests/elias_coder_test.cpp8
-rw-r--r--coding/coding_tests/file_container_test.cpp5
-rw-r--r--coding/coding_tests/file_data_test.cpp6
-rw-r--r--coding/coding_tests/file_sort_test.cpp8
-rw-r--r--coding/coding_tests/geometry_coding_test.cpp5
-rw-r--r--coding/coding_tests/hex_test.cpp7
-rw-r--r--coding/coding_tests/huffman_test.cpp7
-rw-r--r--coding/coding_tests/mem_file_writer_test.cpp9
-rw-r--r--coding/coding_tests/png_decoder_test.cpp16
-rw-r--r--coding/coding_tests/reader_writer_ops_test.cpp7
-rw-r--r--coding/coding_tests/simple_dense_coding_test.cpp9
-rw-r--r--coding/coding_tests/succinct_mapper_test.cpp7
-rw-r--r--coding/coding_tests/traffic_test.cpp6
-rw-r--r--coding/coding_tests/value_opt_string_test.cpp12
-rw-r--r--coding/coding_tests/var_record_reader_test.cpp15
-rw-r--r--coding/coding_tests/var_serial_vector_test.cpp12
-rw-r--r--coding/coding_tests/writer_test.cpp6
-rw-r--r--coding/coding_tests/zip_creator_test.cpp5
-rw-r--r--coding/coding_tests/zlib_test.cpp14
-rw-r--r--coding/diff.hpp21
-rw-r--r--coding/elias_coder.hpp2
-rw-r--r--coding/endianness.hpp11
-rw-r--r--coding/fixed_bits_ddvector.hpp2
-rw-r--r--coding/geometry_coding.hpp2
-rw-r--r--coding/huffman.cpp7
-rw-r--r--coding/huffman.hpp11
-rw-r--r--coding/internal/file64_api.hpp2
-rw-r--r--coding/internal/file_data.cpp15
-rw-r--r--coding/internal/file_data.hpp36
-rw-r--r--coding/map_uint32_to_val.hpp5
-rw-r--r--coding/read_write_utils.hpp22
-rw-r--r--coding/reader_writer_ops.cpp35
-rw-r--r--coding/streams_sink.hpp11
-rw-r--r--coding/string_utf8_multilang.hpp12
-rw-r--r--coding/value_opt_string.hpp52
-rw-r--r--coding/varint.hpp42
-rw-r--r--coding/writer.hpp54
40 files changed, 335 insertions, 217 deletions
diff --git a/coding/bit_streams.hpp b/coding/bit_streams.hpp
index c79249cbc7..a8743e8da4 100644
--- a/coding/bit_streams.hpp
+++ b/coding/bit_streams.hpp
@@ -4,9 +4,10 @@
#include "base/bits.hpp"
#include "base/logging.hpp"
-#include "std/algorithm.hpp"
-#include "std/cstdint.hpp"
-#include "std/limits.hpp"
+#include <algorithm>
+#include <climits>
+#include <cstdint>
+#include <limits>
namespace
{
@@ -72,13 +73,13 @@ public:
}
}
-#define WRITE_BYTE() \
- { \
- Write(bits, min(kMinBits, n)); \
- if (n <= kMinBits) \
- return; \
- n -= kMinBits; \
- bits >>= kMinBits; \
+#define WRITE_BYTE() \
+ { \
+ Write(bits, std::min(kMinBits, n)); \
+ if (n <= kMinBits) \
+ return; \
+ n -= kMinBits; \
+ bits >>= kMinBits; \
}
// Same as Write but accept up to 32 bits to write.
@@ -171,7 +172,8 @@ public:
#define READ_BYTE(i) \
{ \
- result = result | (static_cast<decltype(result)>(Read(min(n, kMinBits))) << (i * kMinBits)); \
+ result = \
+ result | (static_cast<decltype(result)>(Read(std::min(n, kMinBits))) << (i * kMinBits)); \
if (n <= kMinBits) \
return result; \
n -= kMinBits; \
diff --git a/coding/coding_tests/bit_streams_test.cpp b/coding/coding_tests/bit_streams_test.cpp
index 0b060403fd..704b04d54c 100644
--- a/coding/coding_tests/bit_streams_test.cpp
+++ b/coding/coding_tests/bit_streams_test.cpp
@@ -7,9 +7,13 @@
#include "base/assert.hpp"
#include "base/bits.hpp"
-#include "std/random.hpp"
-#include "std/utility.hpp"
-#include "std/vector.hpp"
+#include <cstddef>
+#include <cstdint>
+#include <random>
+#include <utility>
+#include <vector>
+
+using namespace std;
namespace
{
diff --git a/coding/coding_tests/diff_test.cpp b/coding/coding_tests/diff_test.cpp
index 649a7a4a65..5e86ff3f06 100644
--- a/coding/coding_tests/diff_test.cpp
+++ b/coding/coding_tests/diff_test.cpp
@@ -1,13 +1,19 @@
#include "testing/testing.hpp"
-#include "coding/diff.hpp"
#include "coding/byte_stream.hpp"
#include "coding/dd_vector.hpp"
+#include "coding/diff.hpp"
#include "coding/reader.hpp"
+
#include "base/rolling_hash.hpp"
-#include "std/string.hpp"
-#include "std/sstream.hpp"
+#include <cstddef>
+#include <cstdint>
+#include <sstream>
+#include <string>
+#include <vector>
+
+using namespace std;
UNIT_TEST(MyersSimpleDiff)
{
diff --git a/coding/coding_tests/elias_coder_test.cpp b/coding/coding_tests/elias_coder_test.cpp
index 1abab6283d..d60570db44 100644
--- a/coding/coding_tests/elias_coder_test.cpp
+++ b/coding/coding_tests/elias_coder_test.cpp
@@ -7,14 +7,16 @@
#include "base/bits.hpp"
-#include "std/vector.hpp"
+#include <cstdint>
+#include <string>
+#include <vector>
namespace
{
template <typename TCoder>
-void TestCoder(string const & name)
+void TestCoder(std::string const & name)
{
- using TBuffer = vector<uint8_t>;
+ using TBuffer = std::vector<uint8_t>;
using TWriter = MemWriter<TBuffer>;
uint64_t const kMask = 0xfedcba9876543210;
diff --git a/coding/coding_tests/file_container_test.cpp b/coding/coding_tests/file_container_test.cpp
index 2eb64205df..7ee0804862 100644
--- a/coding/coding_tests/file_container_test.cpp
+++ b/coding/coding_tests/file_container_test.cpp
@@ -7,6 +7,11 @@
#include "base/string_utils.hpp"
#include "base/scope_guard.hpp"
+#include <cstddef>
+#include <cstdint>
+#include <string>
+
+using namespace std;
UNIT_TEST(FilesContainer_Smoke)
{
diff --git a/coding/coding_tests/file_data_test.cpp b/coding/coding_tests/file_data_test.cpp
index c4399ff7ed..d7ba2185e0 100644
--- a/coding/coding_tests/file_data_test.cpp
+++ b/coding/coding_tests/file_data_test.cpp
@@ -5,6 +5,12 @@
#include "base/logging.hpp"
+#include <cstddef>
+#include <cstdint>
+#include <string>
+#include <vector>
+
+using namespace std;
namespace
{
diff --git a/coding/coding_tests/file_sort_test.cpp b/coding/coding_tests/file_sort_test.cpp
index 51f75f28bf..b019accc80 100644
--- a/coding/coding_tests/file_sort_test.cpp
+++ b/coding/coding_tests/file_sort_test.cpp
@@ -4,7 +4,13 @@
#include "coding/write_to_sink.hpp"
#include "coding/reader.hpp"
-#include "std/random.hpp"
+#include <algorithm>
+#include <cstddef>
+#include <cstdint>
+#include <random>
+#include <vector>
+
+using namespace std;
namespace
{
diff --git a/coding/coding_tests/geometry_coding_test.cpp b/coding/coding_tests/geometry_coding_test.cpp
index 0af921ffec..8362b8c487 100644
--- a/coding/coding_tests/geometry_coding_test.cpp
+++ b/coding/coding_tests/geometry_coding_test.cpp
@@ -14,7 +14,12 @@
#include "base/logging.hpp"
+#include <cstddef>
+#include <cstdint>
+#include <vector>
+
using namespace coding;
+using namespace std;
using PU = m2::PointU;
diff --git a/coding/coding_tests/hex_test.cpp b/coding/coding_tests/hex_test.cpp
index aabc66f4fc..7e51829950 100644
--- a/coding/coding_tests/hex_test.cpp
+++ b/coding/coding_tests/hex_test.cpp
@@ -2,9 +2,12 @@
#include "coding/hex.hpp"
-#include "std/random.hpp"
-#include "std/string.hpp"
+#include <cstddef>
+#include <cstdint>
+#include <random>
+#include <string>
+using namespace std;
UNIT_TEST(GoldenRecode)
{
diff --git a/coding/coding_tests/huffman_test.cpp b/coding/coding_tests/huffman_test.cpp
index fbf0630401..4c5d957bb1 100644
--- a/coding/coding_tests/huffman_test.cpp
+++ b/coding/coding_tests/huffman_test.cpp
@@ -6,7 +6,12 @@
#include "base/string_utils.hpp"
-#include "std/vector.hpp"
+#include <cstddef>
+#include <cstdint>
+#include <string>
+#include <vector>
+
+using namespace std;
namespace
{
diff --git a/coding/coding_tests/mem_file_writer_test.cpp b/coding/coding_tests/mem_file_writer_test.cpp
index bd3a9e2ad4..a233a70984 100644
--- a/coding/coding_tests/mem_file_writer_test.cpp
+++ b/coding/coding_tests/mem_file_writer_test.cpp
@@ -5,20 +5,21 @@
#include "base/macros.hpp"
+#include <vector>
UNIT_TEST(MemWriterEmpty)
{
- vector<char> data;
+ std::vector<char> data;
{
- MemWriter< vector<char> > writer(data);
+ MemWriter<std::vector<char>> writer(data);
}
TEST(data.empty(), (data));
}
UNIT_TEST(MemWriterSimple)
{
- vector<char> data;
- MemWriter< vector<char> > writer(data);
+ std::vector<char> data;
+ MemWriter<std::vector<char>> writer(data);
writer.Write("Hello", 5);
writer.Write(",", 1);
writer.Write("world!", 6);
diff --git a/coding/coding_tests/png_decoder_test.cpp b/coding/coding_tests/png_decoder_test.cpp
index 74e4638535..f014480327 100644
--- a/coding/coding_tests/png_decoder_test.cpp
+++ b/coding/coding_tests/png_decoder_test.cpp
@@ -1,18 +1,20 @@
#include "testing/testing.hpp"
-#include "std/string.hpp"
-#include "std/fstream.hpp"
-#include "std/vector.hpp"
+#include <fstream>
+#include <string>
+#include <vector>
+
+using namespace std;
void loadFile(vector<unsigned char> & buffer, string const & filename) //designed for loading files from hard disk in an std::vector
{
- ifstream file(filename.c_str(), std::ios::in|std::ios::binary|std::ios::ate);
+ ifstream file(filename.c_str(), ios::in | ios::binary | ios::ate);
// get filesize
- std::streamsize size = 0;
- if (file.seekg(0, std::ios::end).good())
+ streamsize size = 0;
+ if (file.seekg(0, ios::end).good())
size = file.tellg();
- if (file.seekg(0, std::ios::beg).good())
+ if (file.seekg(0, ios::beg).good())
size -= file.tellg();
// read contents of the file into the vector
diff --git a/coding/coding_tests/reader_writer_ops_test.cpp b/coding/coding_tests/reader_writer_ops_test.cpp
index ecf6ff2081..38837e6779 100644
--- a/coding/coding_tests/reader_writer_ops_test.cpp
+++ b/coding/coding_tests/reader_writer_ops_test.cpp
@@ -6,8 +6,13 @@
#include "coding/read_write_utils.hpp"
#include "coding/byte_stream.hpp"
-#include "std/algorithm.hpp"
+#include <algorithm>
+#include <cstddef>
+#include <cstdint>
+#include <random>
+#include <vector>
+using namespace std;
namespace
{
diff --git a/coding/coding_tests/simple_dense_coding_test.cpp b/coding/coding_tests/simple_dense_coding_test.cpp
index 109a74f188..9f67297a4c 100644
--- a/coding/coding_tests/simple_dense_coding_test.cpp
+++ b/coding/coding_tests/simple_dense_coding_test.cpp
@@ -8,11 +8,14 @@
#include "base/logging.hpp"
#include "base/scope_guard.hpp"
-#include "std/limits.hpp"
-#include "std/string.hpp"
-#include "std/vector.hpp"
+#include <cstddef>
+#include <cstdint>
+#include <limits>
+#include <string>
+#include <vector>
using namespace coding;
+using namespace std;
namespace
{
diff --git a/coding/coding_tests/succinct_mapper_test.cpp b/coding/coding_tests/succinct_mapper_test.cpp
index 02e77844d7..1d510d9b8f 100644
--- a/coding/coding_tests/succinct_mapper_test.cpp
+++ b/coding/coding_tests/succinct_mapper_test.cpp
@@ -3,7 +3,8 @@
#include "coding/succinct_mapper.hpp"
#include "coding/writer.hpp"
-#include "std/vector.hpp"
+#include <cstdint>
+#include <vector>
#include "3party/succinct/mapper.hpp"
@@ -24,7 +25,7 @@ UNIT_TEST(ReverseMapper_Smoke)
UNIT_TEST(Freeze_Smoke)
{
- vector<uint8_t> data;
+ std::vector<uint8_t> data;
{
MemWriter<decltype(data)> writer(data);
uint64_t const data = 0x0123456789abcdef;
@@ -39,7 +40,7 @@ UNIT_TEST(Freeze_Smoke)
UNIT_TEST(ReverseFreeze_Smoke)
{
- vector<uint8_t> data;
+ std::vector<uint8_t> data;
{
MemWriter<decltype(data)> writer(data);
uint64_t const data = 0x0123456789abcdef;
diff --git a/coding/coding_tests/traffic_test.cpp b/coding/coding_tests/traffic_test.cpp
index acc7c01922..2ba6b3e034 100644
--- a/coding/coding_tests/traffic_test.cpp
+++ b/coding/coding_tests/traffic_test.cpp
@@ -8,6 +8,12 @@
#include "base/logging.hpp"
#include "base/math.hpp"
+#include <cstddef>
+#include <cstdint>
+#include <vector>
+
+using namespace std;
+
namespace coding
{
double CalculateLength(vector<TrafficGPSEncoder::DataPoint> const & path)
diff --git a/coding/coding_tests/value_opt_string_test.cpp b/coding/coding_tests/value_opt_string_test.cpp
index e700fe9c58..14857c92fe 100644
--- a/coding/coding_tests/value_opt_string_test.cpp
+++ b/coding/coding_tests/value_opt_string_test.cpp
@@ -1,10 +1,16 @@
#include "testing/testing.hpp"
-#include "coding/value_opt_string.hpp"
-
#include "coding/reader.hpp"
+#include "coding/value_opt_string.hpp"
#include "coding/writer.hpp"
+#include <algorithm>
+#include <cstddef>
+#include <cstdint>
+#include <string>
+#include <vector>
+
+using namespace std;
namespace
{
@@ -55,7 +61,7 @@ UNIT_TEST(StringNumericOptimal_StringCoding)
UNIT_TEST(StringNumericOptimal_LargeStringCoding)
{
string s;
- std::fill_n(back_inserter(s), 10000, 'x');
+ fill_n(back_inserter(s), 10000, 'x');
TestStringCodingT(&s, 1, 10006);
}
diff --git a/coding/coding_tests/var_record_reader_test.cpp b/coding/coding_tests/var_record_reader_test.cpp
index b72ae6784e..81b05c07a0 100644
--- a/coding/coding_tests/var_record_reader_test.cpp
+++ b/coding/coding_tests/var_record_reader_test.cpp
@@ -1,12 +1,19 @@
#include "testing/testing.hpp"
+
+#include "coding/reader.hpp"
#include "coding/var_record_reader.hpp"
#include "coding/varint.hpp"
-#include "coding/reader.hpp"
#include "coding/writer.hpp"
+
#include "base/macros.hpp"
-#include "std/string.hpp"
-#include "std/utility.hpp"
-#include "std/vector.hpp"
+
+#include <cstddef>
+#include <cstdint>
+#include <string>
+#include <utility>
+#include <vector>
+
+using namespace std;
namespace
{
diff --git a/coding/coding_tests/var_serial_vector_test.cpp b/coding/coding_tests/var_serial_vector_test.cpp
index 4bed2a5216..fa11c71c8c 100644
--- a/coding/coding_tests/var_serial_vector_test.cpp
+++ b/coding/coding_tests/var_serial_vector_test.cpp
@@ -1,18 +1,20 @@
-#include "coding/var_serial_vector.hpp"
-
#include "testing/testing.hpp"
#include "coding/byte_stream.hpp"
#include "coding/hex.hpp"
#include "coding/reader.hpp"
+#include "coding/var_serial_vector.hpp"
#include "coding/writer.hpp"
#include "base/macros.hpp"
-#include "std/random.hpp"
-#include "std/string.hpp"
-#include "std/vector.hpp"
+#include <cstddef>
+#include <cstdint>
+#include <random>
+#include <string>
+#include <vector>
+using namespace std;
char const kHexSerial[] = "03000000" "01000000" "04000000" "06000000" "616263646566";
diff --git a/coding/coding_tests/writer_test.cpp b/coding/coding_tests/writer_test.cpp
index 2f9de2aacb..8b0c9ef43a 100644
--- a/coding/coding_tests/writer_test.cpp
+++ b/coding/coding_tests/writer_test.cpp
@@ -4,6 +4,12 @@
#include "coding/file_reader.hpp"
#include "coding/internal/file_data.hpp"
+#include <cstddef>
+#include <cstdint>
+#include <string>
+#include <vector>
+
+using namespace std;
namespace
{
diff --git a/coding/coding_tests/zip_creator_test.cpp b/coding/coding_tests/zip_creator_test.cpp
index 5ed368c7e0..5ac0abcaf9 100644
--- a/coding/coding_tests/zip_creator_test.cpp
+++ b/coding/coding_tests/zip_creator_test.cpp
@@ -6,9 +6,10 @@
#include "coding/file_writer.hpp"
#include "coding/constants.hpp"
-#include "std/string.hpp"
-#include "std/vector.hpp"
+#include <string>
+#include <vector>
+using namespace std;
namespace
{
diff --git a/coding/coding_tests/zlib_test.cpp b/coding/coding_tests/zlib_test.cpp
index 4d434dd962..4118ebd3a1 100644
--- a/coding/coding_tests/zlib_test.cpp
+++ b/coding/coding_tests/zlib_test.cpp
@@ -5,14 +5,16 @@
#include "base/macros.hpp"
#include "base/string_utils.hpp"
-#include "std/cstdint.hpp"
-#include "std/iterator.hpp"
-#include "std/sstream.hpp"
-#include "std/string.hpp"
-#include "std/utility.hpp"
-#include "std/vector.hpp"
+#include <cstddef>
+#include <cstdint>
+#include <iterator>
+#include <sstream>
+#include <string>
+#include <utility>
+#include <vector>
using namespace coding;
+using namespace std;
using Deflate = ZLib::Deflate;
using Inflate = ZLib::Inflate;
diff --git a/coding/diff.hpp b/coding/diff.hpp
index 9468f3c118..15f386294a 100644
--- a/coding/diff.hpp
+++ b/coding/diff.hpp
@@ -3,10 +3,12 @@
#include "base/assert.hpp"
#include "base/base.hpp"
-#include "std/algorithm.hpp"
-#include "std/unordered_map.hpp"
-#include "std/utility.hpp"
-#include "std/vector.hpp"
+#include <algorithm>
+#include <cstddef>
+#include <cstdint>
+#include <unordered_map>
+#include <utility>
+#include <vector>
namespace diff
{
@@ -95,7 +97,7 @@ TSignedWord DiffMyersSimple(TSrcVector const & A,
TTmpFileSink & tmpSink)
{
ASSERT_GREATER(maxPatchSize, 0, ());
- vector<TSignedWord> V(2 * maxPatchSize + 1);
+ std::vector<TSignedWord> V(2 * maxPatchSize + 1);
for (TSignedWord d = 0; d <= maxPatchSize; ++d)
{
for (TSignedWord k = -d; k <= d; k += 2)
@@ -145,9 +147,8 @@ public:
// into chunks of size m_BlockSize, finds equal chunks in the destination sequence, using rolling
// hash to find good candidates, writes info about equal chunks into patchCoder and for everything
// between equal chunks, calls FineGrainedDiff::Diff().
-template <class FineGrainedDiffT,
- class HasherT,
- class HashPosMultiMapT = unordered_multimap<typename HasherT::hash_type, uint64_t> >
+template <class FineGrainedDiffT, class HasherT,
+ class HashPosMultiMapT = std::unordered_multimap<typename HasherT::hash_type, uint64_t>>
class RollingHashDiffer
{
public:
@@ -176,7 +177,7 @@ public:
hash_type h = hasher.Init(dst, m_BlockSize);
while (dstNext != dstEnd)
{
- pair<HashPosMultiMapIterator, HashPosMultiMapIterator> iters = srcHashes.equal_range(h);
+ std::pair<HashPosMultiMapIterator, HashPosMultiMapIterator> iters = srcHashes.equal_range(h);
if (iters.first != iters.second)
{
pos_type const srcLastDiffPos = srcLastDiff - srcBeg;
@@ -186,7 +187,7 @@ public:
(it == srcHashes.end() || i->second < it->second))
it = i;
if (it != srcHashes.end() &&
- equal(srcBeg + it->second, srcBeg + it->second + m_BlockSize, dst))
+ std::equal(srcBeg + it->second, srcBeg + it->second + m_BlockSize, dst))
{
pos_type srcBlockEqualPos = it->second;
m_FineGrainedDiff.Diff(srcLastDiff, srcBeg + srcBlockEqualPos,
diff --git a/coding/elias_coder.hpp b/coding/elias_coder.hpp
index 47b183b4b1..ad84e1cd52 100644
--- a/coding/elias_coder.hpp
+++ b/coding/elias_coder.hpp
@@ -5,7 +5,7 @@
#include "base/assert.hpp"
#include "base/bits.hpp"
-#include "std/cstdint.hpp"
+#include <cstdint>
namespace coding
{
diff --git a/coding/endianness.hpp b/coding/endianness.hpp
index 39b4edc3b2..21d8fc809d 100644
--- a/coding/endianness.hpp
+++ b/coding/endianness.hpp
@@ -2,9 +2,8 @@
#include "base/base.hpp"
-#include "std/type_traits.hpp"
-
#include <cstddef>
+#include <type_traits>
// #define ENDIAN_IS_BIG
@@ -24,9 +23,10 @@ inline bool IsBigEndianMacroBased()
#endif
}
-template <typename T> T ReverseByteOrder(T t)
+template <typename T>
+T ReverseByteOrder(T t)
{
- static_assert(is_integral<T>::value, "Only integral types are supported.");
+ static_assert(std::is_integral<T>::value, "Only integral types are supported.");
T res;
char const * a = reinterpret_cast<char const *>(&t);
@@ -36,7 +36,8 @@ template <typename T> T ReverseByteOrder(T t)
return res;
}
-template <typename T> inline T SwapIfBigEndianMacroBased(T t)
+template <typename T>
+T SwapIfBigEndianMacroBased(T t)
{
#ifdef ENDIAN_IS_BIG
return ReverseByteOrder(t);
diff --git a/coding/fixed_bits_ddvector.hpp b/coding/fixed_bits_ddvector.hpp
index 5dbde6dcdb..45ea702e36 100644
--- a/coding/fixed_bits_ddvector.hpp
+++ b/coding/fixed_bits_ddvector.hpp
@@ -89,7 +89,7 @@ public:
uint64_t const off1 = sizeof(TSize);
uint64_t const off2 = AlignBytesCount((size * Bits + CHAR_BIT - 1) / CHAR_BIT) + off1;
- // We can not use make_unique here because contsructor is private.
+ // We cannot use make_unique here because contsructor is private.
return std::unique_ptr<TSelf>(new TSelf(reader.SubReader(off1, off2 - off1),
reader.SubReader(off2, reader.Size() - off2), size));
}
diff --git a/coding/geometry_coding.hpp b/coding/geometry_coding.hpp
index cc55a67fb1..e78709da29 100644
--- a/coding/geometry_coding.hpp
+++ b/coding/geometry_coding.hpp
@@ -365,7 +365,7 @@ public:
WriteVarUint(sink, static_cast<uint32_t>(count));
std::for_each(m_buffers.begin(), m_buffers.end(),
- std::bind(&WriteBufferToSink<TSink>, std::placeholders::_1, ref(sink)));
+ std::bind(&WriteBufferToSink<TSink>, std::placeholders::_1, std::ref(sink)));
}
};
} // namespace serial
diff --git a/coding/huffman.cpp b/coding/huffman.cpp
index e663a2b80c..0e6f2af9ed 100644
--- a/coding/huffman.cpp
+++ b/coding/huffman.cpp
@@ -2,6 +2,11 @@
#include "base/logging.hpp"
+#include <queue>
+#include <utility>
+
+using namespace std;
+
namespace coding
{
HuffmanCoder::~HuffmanCoder()
@@ -61,7 +66,7 @@ void HuffmanCoder::DeleteHuffmanTree(Node * root)
void HuffmanCoder::BuildHuffmanTree(Freqs const & freqs)
{
- std::priority_queue<Node *, std::vector<Node *>, NodeComparator> pq;
+ priority_queue<Node *, vector<Node *>, NodeComparator> pq;
for (auto const & e : freqs.GetTable())
pq.push(new Node(e.first, e.second, true /* isLeaf */));
diff --git a/coding/huffman.hpp b/coding/huffman.hpp
index 47f9a3f438..7ff687b1be 100644
--- a/coding/huffman.hpp
+++ b/coding/huffman.hpp
@@ -8,10 +8,11 @@
#include "base/string_utils.hpp"
#include <algorithm>
+#include <cstddef>
+#include <cstdint>
#include <iterator>
#include <map>
#include <memory>
-#include <queue>
#include <type_traits>
#include <vector>
@@ -40,7 +41,7 @@ public:
template <typename T>
void Add(T const * begin, T const * const end)
{
- static_assert(is_integral<T>::value, "");
+ static_assert(std::is_integral<T>::value, "");
AddImpl(begin, end);
}
@@ -170,14 +171,14 @@ public:
template <typename TWriter, typename T>
uint32_t EncodeAndWrite(TWriter & writer, T const * begin, T const * end) const
{
- static_assert(is_integral<T>::value, "");
+ static_assert(std::is_integral<T>::value, "");
return EncodeAndWriteImpl(writer, begin, end);
}
template <typename TWriter, typename It>
uint32_t EncodeAndWrite(TWriter & writer, It begin, It end) const
{
- static_assert(is_integral<typename It::value_type>::value, "");
+ static_assert(std::is_integral<typename It::value_type>::value, "");
return EncodeAndWriteImpl(writer, begin, end);
}
@@ -262,7 +263,7 @@ private:
{
static_assert(sizeof(*begin) <= 4, "");
- size_t const d = base::asserted_cast<size_t>(distance(begin, end));
+ size_t const d = base::asserted_cast<size_t>(std::distance(begin, end));
BitWriter<TWriter> bitWriter(writer);
WriteVarUint(writer, d);
uint32_t sz = 0;
diff --git a/coding/internal/file64_api.hpp b/coding/internal/file64_api.hpp
index 10f424509d..f853a83ca4 100644
--- a/coding/internal/file64_api.hpp
+++ b/coding/internal/file64_api.hpp
@@ -29,4 +29,4 @@
#endif
-#include "std/cstdio.hpp"
+#include <cstdio>
diff --git a/coding/internal/file_data.cpp b/coding/internal/file_data.cpp
index 8a8ff3df58..880e090e4b 100644
--- a/coding/internal/file_data.cpp
+++ b/coding/internal/file_data.cpp
@@ -8,12 +8,15 @@
#include "base/logging.hpp"
#include "base/string_utils.hpp"
-#include "std/cerrno.hpp"
-#include "std/cstring.hpp"
-#include "std/exception.hpp"
-#include "std/fstream.hpp"
#include "std/target_os.hpp"
-#include "std/thread.hpp"
+
+#include <algorithm>
+#include <cerrno>
+#include <cstring>
+#include <exception>
+#include <fstream>
+#include <thread>
+#include <vector>
#ifdef OMIM_OS_WINDOWS
#include <io.h>
@@ -23,6 +26,8 @@
#include "tizen/inc/FIo.hpp"
#endif
+using namespace std;
+
namespace base
{
FileData::FileData(string const & fileName, Op op)
diff --git a/coding/internal/file_data.hpp b/coding/internal/file_data.hpp
index d794ac23dc..f46c2bea4a 100644
--- a/coding/internal/file_data.hpp
+++ b/coding/internal/file_data.hpp
@@ -2,12 +2,15 @@
#include "coding/internal/file64_api.hpp"
#include "base/base.hpp"
+#include "base/macros.hpp"
-#include "std/functional.hpp"
-#include "std/noncopyable.hpp"
-#include "std/string.hpp"
#include "std/target_os.hpp"
+#include <cstddef>
+#include <cstdint>
+#include <functional>
+#include <string>
+
#ifdef OMIM_OS_TIZEN
namespace Tizen
{
@@ -20,13 +23,13 @@ namespace Tizen
namespace base
{
-class FileData: private noncopyable
+class FileData
{
public:
/// @note Do not change order (@see FileData::FileData).
enum Op { OP_READ = 0, OP_WRITE_TRUNCATE, OP_WRITE_EXISTING, OP_APPEND };
- FileData(string const & fileName, Op op);
+ FileData(std::string const & fileName, Op op);
~FileData();
uint64_t Size() const;
@@ -40,7 +43,7 @@ public:
void Flush();
void Truncate(uint64_t sz);
- string const & GetName() const { return m_FileName; }
+ std::string const & GetName() const { return m_FileName; }
private:
@@ -49,22 +52,25 @@ private:
#else
FILE * m_File;
#endif
- string m_FileName;
+ std::string m_FileName;
Op m_Op;
- string GetErrorProlog() const;
+ std::string GetErrorProlog() const;
+
+ DISALLOW_COPY(FileData);
};
-bool GetFileSize(string const & fName, uint64_t & sz);
-bool DeleteFileX(string const & fName);
-bool RenameFileX(string const & fOld, string const & fNew);
+bool GetFileSize(std::string const & fName, uint64_t & sz);
+bool DeleteFileX(std::string const & fName);
+bool RenameFileX(std::string const & fOld, std::string const & fNew);
/// Write to temp file and rename it to dest. Delete temp on failure.
/// @param write function that writes to file with a given name, returns true on success.
-bool WriteToTempAndRenameToFile(string const & dest, function<bool(string const &)> const & write,
- string const & tmp = "");
+bool WriteToTempAndRenameToFile(std::string const & dest,
+ std::function<bool(std::string const &)> const & write,
+ std::string const & tmp = "");
/// @return false if copy fails. DO NOT THROWS exceptions
-bool CopyFileX(string const & fOld, string const & fNew);
-bool IsEqualFiles(string const & firstFile, string const & secondFile);
+bool CopyFileX(std::string const & fOld, std::string const & fNew);
+bool IsEqualFiles(std::string const & firstFile, std::string const & secondFile);
} // namespace base
diff --git a/coding/map_uint32_to_val.hpp b/coding/map_uint32_to_val.hpp
index dd6606937b..29a97c009b 100644
--- a/coding/map_uint32_to_val.hpp
+++ b/coding/map_uint32_to_val.hpp
@@ -25,6 +25,7 @@
#pragma clang diagnostic pop
#endif
+#include <algorithm>
#include <cstdint>
#include <functional>
#include <memory>
@@ -302,12 +303,12 @@ public:
std::vector<uint8_t> variables;
{
- MemWriter<vector<uint8_t>> writer(variables);
+ MemWriter<std::vector<uint8_t>> writer(variables);
for (size_t i = 0; i < m_values.size(); i += Map::kBlockSize)
{
offsets.push_back(static_cast<uint32_t>(variables.size()));
- auto const endOffset = min(i + Map::kBlockSize, m_values.size());
+ auto const endOffset = std::min(i + Map::kBlockSize, m_values.size());
CHECK_GREATER(endOffset, i, ());
writeBlockCallback(writer, m_values.cbegin() + i, m_values.cbegin() + endOffset);
}
diff --git a/coding/read_write_utils.hpp b/coding/read_write_utils.hpp
index 43ada6eefb..1ff8123c7a 100644
--- a/coding/read_write_utils.hpp
+++ b/coding/read_write_utils.hpp
@@ -4,10 +4,12 @@
#include "base/buffer_vector.hpp"
-#include "std/algorithm.hpp"
-#include "std/string.hpp"
-#include "std/vector.hpp"
-#include "std/type_traits.hpp"
+#include <algorithm>
+#include <cstddef>
+#include <cstdint>
+#include <string>
+#include <type_traits>
+#include <vector>
namespace rw
{
@@ -24,7 +26,7 @@ namespace rw
}
template <class TSink>
- void Write(TSink & sink, string const & s)
+ void Write(TSink & sink, std::string const & s)
{
uint32_t const count = static_cast<uint32_t>(s.size());
WriteVarUint(sink, count);
@@ -33,7 +35,7 @@ namespace rw
}
template <class TSource>
- void Read(TSource & src, string & s)
+ void Read(TSource & src, std::string & s)
{
uint32_t const count = ReadVarUint<uint32_t>(src);
s.resize(count);
@@ -63,13 +65,13 @@ namespace rw
}
template <class TSink, class T>
- void Write(TSink & sink, vector<T> const & v)
+ void Write(TSink & sink, std::vector<T> const & v)
{
impl::WriteCont(sink, v);
}
template <class TSource, class T>
- void Read(TSource & src, vector<T> & v)
+ void Read(TSource & src, std::vector<T> & v)
{
impl::ReadCont(src, v);
}
@@ -123,11 +125,11 @@ namespace rw
void ReadAndWrite(ReaderT & reader, WriterT & writer, size_t bufferSize = 4*1024)
{
uint64_t size = reader.Size();
- vector<char> buffer(min(bufferSize, static_cast<size_t>(size)));
+ std::vector<char> buffer(std::min(bufferSize, static_cast<size_t>(size)));
while (size > 0)
{
- size_t const curr = min(bufferSize, static_cast<size_t>(size));
+ size_t const curr = std::min(bufferSize, static_cast<size_t>(size));
reader.Read(&buffer[0], curr);
writer.Write(&buffer[0], curr);
diff --git a/coding/reader_writer_ops.cpp b/coding/reader_writer_ops.cpp
index 7f9d8d05e8..d13543e6df 100644
--- a/coding/reader_writer_ops.cpp
+++ b/coding/reader_writer_ops.cpp
@@ -1,27 +1,32 @@
#include "coding/reader_writer_ops.hpp"
+#include <algorithm>
+#include <cstddef>
+#include <cstdint>
+#include <vector>
+
namespace rw_ops
{
- void Reverse(Reader const & src, Writer & dest)
- {
- // Read from end, reverse and write directly.
+void Reverse(Reader const & src, Writer & dest)
+{
+ // Read from end, reverse and write directly.
- size_t const bufSz = 1024;
- vector<uint8_t> buffer(bufSz);
+ size_t const bufSz = 1024;
+ std::vector<uint8_t> buffer(bufSz);
- uint64_t pos = src.Size();
- while (pos > 0)
- {
- size_t const sz = pos > bufSz ? bufSz : pos;
- ASSERT_GREATER_OR_EQUAL(pos, sz, ());
+ uint64_t pos = src.Size();
+ while (pos > 0)
+ {
+ size_t const sz = pos > bufSz ? bufSz : pos;
+ ASSERT_GREATER_OR_EQUAL(pos, sz, ());
- src.Read(pos - sz, &buffer[0], sz);
+ src.Read(pos - sz, &buffer[0], sz);
- std::reverse(buffer.begin(), buffer.begin() + sz);
+ std::reverse(buffer.begin(), buffer.begin() + sz);
- dest.Write(&buffer[0], sz);
+ dest.Write(&buffer[0], sz);
- pos -= sz;
- }
+ pos -= sz;
}
}
+} // namespace rw_ops
diff --git a/coding/streams_sink.hpp b/coding/streams_sink.hpp
index 7ec514b446..bf5c8699c8 100644
--- a/coding/streams_sink.hpp
+++ b/coding/streams_sink.hpp
@@ -4,8 +4,9 @@
#include "coding/reader.hpp"
#include "coding/write_to_sink.hpp"
-#include "std/type_traits.hpp"
-
+#include <cstdint>
+#include <string>
+#include <type_traits>
namespace stream
{
@@ -17,7 +18,7 @@ namespace stream
SinkReaderStream(TReader & reader) : m_reader(reader) {}
template <typename T>
- enable_if_t<is_integral<T>::value, SinkReaderStream &> operator>>(T & t)
+ std::enable_if_t<std::is_integral<T>::value, SinkReaderStream &> operator>>(T & t)
{
t = ReadPrimitiveFromSource<T>(m_reader);
return (*this);
@@ -52,7 +53,7 @@ namespace stream
SinkWriterStream(TWriter & writer) : m_writer(writer) {}
template <typename T>
- enable_if_t<is_integral<T>::value, SinkWriterStream &> operator<<(T const & t)
+ std::enable_if_t<std::is_integral<T>::value, SinkWriterStream &> operator<<(T const & t)
{
WriteToSink(m_writer, t);
return (*this);
@@ -64,7 +65,7 @@ namespace stream
return (*this);
}
- SinkWriterStream & operator << (string const & t)
+ SinkWriterStream & operator<<(std::string const & t)
{
detail::WriteString(*this, m_writer, t);
return *this;
diff --git a/coding/string_utf8_multilang.hpp b/coding/string_utf8_multilang.hpp
index 105d52c6a5..68163d6e5e 100644
--- a/coding/string_utf8_multilang.hpp
+++ b/coding/string_utf8_multilang.hpp
@@ -87,7 +87,7 @@ public:
static Languages const & GetSupportedLanguages();
/// @returns kUnsupportedLanguageCode if language is not recognized.
- static int8_t GetLangIndex(string const & lang);
+ static int8_t GetLangIndex(std::string const & lang);
/// @returns empty string if langCode is invalid.
static char const * GetLangByCode(int8_t langCode);
/// @returns empty string if langCode is invalid.
@@ -101,8 +101,8 @@ public:
inline void Clear() { m_s.clear(); }
inline bool IsEmpty() const { return m_s.empty(); }
- void AddString(int8_t lang, string const & utf8s);
- void AddString(string const & lang, string const & utf8s)
+ void AddString(int8_t lang, std::string const & utf8s);
+ void AddString(std::string const & lang, std::string const & utf8s)
{
int8_t const l = GetLangIndex(lang);
if (l >= 0)
@@ -129,8 +129,8 @@ public:
}
}
- bool GetString(int8_t lang, string & utf8s) const;
- bool GetString(string const & lang, string & utf8s) const
+ bool GetString(int8_t lang, std::string & utf8s) const;
+ bool GetString(std::string const & lang, std::string & utf8s) const
{
int8_t const l = GetLangIndex(lang);
if (l >= 0)
@@ -141,7 +141,7 @@ public:
bool HasString(int8_t lang) const;
- int8_t FindString(string const & utf8s) const;
+ int8_t FindString(std::string const & utf8s) const;
size_t CountLangs() const;
template <class TSink>
diff --git a/coding/value_opt_string.hpp b/coding/value_opt_string.hpp
index b039860c51..9061f454c9 100644
--- a/coding/value_opt_string.hpp
+++ b/coding/value_opt_string.hpp
@@ -5,45 +5,46 @@
#include "base/string_utils.hpp"
#include "base/assert.hpp"
-#include "std/limits.hpp"
-#include "std/string.hpp"
-
+#include <cstddef>
+#include <cstdint>
+#include <limits>
+#include <string>
class StringNumericOptimal
{
- string m_s;
+ std::string m_s;
public:
- inline bool operator== (StringNumericOptimal const & rhs) const
- {
- return m_s == rhs.m_s;
- }
+ bool operator==(StringNumericOptimal const & rhs) const { return m_s == rhs.m_s; }
- inline void Set(string const & s)
+ void Set(std::string const & s)
{
- CHECK ( !s.empty(), () );
+ CHECK(!s.empty(), ());
m_s = s;
}
- inline void Set(char const * p)
+
+ void Set(char const * p)
{
m_s = p;
- CHECK ( !m_s.empty(), () );
+ CHECK(!m_s.empty(), ());
}
- template <class T> void Set(T const & s)
+
+ template <typename T>
+ void Set(T const & s)
{
m_s = strings::to_string(s);
- CHECK ( !m_s.empty(), () );
+ CHECK(!m_s.empty(), ());
}
- inline void Clear() { m_s.clear(); }
- inline bool IsEmpty() const { return m_s.empty(); }
- inline string const & Get() const { return m_s; }
+ void Clear() { m_s.clear(); }
+ bool IsEmpty() const { return m_s.empty(); }
+ std::string const & Get() const { return m_s; }
/// First uint64_t value is:
/// - a number if low control bit is 1;
/// - a string size-1 if low control bit is 0;
-
- template <class TSink> void Write(TSink & sink) const
+ template <typename TSink>
+ void Write(TSink & sink) const
{
// If string is a number and we have space for control bit
uint64_t n;
@@ -52,14 +53,15 @@ public:
else
{
size_t const sz = m_s.size();
- ASSERT_GREATER ( sz, 0, () );
+ ASSERT_GREATER(sz, 0, ());
WriteVarUint(sink, static_cast<uint32_t>((sz-1) << 1));
sink.Write(m_s.c_str(), sz);
}
}
- template <class TSource> void Read(TSource & src)
+ template <typename TSource>
+ void Read(TSource & src)
{
uint64_t sz = ReadVarUint<uint64_t>(src);
@@ -68,14 +70,12 @@ public:
else
{
sz = (sz >> 1) + 1;
- ASSERT_LESS_OR_EQUAL(sz, numeric_limits<size_t>::max(), ("sz is out of platform's range."));
+ ASSERT_LESS_OR_EQUAL(sz, std::numeric_limits<size_t>::max(),
+ ("sz is out of platform's range."));
m_s.resize(static_cast<size_t>(sz));
src.Read(&m_s[0], sz);
}
}
};
-inline string DebugPrint(StringNumericOptimal const & s)
-{
- return s.Get();
-}
+inline std::string DebugPrint(StringNumericOptimal const & s) { return s.Get(); }
diff --git a/coding/varint.hpp b/coding/varint.hpp
index b5de27a01a..48a9720163 100644
--- a/coding/varint.hpp
+++ b/coding/varint.hpp
@@ -9,13 +9,15 @@
#include "base/stl_helpers.hpp"
#include <cstddef>
+#include <cstdint>
#include <type_traits>
/// This function writes, using optimal bytes count.
/// Pass any integral type and it will write platform-independent.
-template <typename T, typename TSink> void WriteVarUint(TSink & dst, T value)
+template <typename T, typename TSink>
+void WriteVarUint(TSink & dst, T value)
{
- static_assert(is_unsigned<T>::value, "");
+ static_assert(std::is_unsigned<T>::value, "");
while (value > 127)
{
WriteToSink(dst, static_cast<uint8_t>((value & 127) | 128));
@@ -26,8 +28,8 @@ template <typename T, typename TSink> void WriteVarUint(TSink & dst, T value)
namespace impl
{
-
-template <typename TSource> uint32_t ReadVarUint(TSource & src, uint32_t const *)
+template <typename TSource>
+uint32_t ReadVarUint(TSource & src, uint32_t const *)
{
uint32_t res = 0;
@@ -65,7 +67,8 @@ template <typename TSource> uint32_t ReadVarUint(TSource & src, uint32_t const *
}
}
-template <typename TSource> uint64_t ReadVarUint(TSource & src, uint64_t const *)
+template <typename TSource>
+uint64_t ReadVarUint(TSource & src, uint64_t const *)
{
uint32_t res0 = 0;
{
@@ -140,9 +143,10 @@ template <typename TSource> uint64_t ReadVarUint(TSource & src, uint64_t const *
}
-template <typename T, typename TSource> T ReadVarUint(TSource & src)
+template <typename T, typename TSource>
+T ReadVarUint(TSource & src)
{
- static_assert((is_same<T, uint32_t>::value || is_same<T, uint64_t>::value), "");
+ static_assert((std::is_same<T, uint32_t>::value || std::is_same<T, uint64_t>::value), "");
return ::impl::ReadVarUint(src, static_cast<T const *>(NULL));
/* Generic code commented out.
@@ -166,15 +170,17 @@ template <typename T, typename TSource> T ReadVarUint(TSource & src)
*/
}
-template <typename T, typename TSink> void WriteVarInt(TSink & dst, T value)
+template <typename T, typename TSink>
+void WriteVarInt(TSink & dst, T value)
{
- static_assert(is_signed<T>::value, "");
+ static_assert(std::is_signed<T>::value, "");
WriteVarUint(dst, bits::ZigZagEncode(value));
}
-template <typename T, typename TSource> T ReadVarInt(TSource & src)
+template <typename T, typename TSource>
+T ReadVarInt(TSource & src)
{
- static_assert(is_signed<T>::value, "");
+ static_assert(std::is_signed<T>::value, "");
return bits::ZigZagDecode(ReadVarUint<std::make_unsigned_t<T>>(src));
}
@@ -208,8 +214,8 @@ private:
};
template <typename ConverterT, typename F, class WhileConditionT>
-inline void const * ReadVarInt64Array(void const * pBeg, WhileConditionT whileCondition,
- F f, ConverterT converter)
+void const * ReadVarInt64Array(void const * pBeg, WhileConditionT whileCondition, F f,
+ ConverterT converter)
{
uint8_t const * const pBegChar = static_cast<uint8_t const *>(pBeg);
uint64_t res64 = 0;
@@ -247,34 +253,34 @@ inline void const * ReadVarInt64Array(void const * pBeg, WhileConditionT whileCo
}
-template <typename F> inline
+template <typename F>
void const * ReadVarInt64Array(void const * pBeg, void const * pEnd, F f)
{
return impl::ReadVarInt64Array<int64_t (*)(uint64_t)>(
pBeg, impl::ReadVarInt64ArrayUntilBufferEnd(pEnd), f, &bits::ZigZagDecode);
}
-template <typename F> inline
+template <typename F>
void const * ReadVarUint64Array(void const * pBeg, void const * pEnd, F f)
{
return impl::ReadVarInt64Array(pBeg, impl::ReadVarInt64ArrayUntilBufferEnd(pEnd), f, base::IdFunctor());
}
-template <typename F> inline
+template <typename F>
void const * ReadVarInt64Array(void const * pBeg, size_t count, F f)
{
return impl::ReadVarInt64Array<int64_t (*)(uint64_t)>(
pBeg, impl::ReadVarInt64ArrayGivenSize(count), f, &bits::ZigZagDecode);
}
-template <typename F> inline
+template <typename F>
void const * ReadVarUint64Array(void const * pBeg, size_t count, F f)
{
return impl::ReadVarInt64Array(pBeg, impl::ReadVarInt64ArrayGivenSize(count), f, base::IdFunctor());
}
template <class Cont, class Sink>
-inline void WriteVarUintArray(Cont const & v, Sink & sink)
+void WriteVarUintArray(Cont const & v, Sink & sink)
{
for (size_t i = 0; i != v.size(); ++i)
WriteVarUint(sink, v[i]);
diff --git a/coding/writer.hpp b/coding/writer.hpp
index 59f56a623e..ccf743c813 100644
--- a/coding/writer.hpp
+++ b/coding/writer.hpp
@@ -1,13 +1,15 @@
#pragma once
+
#include "base/assert.hpp"
#include "base/base.hpp"
#include "base/checked_cast.hpp"
#include "base/exception.hpp"
-#include "std/algorithm.hpp"
-#include "std/shared_ptr.hpp"
-#include "std/cstring.hpp"
-#include "std/string.hpp"
-#include "std/vector.hpp"
+
+#include <algorithm>
+#include <cstddef>
+#include <cstdint>
+#include <cstring>
+#include <memory>
// Generic Writer. Not thread-safe.
class Writer
@@ -30,22 +32,16 @@ template <typename ContainerT>
class MemWriter : public Writer
{
public:
- inline explicit MemWriter(ContainerT & data) : m_Data(data), m_Pos(0)
+ explicit MemWriter(ContainerT & data) : m_Data(data), m_Pos(0)
{
static_assert(sizeof(typename ContainerT::value_type) == 1, "");
}
- inline void Seek(uint64_t pos) override
- {
- m_Pos = base::asserted_cast<uintptr_t>(pos);
- }
+ void Seek(uint64_t pos) override { m_Pos = base::asserted_cast<uintptr_t>(pos); }
- inline uint64_t Pos() const override
- {
- return m_Pos;
- }
+ uint64_t Pos() const override { return m_Pos; }
- inline void Write(void const * p, size_t size) override
+ void Write(void const * p, size_t size) override
{
intptr_t freeSize = m_Data.size() - m_Pos;
if (freeSize < 0)
@@ -54,7 +50,7 @@ public:
freeSize = size;
}
- memcpy(&m_Data[m_Pos], p, min(size, static_cast<size_t>(freeSize)));
+ memcpy(&m_Data[m_Pos], p, std::min(size, static_cast<size_t>(freeSize)));
if (size > static_cast<size_t>(freeSize))
{
@@ -76,8 +72,10 @@ template <typename WriterT>
class SubWriter : public Writer
{
public:
- inline explicit SubWriter(WriterT & writer)
- : m_writer(writer), m_pos(0), m_maxPos(0)
+ explicit SubWriter(WriterT & writer)
+ : m_writer(writer)
+ , m_pos(0)
+ , m_maxPos(0)
#ifdef DEBUG
, m_offset(GetOffset())
#endif
@@ -91,34 +89,34 @@ public:
Seek(m_maxPos);
}
- inline void Seek(uint64_t pos) override
+ void Seek(uint64_t pos) override
{
ASSERT_EQUAL(m_offset, GetOffset(), ());
m_writer.Seek(GetOffset() + pos);
m_pos = pos;
- m_maxPos = max(m_maxPos, m_pos);
+ m_maxPos = std::max(m_maxPos, m_pos);
}
- inline uint64_t Pos() const override
+ uint64_t Pos() const override
{
ASSERT_EQUAL(m_offset, GetOffset(), ());
return m_pos;
}
- inline void Write(void const * p, size_t size) override
+ void Write(void const * p, size_t size) override
{
ASSERT_EQUAL(m_offset, GetOffset(), ());
m_writer.Write(p, size);
m_pos += size;
- m_maxPos = max(m_maxPos, m_pos);
+ m_maxPos = std::max(m_maxPos, m_pos);
}
- inline uint64_t Size() const { return m_maxPos; }
+ uint64_t Size() const { return m_maxPos; }
private:
- inline uint64_t GetOffset() const { return m_writer.Pos() - m_pos; }
+ uint64_t GetOffset() const { return m_writer.Pos() - m_pos; }
private:
WriterT & m_writer;
@@ -153,16 +151,16 @@ public:
WriterT * GetPtr() const { return m_p.get(); }
protected:
- shared_ptr<WriterT> m_p;
+ std::shared_ptr<WriterT> m_p;
};
template <typename WriterT>
class WriterSink
{
public:
- inline explicit WriterSink(WriterT & writer) : m_writer(writer), m_pos(0) {}
+ explicit WriterSink(WriterT & writer) : m_writer(writer), m_pos(0) {}
- inline void Write(void const * p, size_t size)
+ void Write(void const * p, size_t size)
{
m_writer.Write(p, size);
m_pos += size;