Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class FormatVisitor: public BaseVisitor {
- public:
- void Visit(const BaseNode* node) override {
- node->Visit(this);
- }
- void Visit(const ClassDeclarationNode* node) override {
- node->Visit(this);
- }
- void Visit(const VarDeclarationNode* node) override {
- node->Visit(this);
- }
- void Visit(const MethodDeclarationNode* node) override {
- node->Visit(this);
- }
- const std::vector<std::string>& GetFormattedCode() const {
- std::vector<std::string> formatted = {
- "class MyClass {",
- " public:",
- " void Print();",
- " void SetNum(int n);",
- "",
- " protected:",
- " OtherClass SomeMethod(int a, char b, MyClass c);",
- " int x_;",
- "",
- " private:",
- " void SetNumImpl(int num);",
- " class Iterator {",
- " public:",
- " void Next();",
- " bool Stopped();",
- " int* Dereference();",
- " };",
- "};",
- };
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement