diff options
author | vng <viktor.govako@gmail.com> | 2014-10-14 12:40:28 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:30:52 +0300 |
commit | 9c448faaf31a6f5be849dec8208584a138213485 (patch) | |
tree | fa91e1694526c5ebe0e463ac18f0148b041087ce | |
parent | 4cc9fd6914d548e2649d6e7c01835d3ab67993ad (diff) |
Removed unused includes in base files.
-rw-r--r-- | anim/controller.cpp | 4 | ||||
-rw-r--r-- | anim/task.cpp | 7 | ||||
-rw-r--r-- | base/assert.hpp | 3 | ||||
-rw-r--r-- | base/base.pro | 2 | ||||
-rw-r--r-- | base/bits.hpp | 2 | ||||
-rw-r--r-- | base/buffer_vector.hpp | 5 | ||||
-rw-r--r-- | base/casts.hpp | 7 | ||||
-rw-r--r-- | base/internal/message.hpp | 1 | ||||
-rw-r--r-- | base/math.hpp | 15 | ||||
-rw-r--r-- | base/src_point.cpp | 34 | ||||
-rw-r--r-- | base/src_point.hpp | 27 | ||||
-rw-r--r-- | base/stats.hpp | 9 | ||||
-rw-r--r-- | base/stl_add.hpp | 1 | ||||
-rw-r--r-- | base/timer.cpp | 1 | ||||
-rw-r--r-- | coding/coding_tests/reader_cache_test.cpp | 4 | ||||
-rw-r--r-- | coding/reader_cache.hpp | 3 | ||||
-rw-r--r-- | drape/drape_tests/testingmain.cpp | 3 | ||||
-rw-r--r-- | testing/testing.hpp | 5 | ||||
-rw-r--r-- | testing/testingmain.cpp | 14 | ||||
-rw-r--r-- | testing/testregister.hpp | 49 |
20 files changed, 108 insertions, 88 deletions
diff --git a/anim/controller.cpp b/anim/controller.cpp index 3ec2432882..2366a52c62 100644 --- a/anim/controller.cpp +++ b/anim/controller.cpp @@ -3,7 +3,9 @@ #include "../base/assert.hpp" #include "../base/timer.hpp" -#include "../std/bind.hpp" + +#include "../std/algorithm.hpp" + namespace anim { diff --git a/anim/task.cpp b/anim/task.cpp index 72bbdb2cfa..d4f213ae74 100644 --- a/anim/task.cpp +++ b/anim/task.cpp @@ -1,9 +1,10 @@ #include "task.hpp" -#include "../std/bind.hpp" - #include "../base/assert.hpp" +#include "../std/algorithm.hpp" + + namespace anim { Task::Task() @@ -36,7 +37,7 @@ namespace anim void Task::PerformCallbacks(EState state) { list<TCallback> const & cb = m_Callbacks[state]; - for_each(cb.begin(), cb.end(), bind(&TCallback::operator(), _1)); + for_each(cb.begin(), cb.end(), [] (TCallback const & cb) { cb(); }); } void Task::OnStart(double ts) diff --git a/base/assert.hpp b/base/assert.hpp index 9146c2fcf7..d985335440 100644 --- a/base/assert.hpp +++ b/base/assert.hpp @@ -2,8 +2,9 @@ #include "base.hpp" #include "internal/message.hpp" #include "src_point.hpp" + #include "../std/string.hpp" -#include "../std/vector.hpp" + namespace my { diff --git a/base/base.pro b/base/base.pro index 75696fd8b3..6071d8da79 100644 --- a/base/base.pro +++ b/base/base.pro @@ -30,6 +30,7 @@ SOURCES += \ scheduled_task.cpp \ thread_pool.cpp \ pseudo_random.cpp \ + src_point.cpp HEADERS += \ SRC_FIRST.hpp \ @@ -50,7 +51,6 @@ HEADERS += \ swap.hpp \ thread.hpp \ mutex.hpp \ - casts.hpp \ string_utils.hpp \ rolling_hash.hpp \ stl_add.hpp \ diff --git a/base/bits.hpp b/base/bits.hpp index 4d79dff122..2b04b8b9c3 100644 --- a/base/bits.hpp +++ b/base/bits.hpp @@ -1,5 +1,5 @@ #pragma once -#include "base.hpp" +#include "assert.hpp" #include "../std/type_traits.hpp" diff --git a/base/buffer_vector.hpp b/base/buffer_vector.hpp index 3ebb2f4651..6f4d1b8818 100644 --- a/base/buffer_vector.hpp +++ b/base/buffer_vector.hpp @@ -1,9 +1,10 @@ #pragma once +#include "assert.hpp" +#include "swap.hpp" #include "../std/algorithm.hpp" #include "../std/vector.hpp" -#include "../base/assert.hpp" -#include "../base/swap.hpp" + template <class T, size_t N> class buffer_vector { diff --git a/base/casts.hpp b/base/casts.hpp deleted file mode 100644 index 4afac32707..0000000000 --- a/base/casts.hpp +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once -#include "assert.hpp" - -template <typename ToT, typename FromT> ToT implicit_cast(FromT const & t) -{ - return t; -} diff --git a/base/internal/message.hpp b/base/internal/message.hpp index 27377a5323..e384aa4c8a 100644 --- a/base/internal/message.hpp +++ b/base/internal/message.hpp @@ -1,5 +1,4 @@ #pragma once -#include "../../std/algorithm.hpp" #include "../../std/iterator.hpp" #include "../../std/list.hpp" #include "../../std/map.hpp" diff --git a/base/math.hpp b/base/math.hpp index 41614af7a4..266429288f 100644 --- a/base/math.hpp +++ b/base/math.hpp @@ -1,13 +1,14 @@ #pragma once -#include "../base/base.hpp" -#include "../base/assert.hpp" +#include "assert.hpp" #include "../std/cmath.hpp" #include "../std/limits.hpp" #include "../std/type_traits.hpp" +#include "../std/algorithm.hpp" #include <boost/integer.hpp> + namespace my { @@ -140,10 +141,10 @@ inline uint32_t NextPowOf2(uint32_t v) } // Greatest Common Divisor -inline uint32_t GCD(uint32_t a, uint32_t b) +template <typename T> T GCD(T a, T b) { - uint32_t multiplier = 1; - uint32_t gcd = 1; + T multiplier = 1; + T gcd = 1; while (true) { if (a == 0 || b == 0) @@ -168,8 +169,8 @@ inline uint32_t GCD(uint32_t a, uint32_t b) if ((a & 0x1) != 0 && (b & 0x1) != 0) { - uint32_t minV = min(a, b); - uint32_t maxV = max(a, b); + T minV = min(a, b); + T maxV = max(a, b); a = (maxV - minV) >> 1; b = minV; continue; diff --git a/base/src_point.cpp b/base/src_point.cpp new file mode 100644 index 0000000000..e88810e1bd --- /dev/null +++ b/base/src_point.cpp @@ -0,0 +1,34 @@ +#include "src_point.hpp" + +#include "../std/algorithm.hpp" +#include "../std/sstream.hpp" + + +namespace my +{ + +void SrcPoint::TruncateFileName() +{ + size_t const maxLen = 10000; + char const * p[] = { m_fileName, m_fileName }; + for (size_t i = 0; i < maxLen && m_fileName[i]; ++i) + { + if (m_fileName[i] == '\\' || m_fileName[i] == '/') + { + swap(p[0], p[1]); + p[0] = m_fileName + i + 1; + } + } + m_fileName = p[1]; +} + +} + +string DebugPrint(my::SrcPoint const & srcPoint) +{ + ostringstream out; + if (srcPoint.Line() > 0) + out << srcPoint.FileName() << ":" << srcPoint.Line() << " " << srcPoint.Function() + << srcPoint.Postfix() << " "; + return out.str(); +} diff --git a/base/src_point.hpp b/base/src_point.hpp index 5f5503910a..dd60d85c29 100644 --- a/base/src_point.hpp +++ b/base/src_point.hpp @@ -1,9 +1,8 @@ #pragma once -#include "../std/algorithm.hpp" -#include "../std/sstream.hpp" #include "../std/string.hpp" + #ifndef SRC_LOGGING #define SRC_LOGGING 1 #endif @@ -55,20 +54,7 @@ namespace my } private: - void TruncateFileName() - { - size_t const maxLen = 10000; - char const * p[] = { m_fileName, m_fileName }; - for (size_t i = 0; i < maxLen && m_fileName[i]; ++i) - { - if (m_fileName[i] == '\\' || m_fileName[i] == '/') - { - swap(p[0], p[1]); - p[0] = m_fileName + i + 1; - } - } - m_fileName = p[1]; - } + void TruncateFileName(); char const * m_fileName; int m_line; @@ -77,11 +63,4 @@ namespace my }; } -inline string DebugPrint(my::SrcPoint const & srcPoint) -{ - ostringstream out; - if (srcPoint.Line() > 0) - out << srcPoint.FileName() << ":" << srcPoint.Line() << " " << srcPoint.Function() - << srcPoint.Postfix() << " "; - return out.str(); -} +string DebugPrint(my::SrcPoint const & srcPoint); diff --git a/base/stats.hpp b/base/stats.hpp index 9503dc4efb..f050dc2107 100644 --- a/base/stats.hpp +++ b/base/stats.hpp @@ -1,12 +1,9 @@ #pragma once -#include "assert.hpp" #include "base.hpp" -#include "casts.hpp" -#include "pseudo_random.hpp" -#include "internal/message.hpp" + #include "../std/sstream.hpp" #include "../std/string.hpp" -#include "../std/vector.hpp" + namespace my { @@ -27,7 +24,7 @@ public: void operator() (T const & x) { ++m_Count; - m_Sum += implicit_cast<double>(x); + m_Sum += x; } string GetStatsStr() const diff --git a/base/stl_add.hpp b/base/stl_add.hpp index c749e2fc65..0bb3e9fa08 100644 --- a/base/stl_add.hpp +++ b/base/stl_add.hpp @@ -1,6 +1,7 @@ #pragma once #include "../std/functional.hpp" #include "../std/iterator.hpp" +#include "../std/algorithm.hpp" template <class ContainerT> class BackInsertFunctor diff --git a/base/timer.cpp b/base/timer.cpp index d80f97d7f1..a00d86e540 100644 --- a/base/timer.cpp +++ b/base/timer.cpp @@ -7,6 +7,7 @@ #include "../std/cstdio.hpp" #include "../std/sstream.hpp" #include "../std/iomanip.hpp" +#include "../std/algorithm.hpp" namespace my diff --git a/coding/coding_tests/reader_cache_test.cpp b/coding/coding_tests/reader_cache_test.cpp index dcfd4643ad..0e21320154 100644 --- a/coding/coding_tests/reader_cache_test.cpp +++ b/coding/coding_tests/reader_cache_test.cpp @@ -1,9 +1,11 @@ -#include "../../base/SRC_FIRST.hpp" #include "../../testing/testing.hpp" #include "../reader_cache.hpp" +#include "../reader.hpp" + #include "../../base/pseudo_random.hpp" + namespace { template <class ReaderT> class CacheReader diff --git a/coding/reader_cache.hpp b/coding/reader_cache.hpp index 386c63d01c..6abc96095b 100644 --- a/coding/reader_cache.hpp +++ b/coding/reader_cache.hpp @@ -1,13 +1,12 @@ #pragma once -#include "reader.hpp" #include "../base/base.hpp" #include "../base/cache.hpp" -#include "../base/logging.hpp" #include "../base/stats.hpp" #include "../std/vector.hpp" #include "../std/cstring.hpp" +#include "../std/algorithm.hpp" namespace impl diff --git a/drape/drape_tests/testingmain.cpp b/drape/drape_tests/testingmain.cpp index dc4de44c30..90a1696221 100644 --- a/drape/drape_tests/testingmain.cpp +++ b/drape/drape_tests/testingmain.cpp @@ -1,7 +1,9 @@ #include "../../testing/testregister.hpp" #include "../../testing/testing.hpp" + #include "../../base/logging.hpp" #include "../../base/scope_guard.hpp" + #include "../../std/algorithm.hpp" #include "../../std/iostream.hpp" #include "../../std/string.hpp" @@ -11,6 +13,7 @@ #include "glmock_functions.hpp" + #ifdef OMIM_UNIT_TEST_WITH_QT_EVENT_LOOP #include <Qt> #ifdef OMIM_OS_MAC // on Mac OS X native run loop works only for QApplication :( diff --git a/testing/testing.hpp b/testing/testing.hpp index bd62c4d15b..df678f7219 100644 --- a/testing/testing.hpp +++ b/testing/testing.hpp @@ -1,13 +1,14 @@ #pragma once #include "testregister.hpp" -#include "../base/assert.hpp" -#include "../base/base.hpp" + #include "../base/exception.hpp" #include "../base/math.hpp" #include "../base/src_point.hpp" + #include "../std/iostream.hpp" #include "../std/string.hpp" + #define UNIT_TEST(name) \ void UnitTest_##name(); \ TestRegister g_TestRegister_##name(#name, __FILE__, &UnitTest_##name); \ diff --git a/testing/testingmain.cpp b/testing/testingmain.cpp index 1216cc9390..dda353a36e 100644 --- a/testing/testingmain.cpp +++ b/testing/testingmain.cpp @@ -1,12 +1,14 @@ #include "testregister.hpp" #include "testing.hpp" + #include "../base/logging.hpp" -#include "../std/algorithm.hpp" + #include "../std/iostream.hpp" #include "../std/string.hpp" #include "../std/vector.hpp" #include "../std/target_os.hpp" + #ifdef OMIM_UNIT_TEST_WITH_QT_EVENT_LOOP #include <Qt> #ifdef OMIM_OS_MAC // on Mac OS X native run loop works only for QApplication :( @@ -68,6 +70,7 @@ int main(int argc, char * argv[]) cerr << "\n\nSOMETHING IS REALLY WRONG IN THE UNIT TEST FRAMEWORK!!!" << endl; return 5; } + try { // Run the test. @@ -85,16 +88,19 @@ int main(int argc, char * argv[]) ++numFailedTests; } - } catch (TestFailureException const & ) + } + catch (TestFailureException const & ) { testResults[iTest] = false; ++numFailedTests; - } catch (std::exception const & ex) + } + catch (std::exception const & ex) { cerr << "FAILED" << endl << "<<<Exception thrown [" << ex.what() << "].>>>" << endl; testResults[iTest] = false; ++numFailedTests; - } catch (...) + } + catch (...) { cerr << "FAILED" << endl << "<<<Unknown exception thrown.>>>" << endl; testResults[iTest] = false; diff --git a/testing/testregister.hpp b/testing/testregister.hpp index 803413473a..0c2ab2351c 100644 --- a/testing/testregister.hpp +++ b/testing/testregister.hpp @@ -1,36 +1,35 @@ #pragma once -#include "../base/base.hpp" class TestRegister { public: - TestRegister(char const * testName, char const * fileName, void (* fnTest)()) - : m_TestName(testName), m_FileName(fileName), m_Fn(fnTest), m_pNext(NULL) + TestRegister(char const * testName, char const * fileName, void (* fnTest)()) + : m_TestName(testName), m_FileName(fileName), m_Fn(fnTest), m_pNext(0) + { + if (FirstRegister() == 0) + FirstRegister() = this; + else { - if (FirstRegister() == NULL) - FirstRegister() = this; - else - { - TestRegister * pLast = FirstRegister(); - while (pLast->m_pNext) - pLast = pLast->m_pNext; - pLast->m_pNext = this; - } + TestRegister * pLast = FirstRegister(); + while (pLast->m_pNext) + pLast = pLast->m_pNext; + pLast->m_pNext = this; } + } - // Test name. - char const * m_TestName; - // File name. - char const * m_FileName; - // Function to run test. - void (* m_Fn)(); - // Next test in chain. - TestRegister * m_pNext; + // Test name. + char const * m_TestName; + // File name. + char const * m_FileName; + // Function to run test. + void (* m_Fn)(); + // Next test in chain. + TestRegister * m_pNext; - static TestRegister * & FirstRegister() - { - static TestRegister * s_pRegister = 0; - return s_pRegister; - } + static TestRegister * & FirstRegister() + { + static TestRegister * s_pRegister = 0; + return s_pRegister; + } }; |