diff options
author | Dimitri van Heesch <doxygen@gmail.com> | 2020-10-31 15:02:26 (GMT) |
---|---|---|
committer | Dimitri van Heesch <doxygen@gmail.com> | 2020-10-31 15:02:26 (GMT) |
commit | 2b5a4541fb6f806c02a1f6e65a1ff2610f29751f (patch) | |
tree | e0e91912e2c8c57873fe267a640c870381de87e5 /src/filename.h | |
parent | 7bd4455f4fb17075eb23f5f24a5735913cde3e16 (diff) | |
download | Doxygen-2b5a4541fb6f806c02a1f6e65a1ff2610f29751f.zip Doxygen-2b5a4541fb6f806c02a1f6e65a1ff2610f29751f.tar.gz Doxygen-2b5a4541fb6f806c02a1f6e65a1ff2610f29751f.tar.bz2 |
issue #8129: Image path is now case sensitive (take 2)
Diffstat (limited to 'src/filename.h')
-rw-r--r-- | src/filename.h | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/src/filename.h b/src/filename.h index f8ea2e1..d236046 100644 --- a/src/filename.h +++ b/src/filename.h @@ -20,6 +20,7 @@ #include <vector> #include "linkedmap.h" +#include "config.h" class FileDef; @@ -38,8 +39,38 @@ class FileName : public std::vector< std::unique_ptr<FileDef> > QCString m_pathName; }; +//! Custom combined key compare and hash functor that uses a lower case string in +//! case CASE_SENSE_NAMES is set to NO. +class FileNameFn +{ + public: + //! used as hash function + std::size_t operator()(const std::string& input) const noexcept + { + return std::hash<std::string>()(searchKey(input)); + } + //! used as equal operator + bool operator() (const std::string &t1, const std::string &t2) const + { + return searchKey(t1) == searchKey(t2); + } + private: + std::string searchKey(std::string input) const + { + std::string key = input; + if (!Config_getBool(CASE_SENSE_NAMES)) + { + // convert key to lower case + std::transform(key.begin(),key.end(),key.begin(), + [](char c){ return (char)std::tolower(c); }); + } + return key; + } +}; + /** Ordered dictionary of FileName objects. */ -class FileNameLinkedMap : public LinkedMap<FileName,true> +class FileNameLinkedMap : public LinkedMap<FileName,FileNameFn,FileNameFn, + std::unordered_multimap<std::string,FileName*,FileNameFn,FileNameFn> > { }; |