mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-23 22:53:43 +00:00
Organic Maps sources as of 02.04.2025 (fad26bbf22ac3da75e01e62aa01e5c8e11861005)
To expand with full Organic Maps and Maps.ME commits history run: git remote add om-historic [om-historic.git repo url] git fetch --tags om-historic git replace squashed-history historic-commits
This commit is contained in:
53
generator/composite_id.cpp
Normal file
53
generator/composite_id.cpp
Normal file
@@ -0,0 +1,53 @@
|
||||
#include "generator/composite_id.hpp"
|
||||
|
||||
#include <sstream>
|
||||
#include <tuple>
|
||||
|
||||
namespace generator
|
||||
{
|
||||
CompositeId::CompositeId(std::string const & str)
|
||||
{
|
||||
std::stringstream stream(str);
|
||||
stream.exceptions(std::ios::failbit);
|
||||
stream >> m_mainId;
|
||||
stream >> m_additionalId;
|
||||
}
|
||||
|
||||
CompositeId::CompositeId(base::GeoObjectId mainId, base::GeoObjectId additionalId)
|
||||
: m_mainId(mainId), m_additionalId(additionalId)
|
||||
{
|
||||
}
|
||||
|
||||
CompositeId::CompositeId(base::GeoObjectId mainId)
|
||||
: CompositeId(mainId, base::GeoObjectId() /* additionalId */)
|
||||
{
|
||||
}
|
||||
|
||||
bool CompositeId::operator<(CompositeId const & other) const
|
||||
{
|
||||
return std::tie(m_mainId, m_additionalId) < std::tie(other.m_mainId, other.m_additionalId);
|
||||
}
|
||||
|
||||
bool CompositeId::operator==(CompositeId const & other) const
|
||||
{
|
||||
return std::tie(m_mainId, m_additionalId) == std::tie(other.m_mainId, other.m_additionalId);
|
||||
}
|
||||
|
||||
bool CompositeId::operator!=(CompositeId const & other) const
|
||||
{
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
std::string CompositeId::ToString() const
|
||||
{
|
||||
std::stringstream stream;
|
||||
stream.exceptions(std::ios::failbit);
|
||||
stream << m_mainId << " " << m_additionalId;
|
||||
return stream.str();
|
||||
}
|
||||
|
||||
std::string DebugPrint(CompositeId const & id)
|
||||
{
|
||||
return DebugPrint(id.m_mainId) + "|" + DebugPrint(id.m_additionalId);
|
||||
}
|
||||
} // namespace generator
|
||||
Reference in New Issue
Block a user