MCPcopy Create free account
hub / github.com/comaps/comaps / ToString

Method ToString

libs/indexer/osm_element.cpp:145–191  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

143}
144
145std::string OsmElement::ToString(std::string const & shift) const
146{
147 std::stringstream ss;
148 ss << (shift.empty() ? "\n" : shift);
149 switch (m_type)
150 {
151 case EntityType::Node:
152 ss << "Node: " << m_id << " (" << std::fixed << std::setw(7) << m_lat << ", " << m_lon << ")"
153 << " tags: " << m_tags.size();
154 break;
155 case EntityType::Nd: ss << "Nd ref: " << m_ref; break;
156 case EntityType::Way:
157 ss << "Way: " << m_id << " nds: " << m_nodes.size() << " tags: " << m_tags.size();
158 if (!m_nodes.empty())
159 {
160 std::string shift2 = shift;
161 shift2 += shift2.empty() ? "\n " : " ";
162 for (auto const & e : m_nodes)
163 ss << shift2 << e;
164 }
165 break;
166 case EntityType::Relation:
167 ss << "Relation: " << m_id << " members: " << m_members.size() << " tags: " << m_tags.size();
168 if (!m_members.empty())
169 {
170 std::string shift2 = shift;
171 shift2 += shift2.empty() ? "\n " : " ";
172 for (auto const & e : m_members)
173 ss << shift2 << e.m_ref << " " << DebugPrint(e.m_type) << " " << e.m_role;
174 }
175 break;
176 case EntityType::Tag: ss << "Tag: " << m_k << " = " << m_v; break;
177 case EntityType::Member:
178 ss << "Member: " << m_ref << " type: " << DebugPrint(m_memberType) << " role: " << m_role;
179 break;
180 default: UNREACHABLE(); break;
181 }
182
183 if (!m_tags.empty())
184 {
185 std::string shift2 = shift;
186 shift2 += shift2.empty() ? "\n " : " ";
187 for (auto const & e : m_tags)
188 ss << shift2 << e.m_key << " = " << e.m_value;
189 }
190 return ss.str();
191}
192
193bool OsmElement::operator==(OsmElement const & other) const
194{

Callers 7

DebugPrintFunction · 0.45
SetChargeSocketsMethod · 0.45
ApplyJournalEntryMethod · 0.45
UNIT_TESTFunction · 0.45
UNIT_TESTFunction · 0.45
UNIT_TESTFunction · 0.45
UNIT_TESTFunction · 0.45

Calls 3

DebugPrintFunction · 0.70
emptyMethod · 0.45
sizeMethod · 0.45

Tested by 4

UNIT_TESTFunction · 0.36
UNIT_TESTFunction · 0.36
UNIT_TESTFunction · 0.36
UNIT_TESTFunction · 0.36