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:
authorvng <viktor.govako@gmail.com>2011-06-25 19:45:04 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 01:19:58 +0300
commitd0f4cdcf6e5d53967ef40a902b857aeee90f5c4d (patch)
tree5b0f2dcd87ae708c562ca64a466e26ae37e127ca /platform/platform.cpp
parent26b1779590cc7e85d701d0ff0f1c3e733e31a3a1 (diff)
[Refactoring] Add BasePlatformImpl class for most Platform's member functions realization.
@TODO: - Fix iPhone build; - Get most Platform's params from Settings;
Diffstat (limited to 'platform/platform.cpp')
-rw-r--r--platform/platform.cpp89
1 files changed, 89 insertions, 0 deletions
diff --git a/platform/platform.cpp b/platform/platform.cpp
new file mode 100644
index 0000000000..668aad4738
--- /dev/null
+++ b/platform/platform.cpp
@@ -0,0 +1,89 @@
+#include "platform.hpp"
+
+#include "../coding/internal/file_data.hpp"
+
+#include "../base/logging.hpp"
+
+#include "../base/start_mem_debug.hpp"
+
+
+string BasePlatformImpl::ReadPathForFile(string const & file) const
+{
+ string fullPath = m_writableDir + file;
+ if (!IsFileExists(fullPath))
+ {
+ fullPath = m_resourcesDir + file;
+ if (!IsFileExists(fullPath))
+ MYTHROW(FileAbsentException, ("File doesn't exist", fullPath));
+ }
+ return fullPath;
+}
+
+bool BasePlatformImpl::GetFileSize(string const & file, uint64_t & size) const
+{
+ return my::GetFileSize(file, size);
+}
+
+void BasePlatformImpl::GetFontNames(FilesList & res) const
+{
+ res.clear();
+ GetFilesInDir(m_resourcesDir, "*.ttf", res);
+
+ sort(res.begin(), res.end());
+
+ for (size_t i = 0; i < res.size(); ++i)
+ res[i] = m_resourcesDir + res[i];
+}
+
+double BasePlatformImpl::VisualScale() const
+{
+ return 1.0;
+}
+
+string BasePlatformImpl::SkinName() const
+{
+ return "basic.skn";
+}
+
+bool BasePlatformImpl::IsMultiSampled() const
+{
+ return true;
+}
+
+bool BasePlatformImpl::DoPeriodicalUpdate() const
+{
+ return true;
+}
+
+double BasePlatformImpl::PeriodicalUpdateInterval() const
+{
+ return 0.3;
+}
+
+bool BasePlatformImpl::IsBenchmarking() const
+{
+ bool res = false;
+#ifndef OMIM_PRODUCTION
+ if (res)
+ {
+ static bool first = true;
+ if (first)
+ {
+ LOG(LCRITICAL, ("benchmarking only defined in production configuration"));
+ first = false;
+ }
+ res = false;
+ }
+#endif
+ return res;
+}
+
+bool BasePlatformImpl::IsVisualLog() const
+{
+ return false;
+}
+
+int BasePlatformImpl::ScaleEtalonSize() const
+{
+ return 512 + 256;
+}