diff options
author | Ryan Kavanagh <ryanakca@kubuntu.org> | 2011-08-14 17:16:55 -0400 |
---|---|---|
committer | Ryan Kavanagh <ryanakca@kubuntu.org> | 2011-08-25 07:42:57 -0400 |
commit | 1c019761dfaf6be82de9284fa5e2b9dbfbdec27d (patch) | |
tree | 7ed6bd2f437d3a334bd7a81f62e6dfa63689272b /.vim/c-support/templates/cpp.cpp.template |
Initial import
Diffstat (limited to '.vim/c-support/templates/cpp.cpp.template')
-rw-r--r-- | .vim/c-support/templates/cpp.cpp.template | 329 |
1 files changed, 329 insertions, 0 deletions
diff --git a/.vim/c-support/templates/cpp.cpp.template b/.vim/c-support/templates/cpp.cpp.template new file mode 100644 index 0000000..7773989 --- /dev/null +++ b/.vim/c-support/templates/cpp.cpp.template @@ -0,0 +1,329 @@ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.method-implementation == +<CURSOR>void +|?CLASSNAME|::|?METHODNAME| ( ) +{ + return ; +} // ----- end of method |CLASSNAME|::|METHODNAME| ----- +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.class == +// ===================================================================================== +// Class: |?CLASSNAME:c| +// Description: <CURSOR> +// ===================================================================================== +class |CLASSNAME| +{ + public: + + // ==================== LIFECYCLE ======================================= + |CLASSNAME| (); // constructor + + // ==================== OPERATORS ======================================= + + // ==================== OPERATIONS ======================================= + + // ==================== ACCESS ======================================= + + // ==================== INQUIRY ======================================= + + // ==================== DATA MEMBERS ======================================= + protected: + + private: + +}; // ----- end of class |CLASSNAME| ----- + +//-------------------------------------------------------------------------------------- +// Class: |CLASSNAME| +// Method: |CLASSNAME| +// Description: constructor +//-------------------------------------------------------------------------------------- +|CLASSNAME|::|CLASSNAME| () +{ +} // ----- end of method |CLASSNAME|::|CLASSNAME| (constructor) ----- + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.class-using-new == +// ===================================================================================== +// Class: |?CLASSNAME:c| +// Description: <CURSOR> +// ===================================================================================== +class |CLASSNAME| +{ + public: + + // ==================== LIFECYCLE ======================================= + |CLASSNAME| (); // constructor + |CLASSNAME| ( const |CLASSNAME| &other ); // copy constructor + ~|CLASSNAME| (); // destructor + + // ==================== OPERATORS ======================================= + const |CLASSNAME|& operator = ( const |CLASSNAME| &other ); // assignment operator + + // ==================== OPERATIONS ======================================= + + // ==================== ACCESS ======================================= + + // ==================== INQUIRY ======================================= + + // ==================== DATA MEMBERS ======================================= + protected: + + private: + +}; // ----- end of class |CLASSNAME| ----- + +//-------------------------------------------------------------------------------------- +// Class: |CLASSNAME| +// Method: |CLASSNAME| +// Description: constructor +//-------------------------------------------------------------------------------------- +|CLASSNAME|::|CLASSNAME| () +{ +} // ----- end of method |CLASSNAME|::|CLASSNAME| (constructor) ----- + +//-------------------------------------------------------------------------------------- +// Class: |CLASSNAME| +// Method: |CLASSNAME| +// Description: copy constructor +//-------------------------------------------------------------------------------------- +|CLASSNAME|::|CLASSNAME| ( const |CLASSNAME| &other ) +{ +} // ----- end of method |CLASSNAME|::|CLASSNAME| (copy constructor) ----- + +//-------------------------------------------------------------------------------------- +// Class: |CLASSNAME| +// Method: ~|CLASSNAME| +// Description: destructor +//-------------------------------------------------------------------------------------- +|CLASSNAME|::~|CLASSNAME| () +{ +} // ----- end of method |CLASSNAME|::~|CLASSNAME| (destructor) ----- + +//-------------------------------------------------------------------------------------- +// Class: |CLASSNAME| +// Method: operator = +// Description: assignment operator +//-------------------------------------------------------------------------------------- +const |CLASSNAME|& +|CLASSNAME|::operator = ( const |CLASSNAME| &other ) +{ + if ( this != &other ) { + } + return *this; +} // ----- end of method |CLASSNAME|::operator = (assignment operator) ----- + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.error-class == +// ===================================================================================== +// Class: |?CLASSNAME:c| +// Description: <CURSOR> +// ===================================================================================== +class |CLASSNAME| +{ + public: |CLASSNAME| ( char *msg ):message(msg) { } + virtual ~|CLASSNAME| ( ) { } + virtual const char* what ( ) const throw ( ) { return message; } + protected: char *message; +}; // ---------- end of class |CLASSNAME| ---------- + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.template-method-implementation == +template < class T > +void<CURSOR> |?CLASSNAME|<T>::|?METHODNAME| ( ) +{ + return ; +} // ----- end of method |CLASSNAME|<T>::|METHODNAME| ----- +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.template-class == +// ===================================================================================== +// Class: |?CLASSNAME:c| +// Description: <CURSOR> +// ===================================================================================== + +template < class T > +class |CLASSNAME| +{ + public: + + // ==================== LIFECYCLE ======================================= + |CLASSNAME| (); // constructor + + // ==================== OPERATORS ======================================= + + // ==================== OPERATIONS ======================================= + + // ==================== ACCESS ======================================= + + // ==================== INQUIRY ======================================= + + // ==================== DATA MEMBERS ======================================= + protected: + + private: + +}; // ----- end of template class |CLASSNAME| ----- + +//-------------------------------------------------------------------------------------- +// Class: |CLASSNAME| +// Method: |CLASSNAME| +// Description: constructor +//-------------------------------------------------------------------------------------- +template < class T > +|CLASSNAME| <T>:: |CLASSNAME| () +{ +} // ----- end of constructor of template class |CLASSNAME| ----- + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.template-class-using-new == +// ===================================================================================== +// Class: |?CLASSNAME:c| +// Description: <CURSOR> +// ===================================================================================== + +template < class T > +class |CLASSNAME| +{ + public: + + // ==================== LIFECYCLE ======================================= + |CLASSNAME| (); // constructor + |CLASSNAME| ( const |CLASSNAME| &other ); // copy constructor + ~|CLASSNAME| (); // destructor + + // ==================== OPERATORS ======================================= + + const |CLASSNAME|& operator = ( const |CLASSNAME| &other ); // assignment operator + + // ==================== OPERATIONS ======================================= + + // ==================== ACCESS ======================================= + + // ==================== INQUIRY ======================================= + + // ==================== DATA MEMBERS ======================================= + protected: + + private: + +}; // ----- end of template class |CLASSNAME| ----- + +//-------------------------------------------------------------------------------------- +// Class: |CLASSNAME| +// Method: |CLASSNAME| +// Description: constructor +//-------------------------------------------------------------------------------------- +template < class T > +|CLASSNAME|<T>::|CLASSNAME| () +{ +} // ----- end of constructor of template class |CLASSNAME| ----- + +//-------------------------------------------------------------------------------------- +// Class: |CLASSNAME| +// Method: |CLASSNAME| +// Description: copy constructor +//-------------------------------------------------------------------------------------- +template < class T > +|CLASSNAME|<T>::|CLASSNAME| ( const |CLASSNAME| &other ) +{ +} // ----- end of copy constructor of template class |CLASSNAME| ----- + +//-------------------------------------------------------------------------------------- +// Class: |CLASSNAME| +// Method: ~|CLASSNAME| +// Description: destructor +//-------------------------------------------------------------------------------------- +template < class T > +|CLASSNAME|<T>::~|CLASSNAME| () +{ +} // ----- end of destructor of template class |CLASSNAME| ----- + +//-------------------------------------------------------------------------------------- +// Class: |CLASSNAME| +// Method: operator = +// Description: assignment operator +//-------------------------------------------------------------------------------------- +template < class T > +const |CLASSNAME|<T>& |CLASSNAME|<T>::operator = ( const |CLASSNAME| &other ) +{ + if ( this != &other ) { + } + return *this; +} // ----- end of assignment operator of template class |CLASSNAME| ----- + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.template-function == +template <class T> +<CURSOR>void |?TEMPALTE_FUNCTION_NAME| ( T param ) +{ + return ; +} // ----- end of template function |?TEMPALTE_FUNCTION_NAME| ----- +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.operator-in == +ostream & +operator << ( ostream & os, const |?CLASSNAME| & obj ) +{ + os << obj.<CURSOR> ; + return os; +} // ----- end of function operator << ----- +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.operator-out == +istream & +operator >> ( istream & is, |?CLASSNAME| & obj ) +{ + is >> obj.<CURSOR> ; + return is; +} // ----- end of function operator >> ----- +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.try-catch == +try {<CURSOR> +<SPLIT>} +catch ( const &ExceptObj ) { // handle exception: +} +catch (...) { // handle exception: unspezified +} + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.catch == +catch ( <CURSOR>const &ExceptObj ) { // handle exception: +<SPLIT>} +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.catch-points == +catch (...) { // handle exception: +<SPLIT>} +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.extern == +extern "C" {<CURSOR> +<SPLIT>} +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.open-input-file == +char *ifs_file_name = "<CURSOR>"; // input file name +ifstream ifs; // create ifstream object + +ifs.open (ifs_file_name); // open ifstream +if (!ifs) { + cerr << "\nERROR : failed to open input file " << ifs_file_name << endl; + exit (EXIT_FAILURE); +} + + +ifs.close (); // close ifstream +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.open-output-file == +char *ofs_file_name = "<CURSOR>"; // output file name +ofstream ofs; // create ofstream object + +ofs.open (ofs_file_name); // open ofstream +if (!ofs) { + cerr << "\nERROR : failed to open output file " << ofs_file_name << endl; + exit (EXIT_FAILURE); +} + + +ofs.close (); // close ofstream +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.namespace == +namespace |?NAMESPACE| +{<CURSOR> +<SPLIT>} // ----- end of |NAMESPACE| name ----- +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |