Case insensitivity for findNextByPartialId.
This commit is contained in:
parent
6a4e458af9
commit
f11572cd64
1 changed files with 4 additions and 2 deletions
|
@ -694,14 +694,16 @@ FGPositioned::findClosestN(const SGGeod& aPos, unsigned int aN, double aCutoffNm
|
||||||
FGPositionedRef
|
FGPositionedRef
|
||||||
FGPositioned::findNextWithPartialId(FGPositionedRef aCur, const std::string& aId, Filter* aFilter)
|
FGPositioned::findNextWithPartialId(FGPositionedRef aCur, const std::string& aId, Filter* aFilter)
|
||||||
{
|
{
|
||||||
|
std::string id(boost::to_upper_copy(aId));
|
||||||
|
|
||||||
// It is essential to bound our search, to avoid iterating all the way to the end of the database.
|
// It is essential to bound our search, to avoid iterating all the way to the end of the database.
|
||||||
// Do this by generating a second ID with the final character incremented by 1.
|
// Do this by generating a second ID with the final character incremented by 1.
|
||||||
// e.g., if the partial ID is "KI", we wish to search "KIxxx" but not "KJ".
|
// e.g., if the partial ID is "KI", we wish to search "KIxxx" but not "KJ".
|
||||||
std::string upperBoundId = aId;
|
std::string upperBoundId = id;
|
||||||
upperBoundId[upperBoundId.size()-1]++;
|
upperBoundId[upperBoundId.size()-1]++;
|
||||||
NamedPositionedIndex::const_iterator upperBound = global_identIndex.lower_bound(upperBoundId);
|
NamedPositionedIndex::const_iterator upperBound = global_identIndex.lower_bound(upperBoundId);
|
||||||
|
|
||||||
NamedIndexRange range = global_identIndex.equal_range(aId);
|
NamedIndexRange range = global_identIndex.equal_range(id);
|
||||||
while (range.first != upperBound) {
|
while (range.first != upperBound) {
|
||||||
for (; range.first != range.second; ++range.first) {
|
for (; range.first != range.second; ++range.first) {
|
||||||
FGPositionedRef candidate = range.first->second;
|
FGPositionedRef candidate = range.first->second;
|
||||||
|
|
Loading…
Add table
Reference in a new issue