Doxygen
Loading...
Searching...
No Matches
filename.h
Go to the documentation of this file.
1/******************************************************************************
2 *
3 * Copyright (C) 1997-2020 by Dimitri van Heesch.
4 *
5 * Permission to use, copy, modify, and distribute this software and its
6 * documentation under the terms of the GNU General Public License is hereby
7 * granted. No representations are made about the suitability of this software
8 * for any purpose. It is provided "as is" without express or implied warranty.
9 * See the GNU General Public License for more details.
10 *
11 * Documents produced by Doxygen are derivative works derived from the
12 * input used in their production; they are not affected by this license.
13 *
14 */
15
16#ifndef FILENAME_H
17#define FILENAME_H
18
19#include <memory>
20#include <vector>
21
22#include "linkedmap.h"
23#include "utf8.h"
24#include "util.h"
25
26class FileDef;
27
28/** Class representing all files with a certain base name */
29class FileName : public std::vector< std::unique_ptr<FileDef> >
30{
31 public:
32 explicit FileName(const QCString &nm) : m_name(nm) {}
33 QCString fileName() const { return m_name; }
34
35 private:
37};
38
39//! Custom combined key compare and hash functor that uses a lower case string in
40//! case CASE_SENSE_NAMES is set to NO.
42{
43 public:
44 //! used as hash function
45 std::size_t operator()(const std::string& input) const noexcept
46 {
47 return std::hash<std::string>()(searchKey(input));
48 }
49 //! used as equal operator
50 bool operator() (const std::string &t1, const std::string &t2) const
51 {
52 return searchKey(t1) == searchKey(t2);
53 }
54 private:
55 std::string searchKey(const std::string &input) const
56 {
57 std::string key = input;
58 if (!getCaseSenseNames())
59 {
60 key = convertUTF8ToLower(key);
61 }
62 return key;
63 }
64};
65
66/** Ordered dictionary of FileName objects. */
67class FileNameLinkedMap : public LinkedMap<FileName,FileNameFn,FileNameFn,
68 std::unordered_multimap<std::string,FileName*,FileNameFn,FileNameFn> >
69{
70};
71
72#endif
A model of a file symbol.
Definition filedef.h:99
std::string searchKey(const std::string &input) const
Definition filename.h:55
std::size_t operator()(const std::string &input) const noexcept
used as hash function
Definition filename.h:45
FileName(const QCString &nm)
Definition filename.h:32
QCString fileName() const
Definition filename.h:33
QCString m_name
Definition filename.h:36
Ordered dictionary of FileName objects.
Definition filename.h:69
Container class representing a vector of objects with keys.
Definition linkedmap.h:36
This is an alternative implementation of QCString.
Definition qcstring.h:101
std::string convertUTF8ToLower(const std::string &input)
Converts the input string into a lower case version, also taking into account non-ASCII characters th...
Definition utf8.cpp:187
Various UTF8 related helper functions.
bool getCaseSenseNames()
Definition util.cpp:3341
A bunch of utility functions.