| 140 | } // namespace |
| 141 | |
| 142 | bool EditorConfig::GetTypeDescription(std::vector<std::string> classificatorTypes, |
| 143 | TypeAggregatedDescription & outDesc) const |
| 144 | { |
| 145 | bool isBuilding = false; |
| 146 | std::vector<std::string> addTypes; |
| 147 | for (auto it = classificatorTypes.begin(); it != classificatorTypes.end(); ++it) |
| 148 | { |
| 149 | if (*it == "building") |
| 150 | { |
| 151 | outDesc.m_address = isBuilding = true; |
| 152 | outDesc.m_editableFields.push_back(EType::FMD_BUILDING_LEVELS); |
| 153 | outDesc.m_editableFields.push_back(EType::FMD_POSTCODE); |
| 154 | classificatorTypes.erase(it); |
| 155 | break; |
| 156 | } |
| 157 | |
| 158 | // Adding partial types for 2..N-1 parts of a N-part type. |
| 159 | auto hyphenPos = it->find('-'); |
| 160 | while ((hyphenPos = it->find('-', hyphenPos + 1)) != std::string::npos) |
| 161 | addTypes.push_back(it->substr(0, hyphenPos)); |
| 162 | } |
| 163 | |
| 164 | classificatorTypes.insert(classificatorTypes.end(), addTypes.begin(), addTypes.end()); |
| 165 | |
| 166 | auto const typeNodes = GetPrioritizedTypes(m_document); |
| 167 | auto const it = base::FindIf(typeNodes, [&classificatorTypes](pugi::xml_node const & node) |
| 168 | { return base::IsExist(classificatorTypes, node.attribute("id").value()); }); |
| 169 | if (it == end(typeNodes)) |
| 170 | return isBuilding; |
| 171 | |
| 172 | return TypeDescriptionFromXml(m_document, *it, outDesc); |
| 173 | } |
| 174 | |
| 175 | std::vector<std::string> EditorConfig::GetTypesThatCanBeAdded() const |
| 176 | { |