nany
classdef-table.hxx
1 #pragma once
2 #include "classdef-table.h"
3 
4 
5 namespace ny {
6 
7 
8 inline void ClassdefTable::LayerItem::swap(ClassdefTable::LayerItem& rhs) {
9  std::swap(atomid, rhs.atomid);
10  std::swap(flags, rhs.flags);
11  std::swap(storage, rhs.storage);
12  std::swap(count, rhs.count);
13 }
14 
15 
16 inline bool ClassdefTable::hasClassdef(const CLID& clid) const {
17  return (clid.atomid() == m_layer.atomid)
18  ? (clid.lvid() < m_layer.count and m_layer.flags[clid.lvid()])
19  : (0 != m_classdefs.count(clid));
20 }
21 
22 
23 inline Funcdef& ClassdefTable::addClassdefInterface(const Classdef& classdef, const AnyString& name) {
24  // the classdef may actually be an alias
25  // as a consequence we have to perform another lookup
26  return addClassdefInterface(classdef.clid, name);
27 }
28 
29 inline Funcdef& ClassdefTable::addClassdefInterfaceSelf(const Classdef& classdef, const AnyString& name) {
30  // the classdef may actually be an alias
31  // as a consequence we have to perform another lookup
32  return addClassdefInterfaceSelf(classdef.clid, name);
33 }
34 
35 
37  return addClassdefInterfaceSelf(clid, nullptr);
38 }
39 
40 
42  return addClassdefInterfaceSelf(classdef.clid, nullptr);
43 }
44 
45 
46 inline uint32_t ClassdefTable::substituteAtomID() const {
47  return m_layer.atomid;
48 }
49 
50 
51 } // namespace ny
uint32_t atomid() const
Get the atom id of the clid.
Definition: clid.hxx:64
Definition: clid.h:11
CLID clid
Classdef ID.
Definition: classdef.h:132
Class definition.
Definition: classdef.h:24
Function definition.
Definition: funcdef.h:15
Definition: ast.cpp:6
Funcdef & addClassdefInterfaceSelf(const CLID &, const AnyString &name)
Get or create an interface from its name for a given CLID.
Definition: classdef-table.cpp:137
bool hasClassdef(const CLID &) const
Get if a clid is available.
Definition: classdef-table.hxx:16
uint32_t substituteAtomID() const
Get the atom id of the current layer.
Definition: classdef-table.hxx:46
Funcdef & addClassdefInterface(const CLID &, const AnyString &name)
Get or create an interface from its name for a given CLID.
Definition: classdef-table.cpp:127
uint32_t lvid() const
Get the lvid part.
Definition: clid.hxx:69
Classdef & classdef(const CLID &)
Retrieve or create a classdef from its ID.
Definition: classdef-table.cpp:45