Doxygen
Toggle main menu visibility
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
26
class
FileDef
;
27
28
/** Class representing all files with a certain base name */
29
class
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
:
38
QCString
m_name
;
39
QCString
m_fName
;
40
QCString
m_pathName
;
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.
45
class
FileNameFn
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. */
71
class
FileNameLinkedMap
:
public
LinkedMap
<FileName,FileNameFn,FileNameFn,
72
std::unordered_multimap<std::string,FileName*,FileNameFn,FileNameFn> >
73
{
74
};
75
76
#endif
FileDef
A model of a file symbol.
Definition
filedef.h:99
FileNameFn
Definition
filename.h:46
FileNameFn::searchKey
std::string searchKey(const std::string &input) const
Definition
filename.h:59
FileNameFn::operator()
std::size_t operator()(const std::string &input) const noexcept
used as hash function
Definition
filename.h:49
FileName::m_pathName
QCString m_pathName
Definition
filename.h:40
FileName::path
QCString path() const
Definition
filename.h:35
FileName::fileName
QCString fileName() const
Definition
filename.h:33
FileName::FileName
FileName(const QCString &nm, const QCString &fn)
Definition
filename.h:32
FileName::m_fName
QCString m_fName
Definition
filename.h:39
FileName::m_name
QCString m_name
Definition
filename.h:38
FileName::fullName
QCString fullName() const
Definition
filename.h:34
FileNameLinkedMap
Ordered dictionary of FileName objects.
Definition
filename.h:73
LinkedMap
Container class representing a vector of objects with keys.
Definition
linkedmap.h:36
QCString
This is an alternative implementation of QCString.
Definition
qcstring.h:101
linkedmap.h
convertUTF8ToLower
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
utf8.h
Various UTF8 related helper functions.
getCaseSenseNames
bool getCaseSenseNames()
Definition
util.cpp:3301
util.h
A bunch of utility functions.
src
filename.h
Generated by
1.17.0