diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2021-10-15 11:15:28 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2021-10-15 11:15:28 +0900 |
commit | 4aa4e498d10e343b3b2a49e06195f62a49120002 (patch) | |
tree | ff9645788017052b9d83d196cc25bddcfcf1708b /src/filename.h | |
parent | fd5021ef77ddac91004a2b9c549e08ea952bce89 (diff) | |
download | doxygen-4aa4e498d10e343b3b2a49e06195f62a49120002.tar.gz doxygen-4aa4e498d10e343b3b2a49e06195f62a49120002.tar.bz2 doxygen-4aa4e498d10e343b3b2a49e06195f62a49120002.zip |
Imported Upstream version 1.9.0upstream/1.9.0
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 c3a0d3e..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> +class FileNameLinkedMap : public LinkedMap<FileName,FileNameFn,FileNameFn, + std::unordered_multimap<std::string,FileName*,FileNameFn,FileNameFn> > { }; |