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

Method Serialize

generator/generator_tests_support/test_feature.cpp:114–159  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

112}
113
114void TestFeature::Serialize(FeatureBuilder & fb) const
115{
116 using feature::Metadata;
117
118 // Iterate [1, FMD_COUNT). Absent types don't matter here.
119 size_t i = 1;
120 auto constexpr count = static_cast<size_t>(Metadata::EType::FMD_COUNT);
121 for (; i < count; ++i)
122 {
123 auto const type = static_cast<Metadata::EType>(i);
124 if (m_metadata.Has(type))
125 fb.GetMetadata().Set(type, string(m_metadata.Get(type)));
126 }
127
128 if (!m_geometry.empty())
129 fb.AssignPoints(m_geometry);
130
131 switch (m_type)
132 {
133 case Type::Point:
134 {
135 fb.SetCenter(m_center);
136 break;
137 }
138 case Type::Line:
139 {
140 fb.SetLinear();
141 break;
142 }
143 case Type::Area:
144 {
145 fb.SetArea();
146 break;
147 }
148 case Type::Unknown: break;
149 }
150
151 m_names.ForEach([&](int8_t langCode, string_view name)
152 {
153 if (!name.empty())
154 fb.SetName(langCode, name);
155 });
156
157 if (!m_postcode.empty())
158 fb.GetParams().SetPostcode(m_postcode);
159}
160
161// TestPlace -------------------------------------------------------------------------------------
162TestPlace::TestPlace(m2::PointD const & center, string const & name, string const & lang, uint32_t type,

Callers 3

WriteRegionDataForTestsFunction · 0.45
AddMethod · 0.45
AddSafeMethod · 0.45

Calls 15

SerializeFunction · 0.85
AddressDataClass · 0.85
SetLinearMethod · 0.80
SetAreaMethod · 0.80
GetParamsMethod · 0.80
GetTypeByPathMethod · 0.80
AddHouseNumberMethod · 0.80
HasMethod · 0.45
SetMethod · 0.45
GetMetadataMethod · 0.45
GetMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected