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:
authorYuri Gorshenin <y@maps.me>2017-07-03 13:46:29 +0300
committerYuri Gorshenin <mipt.vi002@gmail.com>2017-07-05 16:41:38 +0300
commit08f26370f4c22f33cdd5a2e7687e572383cd5b56 (patch)
tree8811b23de271f383f5e12858cf185d2647982588 /ugc/types.hpp
parent8aab5cd35d225e8318e9223a04d7c1db309e9272 (diff)
[ugc] Build fix, implemented TranslationKey data structure.
Diffstat (limited to 'ugc/types.hpp')
-rw-r--r--ugc/types.hpp24
1 files changed, 21 insertions, 3 deletions
diff --git a/ugc/types.hpp b/ugc/types.hpp
index 7a6de3e533..8cbcda8347 100644
--- a/ugc/types.hpp
+++ b/ugc/types.hpp
@@ -26,10 +26,26 @@
namespace ugc
{
-using TranslationKey = std::string;
using Clock = std::chrono::system_clock;
using Time = std::chrono::time_point<Clock>;
+struct TranslationKey
+{
+ TranslationKey() = default;
+ TranslationKey(std::string const & key): m_key(key) {}
+ TranslationKey(char const * key): m_key(key) {}
+
+ bool operator==(TranslationKey const & rhs) const { return m_key == rhs.m_key; }
+ bool operator<(TranslationKey const & rhs) const { return m_key < rhs.m_key; }
+
+ friend std::string DebugPrint(TranslationKey const & key)
+ {
+ return "TranslationKey [ " + key.m_key + " ]";
+ }
+
+ std::string m_key;
+};
+
enum class Sentiment
{
Positive,
@@ -81,7 +97,8 @@ struct RatingRecord
friend std::string DebugPrint(RatingRecord const & ratingRecord)
{
std::ostringstream os;
- os << "RatingRecord [ " << ratingRecord.m_key << " " << ratingRecord.m_value << " ]";
+ os << "RatingRecord [ " << DebugPrint(ratingRecord.m_key) << " " << ratingRecord.m_value
+ << " ]";
return os.str();
}
@@ -238,7 +255,8 @@ struct Attribute
friend std::string DebugPrint(Attribute const & attribute)
{
std::ostringstream os;
- os << "Attribute [ key:" << attribute.m_key << ", value:" << attribute.m_value << " ]";
+ os << "Attribute [ key:" << DebugPrint(attribute.m_key)
+ << ", value:" << DebugPrint(attribute.m_value) << " ]";
return os.str();
}