Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Support compound namespace declarations #59

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CppHeaderParser/CppHeaderParser.py
Original file line number Diff line number Diff line change
Expand Up @@ -2891,7 +2891,7 @@ def __init__(self, headerFileName, argType="file", encoding=None, **kwargs):
== "__IGNORED_NAMESPACE__CppHeaderParser__"
): # Used in filtering extern "C"
self.nameStack[1] = ""
self.nameSpaces.append(self.nameStack[1])
self.nameSpaces.append("".join(self.nameStack[1:]))
ns = self.cur_namespace()
self.stack = []
self.stmtTokens = []
Expand Down
17 changes: 17 additions & 0 deletions test/test_CppHeaderParser.py
Original file line number Diff line number Diff line change
Expand Up @@ -3961,5 +3961,22 @@ def test_fn(self):
self.assertEqual(m["parameters"][0]["raw_type"], "n1::A")


class CompoundNS(unittest.TestCase):
def setUp(self):
self.cppHeader = CppHeaderParser.CppHeader(
"""
namespace N1::N2 {
class B {};
};
""",
"string",
)

def test_fn(self):
c = self.cppHeader.classes["B"]
self.assertEqual("B", c["name"])
self.assertEqual("N1::N2", c["namespace"])


if __name__ == "__main__":
unittest.main()