Skip to content

Commit d94f100

Browse files
authored
Merge pull request #71 from davidcaron/add-access-property-to-using
Add access property to 'using' CppVariable
2 parents 72d5b01 + 2dc5df5 commit d94f100

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

CppHeaderParser/CppHeaderParser.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1204,6 +1204,7 @@ class CppVariable(_CppVariable):
12041204
* ``extern`` - True if its an extern, False if not
12051205
* ``parent`` - If not None, either the class this is a property of, or the
12061206
method this variable is a parameter in
1207+
* ``access`` - Anything in supportedAccessSpecifier
12071208
"""
12081209

12091210
Vars = []
@@ -1320,6 +1321,7 @@ def __str__(self):
13201321
"desc",
13211322
"line_number",
13221323
"extern",
1324+
"access",
13231325
]
13241326
cpy = dict((k, v) for (k, v) in list(self.items()) if k in keys_white_list)
13251327
if "array_size" in self:
@@ -3382,6 +3384,7 @@ def _evaluate_stack(self, token=None):
33823384
else:
33833385
atype["raw_type"] = ns + atype["type"]
33843386

3387+
atype["access"] = self.curAccessSpecifier
33853388
if self.curClass:
33863389
klass = self.classes[self.curClass]
33873390
klass["using"][alias] = atype

test/test_CppHeaderParser.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4015,6 +4015,7 @@ def setUp(self):
40154015
self.cppHeader = CppHeaderParser.CppHeader(
40164016
"""
40174017
template <class D> class P {
4018+
using A = typename f::TP<D>::A;
40184019
public:
40194020
using State = typename f::TP<D>::S;
40204021
P(State st);
@@ -4026,9 +4027,15 @@ def setUp(self):
40264027
def test_fn(self):
40274028
c = self.cppHeader.classes["P"]
40284029
self.assertEqual("P", c["name"])
4030+
self.assertEqual(len(c["using"]), 2)
40294031
state = c["using"]["State"]
40304032
self.assertEqual(state["raw_type"], "typename f::TP<D >::S")
40314033
self.assertEqual(state["type"], "typename TP<D >::S")
4034+
self.assertEqual(state["access"], "public")
4035+
private = c["using"]["A"]
4036+
self.assertEqual(private["raw_type"], "typename f::TP<D >::A")
4037+
self.assertEqual(private["type"], "typename TP<D >::A")
4038+
self.assertEqual(private["access"], "private")
40324039

40334040
m = c["methods"]["public"][0]
40344041
self.assertEqual(m["name"], "P")

0 commit comments

Comments
 (0)