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 FileName(const QCString &nm,const QCString &fn) : m_name(nm), m_fName(fn), m_pathName("tmp") {}
33 QCString fileName() const { return m_name; }
34 QCString fullName() const { return m_fName; }
35 QCString path() const { return m_pathName; }
36
37 private:
41};
42
43//! Custom combined key compare and hash functor that uses a lower case string in
44//! case CASE_SENSE_NAMES is set to NO.
46{
47 public:
48 //! used as hash function
49 std::size_t operator()(const std::string& input) const noexcept
50 {
51 return std::hash<std::string>()(searchKey(input));
52 }
53 //! used as equal operator
54 bool operator() (const std::string &t1, const std::string &t2) const
55 {
56 return searchKey(t1) == searchKey(t2);
57 }
58 private:
59 std::string searchKey(const std::string &input) const
60 {
61 std::string key = input;
62 if (!getCaseSenseNames())
63 {
64 key = convertUTF8ToLower(key);
65 }
66 return key;
67 }
68};
69
70/** Ordered dictionary of FileName objects. */
71class FileNameLinkedMap : public LinkedMap<FileName,FileNameFn,FileNameFn,
72 std::unordered_multimap<std::string,FileName*,FileNameFn,FileNameFn> >
73{
74};
75
76#endif
A model of a file symbol.
Definition filedef.h:99
Custom combined key compare and hash functor that uses a lower case string in case CASE_SENSE_NAMES i...
Definition filename.h:46
std::string searchKey(const std::string &input) const
Definition filename.h:59
std::size_t operator()(const std::string &input) const noexcept
used as hash function
Definition filename.h:49
QCString m_pathName
Definition filename.h:40
QCString path() const
Definition filename.h:35
QCString fileName() const
Definition filename.h:33
FileName(const QCString &nm, const QCString &fn)
Definition filename.h:32
QCString m_fName
Definition filename.h:39
QCString m_name
Definition filename.h:38
QCString fullName() const
Definition filename.h:34
Ordered dictionary of FileName objects.
Definition filename.h:73
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:3674
A bunch of utility functions.