diff options
author | Alex Zolotarev <alex@maps.me> | 2015-12-22 22:05:17 +0300 |
---|---|---|
committer | Sergey Yershov <yershov@corp.mail.ru> | 2016-03-23 16:04:03 +0300 |
commit | cc9888f19959c1d4aaab108de9515c8698345462 (patch) | |
tree | ad606074585617f51d3f98822b0d02dde7209b4c /editor/xml_feature.cpp | |
parent | 2fddb7127bc86d8935593fd3086f6f6837d83201 (diff) |
Offset setter/getter for XMLFeature.
Diffstat (limited to 'editor/xml_feature.cpp')
-rw-r--r-- | editor/xml_feature.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/editor/xml_feature.cpp b/editor/xml_feature.cpp index e0beeef5ce..92211197d2 100644 --- a/editor/xml_feature.cpp +++ b/editor/xml_feature.cpp @@ -18,6 +18,7 @@ namespace { constexpr int const kLatLonTolerance = 7; constexpr char const * kTimestamp = "timestamp"; +constexpr char const * kOffset = "offset"; constexpr char const * kUploadTimestamp = "upload_timestamp"; constexpr char const * kUploadStatus = "upload_status"; constexpr char const * kUploadError = "upload_error"; @@ -152,6 +153,17 @@ void XMLFeature::SetModificationTime(time_t const time) SetAttribute(kTimestamp, my::TimestampToString(time)); } +uint32_t XMLFeature::GetOffset() const +{ + // Always cast to uint32_t to avoid warnings on different platforms. + return static_cast<uint32_t>(GetRootNode().attribute(kOffset).as_uint(0)); +} + +void XMLFeature::SetOffset(uint32_t featureOffset) +{ + SetAttribute(kOffset, strings::to_string(featureOffset)); +} + time_t XMLFeature::GetUploadTime() const { return my::StringToTimestamp(GetRootNode().attribute(kUploadTimestamp).value()); |