Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class %Object% {
- public:
- explicit %Object%() = default;
- ~%Object%() = default;
- %Object%(%Object%&& rhs) = default;
- %Object%(const %Object%& rhs) = default;
- %Object%& operator=(%Object%&& rhs) = default;
- %Object%& operator=(const %Object%& rhs) = default;
- protected:
- private:
- }
- #include "%Object%.hpp"
- " Function to substitute the class names in a file
- function! SubstituteClassName()
- execute "1,$s/%Object%/" . expand("%:t:r") . "/g"
- endfunction
- " Function to create the skeleton of a header file
- function! CreateHeaderFile()
- 1
- insert
- #pragma once
- #ifndef %Object%_H
- #define %Object%_H
- class %Object% {
- public:
- explicit %Object%() = default;
- ~%Object%() = default;
- %Object%(%Object%&& rhs) = default;
- %Object%(const %Object%& rhs) = default;
- %Object%& operator=(%Object%&& rhs) = default;
- %Object%& operator=(const %Object%& rhs) = default;
- protected:
- private:
- }
- .
- call SubstituteClassName()
- endfunction
- " Function to create the skeleton of a source file
- function! CreateSourceFile()
- 1
- insert
- #include "%Object%.hpp"
- .
- call SubstituteClassName()
- endfunction
- function! CreateClassFiles(name)
- " Open the header file.
- execute "edit " . a:name . ".hpp"
- " Create the skeleton of the header file
- call CreateHeaderFile()
- " Write the file
- wa
- " Open the source file.
- execute "edit " . a:name . ".cpp"
- " Create the skeleton of the header file
- call CreateSourceFile()
- " Write the file
- wa
- endfunction
- call CreateClassFiles("myclassname")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement