nany
classdef-table-view.hxx
1 #pragma once
2 #include "classdef-table-view.h"
3 
4 
5 namespace ny {
6 
7 
8 inline ClassdefTableView::ClassdefTableView(ClassdefTable& table)
9  : table(table) {
10 }
11 
12 
13 inline ClassdefTableView::ClassdefTableView(ClassdefTableView& view)
14  : ClassdefTableView(view.table) {
15 }
16 
17 
18 inline ClassdefTableView::ClassdefTableView(ClassdefTableView& view, uint32_t atomid, uint count)
19  : ClassdefTableView(view.table) {
20  // preparing the new layer via the local data, then swapping
21  previous.atomid = atomid;
22  // reminder: parameters are 2-based
23  // 0 -> invalid
24  // 1 -> return value / type
25  // 2 -> first parameter (or first register if no parameter)
26  previous.flags.reserve(count + 2); // parameters are 2-base
27  previous.storage.reserve((count + 2) * 2); // arbitrary, but at least 'count+2'
28  // swap the layer
29  previous.swap(table.m_layer);
30  canSwap = true;
31 }
32 
33 
34 inline ClassdefTableView::~ClassdefTableView() {
35  if (canSwap)
36  table.m_layer.swap(previous);
37 }
38 
39 
40 inline AnyString ClassdefTableView::keyword(const Atom& atom) const {
41  return table.keyword(atom);
42 }
43 
44 
45 inline const Classdef& ClassdefTableView::classdefFollowClassMember(const CLID& clid) const {
46  return table.classdefFollowClassMember(clid);
47 }
48 
49 inline bool ClassdefTableView::hasClassdef(const CLID& clid) const {
50  return table.hasClassdef(clid);
51 }
52 
53 
54 inline Atom* ClassdefTableView::findClassdefAtom(const Classdef& cdef) const {
55  return table.findClassdefAtom(cdef);
56 }
57 
58 inline Atom* ClassdefTableView::findRawClassdefAtom(const Classdef& cdef) const {
59  return table.findRawClassdefAtom(cdef);
60 }
61 
62 
63 inline const Classdef& ClassdefTableView::classdef(const CLID& clid) const {
64  return table.classdef(clid);
65 }
66 
67 
68 inline const Classdef& ClassdefTableView::rawclassdef(const CLID& clid) const {
69  return table.rawclassdef(clid);
70 }
71 
72 
73 inline bool ClassdefTableView::hasSubstitute(const CLID& clid) const {
74  return table.hasSubstitute(clid);
75 }
76 
77 
78 inline Classdef& ClassdefTableView::substitute(uint32_t lvid) {
79  return table.substitute(lvid);
80 }
81 
82 
83 
84 inline Classdef& ClassdefTableView::addSubstitute(nytype_t kind, Atom* atom, const Qualifiers& qualifiers) {
85  return table.addSubstitute(kind, atom, qualifiers);
86 }
87 
88 
89 inline uint32_t ClassdefTableView::substituteAtomID() const {
90  return table.substituteAtomID();
91 }
92 
93 
94 inline void ClassdefTableView::substituteResize(uint count) {
95  table.substituteResize(count);
96 }
97 
98 
99 inline const AtomMap& ClassdefTableView::atoms() const {
100  return table.atoms;
101 }
102 
103 inline AtomMap& ClassdefTableView::atoms() {
104  return table.atoms;
105 }
106 
107 
109  return table;
110 }
111 
112 
114  return table;
115 }
116 
117 
118 } // namespace ny
Atom * findRawClassdefAtom(const Classdef &) const
Find the atom of a classdef, via its extends if necessary.
Definition: classdef-table.cpp:186
Definition: clid.h:11
const Classdef & rawclassdef(const CLID &) const
Retrieve a classdef from its ID without using the current layer.
Definition: classdef-table.cpp:69
Class definition.
Definition: classdef.h:24
AtomMap atoms
Atom map.
Definition: classdef-table.h:155
Definition: ast.cpp:6
Definition: classdef-table.h:19
Atom * findClassdefAtom(const Classdef &) const
Find the atom of a classdef, via its extends if necessary.
Definition: classdef-table.cpp:204
Classdef & addSubstitute(nytype_t kind, Atom *atom, const Qualifiers &qualifiers)
Append a new substitute.
Definition: classdef-table-view.hxx:84
void substituteResize(uint32_t count)
Resize the substitutes for the current layer.
Definition: classdef-table.cpp:233
bool hasSubstitute(CLID) const
Get if the current layer has a substitute for a given CLID.
Definition: classdef-table.cpp:222
Atoms.
Definition: atom-map.h:17
bool hasClassdef(const CLID &) const
Get if a clid is available.
Definition: classdef-table.hxx:16
Definition of a single class or function.
Definition: atom.h:37
const Classdef & classdefFollowClassMember(const CLID &) const
Retrieve the real classdef from its ID (or from the current layer) even if a class member...
Definition: classdef-table.cpp:118
AnyString keyword(const Atom &) const
Get the keyword associated to an atom (class, func, var, cref, namespace...)
Definition: classdef-table.cpp:306
uint32_t substituteAtomID() const
Get the atom id of the current layer.
Definition: classdef-table.hxx:46
uint32_t substituteAtomID() const
Get the atom id of the current layer.
Definition: classdef-table-view.hxx:89
void substituteResize(uint count)
Resize the substitutes for the current layer.
Definition: classdef-table-view.hxx:94
Classdef & substitute(uint32_t)
Create a new substiture in the current layer.
Definition: classdef-table-view.hxx:78
AnyString keyword(const Atom &) const
Get the keyword associated to an atom (class, func, var, cref, namespace...)
Definition: classdef-table-view.hxx:40
Classdef & substitute(uint32_t) const
Get the substiture for the current atomid in the current layer.
Definition: classdef-table.cpp:268
bool hasSubstitute(const CLID &) const
Get if the current view has a substitute for a given CLID.
Definition: classdef-table-view.hxx:73
Definition: qualifiers.h:9
Classdef & addSubstitute(nytype_t kind, Atom *atom, const Qualifiers &) const
Append a new substitute.
Definition: classdef-table.cpp:285
Classdef & classdef(const CLID &)
Retrieve or create a classdef from its ID.
Definition: classdef-table.cpp:45
const ClassdefTable & originalTable() const
The original table (const)
Definition: classdef-table-view.hxx:113