Skip to content

Commit 5df1933

Browse files
committed
Support compound namespace declarations
1 parent 584616a commit 5df1933

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

CppHeaderParser/CppHeaderParser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2891,7 +2891,7 @@ def __init__(self, headerFileName, argType="file", encoding=None, **kwargs):
28912891
== "__IGNORED_NAMESPACE__CppHeaderParser__"
28922892
): # Used in filtering extern "C"
28932893
self.nameStack[1] = ""
2894-
self.nameSpaces.append(self.nameStack[1])
2894+
self.nameSpaces.append("".join(self.nameStack[1:]))
28952895
ns = self.cur_namespace()
28962896
self.stack = []
28972897
self.stmtTokens = []

test/test_CppHeaderParser.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3961,5 +3961,22 @@ def test_fn(self):
39613961
self.assertEqual(m["parameters"][0]["raw_type"], "n1::A")
39623962

39633963

3964+
class CompoundNS(unittest.TestCase):
3965+
def setUp(self):
3966+
self.cppHeader = CppHeaderParser.CppHeader(
3967+
"""
3968+
namespace N1::N2 {
3969+
class B {};
3970+
};
3971+
""",
3972+
"string",
3973+
)
3974+
3975+
def test_fn(self):
3976+
c = self.cppHeader.classes["B"]
3977+
self.assertEqual("B", c["name"])
3978+
self.assertEqual("N1::N2", c["namespace"])
3979+
3980+
39643981
if __name__ == "__main__":
39653982
unittest.main()

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy