| 20 | String const MapFilenameSuffix = ".json"; |
| 21 | |
| 22 | Maybe<String> matchTile(SearchParameters const& search, Tiled::Tile const& tile) { |
| 23 | Tiled::Properties const& properties = tile.properties; |
| 24 | if (search.criteria.is<TileName>()) { |
| 25 | if (auto tileName = properties.opt<String>("//name")) |
| 26 | if (tileName->regexMatch(search.criteria.get<TileName>())) |
| 27 | return tileName; |
| 28 | } else { |
| 29 | String propertyName; |
| 30 | String matchValue; |
| 31 | tie(propertyName, matchValue) = search.criteria.get<TileProperty>(); |
| 32 | if (auto propertyValue = properties.opt<String>(propertyName)) |
| 33 | if (propertyValue->regexMatch(matchValue)) |
| 34 | return properties.opt<String>("//name").value("?"); |
| 35 | } |
| 36 | return {}; |
| 37 | } |
| 38 | |
| 39 | void grepTileLayer(SearchParameters const& search, TMXMapPtr map, TMXTileLayerPtr tileLayer, MatchReporter callback) { |
| 40 | tileLayer->forEachTile(map.get(), |
no test coverage detected