Doxygen
Loading...
Searching...
No Matches
membername.h
Go to the documentation of this file.
1/******************************************************************************
2 *
3 *
4 *
5 * Copyright (C) 1997-2015 by Dimitri van Heesch.
6 *
7 * Permission to use, copy, modify, and distribute this software and its
8 * documentation under the terms of the GNU General Public License is hereby
9 * granted. No representations are made about the suitability of this software
10 * for any purpose. It is provided "as is" without express or implied warranty.
11 * See the GNU General Public License for more details.
12 *
13 * Documents produced by Doxygen are derivative works derived from the
14 * input used in their production; they are not affected by this license.
15 *
16 */
17
18#ifndef MEMBERNAME_H
19#define MEMBERNAME_H
20
21#include "memberdef.h"
22#include "linkedmap.h"
23
25{
26 public:
27 using Ptr = std::unique_ptr<MemberDef>;
28 using Vec = std::vector<Ptr>;
29 using iterator = typename Vec::iterator;
30 using const_iterator = typename Vec::const_iterator;
31 using reverse_iterator = typename Vec::reverse_iterator;
32 using const_reverse_iterator = typename Vec::const_reverse_iterator;
33
34 MemberName(const QCString &name) : m_name(name) {}
35 QCString memberName() const { return m_name; }
36
37 iterator begin() { return m_members.begin(); }
38 iterator end() { return m_members.end(); }
39 const_iterator begin() const { return m_members.begin(); }
40 const_iterator end() const { return m_members.end(); }
41 const_iterator cbegin() const { return m_members.cbegin(); }
42 const_iterator cend() const { return m_members.cend(); }
43 reverse_iterator rbegin() { return m_members.rbegin(); }
44 reverse_iterator rend() { return m_members.rend(); }
45 const_reverse_iterator crbegin() const { return m_members.crbegin(); }
46 const_reverse_iterator crend() const { return m_members.crend(); }
47 bool empty() const { return m_members.empty(); }
48 size_t size() const { return m_members.size(); }
49 Ptr &back() { return m_members.back(); }
50 const Ptr &back() const { return m_members.back(); }
51 Ptr &front() { return m_members.front(); }
52 const Ptr &front() const { return m_members.front(); }
53 iterator erase(iterator it) { return m_members.erase(it); }
54 void push_back(Ptr &&p) { m_members.push_back(std::move(p)); }
55
56 private:
57 QCString m_name;
59};
60
61/** Ordered dictionary of MemberName objects. */
62class MemberNameLinkedMap : public LinkedMap<MemberName>
63{
64 public:
65 MemberName::Ptr take(const QCString &key,const MemberDef *value)
66 {
67 MemberName::Ptr result;
68 MemberName *mn = find(key);
69 if (mn)
70 {
71 auto it = std::find_if(mn->begin(),mn->end(),[&value](const auto &el) { return el.get()==value; });
72 if (it != mn->end())
73 {
74 it->swap(result);
75 mn->erase(it);
76 }
77 if (mn->empty())
78 {
79 del(key);
80 }
81 }
82 return result;
83 }
84};
85
86/** Data associated with a MemberDef in an inheritance relation. */
88{
89 public:
90 MemberInfo(MemberDef *md,Protection p,Specifier v,bool inh,bool vbc) :
91 m_memberDef(md), m_prot(p), m_virt(v), m_inherited(inh), m_virtBaseClass(vbc) {}
92
93 // getters
94 MemberDef *memberDef() { return m_memberDef; }
95 const MemberDef *memberDef() const { return m_memberDef; }
96 Protection prot() const { return m_prot; }
97 Specifier virt() const { return m_virt; }
98 bool inherited() const { return m_inherited; }
99 QCString scopePath() const { return m_scopePath; }
101 const ClassDef *ambigClass() const { return m_ambigClass; }
102 bool virtualBaseClass() const { return m_virtBaseClass; }
103
104 // setters
106 void setScopePath(const QCString &s) { m_scopePath = s; }
107 void setAmbigClass(const ClassDef *cd) { m_ambigClass = cd; }
108
109 private:
110 MemberDef * m_memberDef;
114 QCString m_scopePath;
116 const ClassDef *m_ambigClass = nullptr;
118};
119
121{
122 public:
123 using Ptr = std::unique_ptr<MemberInfo>;
124 using Vec = std::vector<Ptr>;
125 using iterator = typename Vec::iterator;
126 using const_iterator = typename Vec::const_iterator;
127
128 MemberNameInfo(const QCString &name) : m_name(name) {}
129 QCString memberName() const { return m_name; }
130
131 iterator begin() { return m_members.begin(); }
132 iterator end() { return m_members.end(); }
133 const_iterator begin() const { return m_members.begin(); }
134 const_iterator end() const { return m_members.end(); }
135 bool empty() const { return m_members.empty(); }
136 size_t size() const { return m_members.size(); }
137 Ptr &back() { return m_members.back(); }
138 const Ptr &back() const { return m_members.back(); }
139 Ptr &front() { return m_members.front(); }
140 const Ptr &front() const { return m_members.front(); }
141 void push_back(Ptr &&p) { m_members.push_back(std::move(p)); }
142
143 private:
144 QCString m_name;
146};
147
148class MemberNameInfoLinkedMap : public LinkedMap<MemberNameInfo>
149{
150};
151
152#endif
Container class representing a vector of objects with keys.
Definition linkedmap.h:36
bool del(const QCString &key)
Definition linkedmap.h:183
const MemberName * find(const std::string &key) const
Definition linkedmap.h:47
Protection prot() const
Definition membername.h:96
MemberDef * memberDef()
Definition membername.h:94
MemberInfo(MemberDef *md, Protection p, Specifier v, bool inh, bool vbc)
Definition membername.h:90
QCString ambiguityResolutionScope() const
Definition membername.h:100
MemberDef * m_memberDef
Definition membername.h:110
Protection m_prot
Definition membername.h:111
bool m_inherited
Definition membername.h:113
void setAmbiguityResolutionScope(const QCString &s)
Definition membername.h:105
Specifier m_virt
Definition membername.h:112
QCString m_scopePath
Definition membername.h:114
QCString m_ambiguityResolutionScope
Definition membername.h:115
Specifier virt() const
Definition membername.h:97
bool virtualBaseClass() const
Definition membername.h:102
const ClassDef * ambigClass() const
Definition membername.h:101
void setAmbigClass(const ClassDef *cd)
Definition membername.h:107
void setScopePath(const QCString &s)
Definition membername.h:106
const ClassDef * m_ambigClass
Definition membername.h:116
bool m_virtBaseClass
Definition membername.h:117
bool inherited() const
Definition membername.h:98
QCString scopePath() const
Definition membername.h:99
const MemberDef * memberDef() const
Definition membername.h:95
Ptr & back()
Definition membername.h:49
const_reverse_iterator crbegin() const
Definition membername.h:45
Ptr & front()
Definition membername.h:51
reverse_iterator rend()
Definition membername.h:44
const_iterator cend() const
Definition membername.h:42
const Ptr & front() const
Definition membername.h:52
const_iterator begin() const
Definition membername.h:39
typename Vec::reverse_iterator reverse_iterator
Definition membername.h:31
QCString memberName() const
Definition membername.h:35
const Ptr & back() const
Definition membername.h:50
iterator erase(iterator it)
Definition membername.h:53
const_reverse_iterator crend() const
Definition membername.h:46
MemberName(const QCString &name)
Definition membername.h:34
typename Vec::const_reverse_iterator const_reverse_iterator
Definition membername.h:32
typename Vec::const_iterator const_iterator
Definition membername.h:30
size_t size() const
Definition membername.h:48
Vec m_members
Definition membername.h:58
const_iterator end() const
Definition membername.h:40
QCString m_name
Definition membername.h:57
typename Vec::iterator iterator
Definition membername.h:29
reverse_iterator rbegin()
Definition membername.h:43
const_iterator cbegin() const
Definition membername.h:41
std::unique_ptr< MemberDef > Ptr
Definition membername.h:27
bool empty() const
Definition membername.h:47
iterator begin()
Definition membername.h:37
std::vector< Ptr > Vec
Definition membername.h:28
iterator end()
Definition membername.h:38
void push_back(Ptr &&p)
Definition membername.h:54
std::vector< Ptr > Vec
Definition membername.h:124
const Ptr & front() const
Definition membername.h:140
QCString memberName() const
Definition membername.h:129
const_iterator end() const
Definition membername.h:134
typename Vec::const_iterator const_iterator
Definition membername.h:126
const_iterator begin() const
Definition membername.h:133
bool empty() const
Definition membername.h:135
void push_back(Ptr &&p)
Definition membername.h:141
QCString m_name
Definition membername.h:144
iterator begin()
Definition membername.h:131
MemberNameInfo(const QCString &name)
Definition membername.h:128
iterator end()
Definition membername.h:132
size_t size() const
Definition membername.h:136
typename Vec::iterator iterator
Definition membername.h:125
const Ptr & back() const
Definition membername.h:138
std::unique_ptr< MemberInfo > Ptr
Definition membername.h:123
Ordered dictionary of MemberName objects.
Definition membername.h:63
MemberName::Ptr take(const QCString &key, const MemberDef *value)
Definition membername.h:65
Protection
Protection level of members.
Definition types.h:26
Specifier
Virtualness of a member.
Definition types.h:29