diff options
author | bnewbold <bnewbold@robocracy.org> | 2010-03-25 06:29:54 -0400 |
---|---|---|
committer | bnewbold <bnewbold@robocracy.org> | 2010-03-25 06:29:54 -0400 |
commit | 0bf28391b00b1e28c44324bcd7647df416314667 (patch) | |
tree | 6dda90e70218861975deb408eb21b2ff00eb5ef6 /.vim/c-support/templates | |
parent | 564a2d0d39c8e1fb79ee800973848b2442833356 (diff) | |
download | openwrt-repro-0bf28391b00b1e28c44324bcd7647df416314667.tar.gz openwrt-repro-0bf28391b00b1e28c44324bcd7647df416314667.zip |
lots and lots of vim stuff for c development...
Diffstat (limited to '.vim/c-support/templates')
-rw-r--r-- | .vim/c-support/templates/Templates | 30 | ||||
-rw-r--r-- | .vim/c-support/templates/c.comments.template | 160 | ||||
-rw-r--r-- | .vim/c-support/templates/c.cpp.template | 487 | ||||
-rw-r--r-- | .vim/c-support/templates/c.idioms.template | 133 | ||||
-rw-r--r-- | .vim/c-support/templates/c.preprocessor.template | 49 | ||||
-rw-r--r-- | .vim/c-support/templates/c.statements.template | 69 | ||||
-rw-r--r-- | .vim/c-support/templates/cpp.comments.template | 168 | ||||
-rw-r--r-- | .vim/c-support/templates/cpp.cpp.template | 450 | ||||
-rw-r--r-- | .vim/c-support/templates/cpp.idioms.template | 109 | ||||
-rw-r--r-- | .vim/c-support/templates/cpp.preprocessor.template | 50 | ||||
-rw-r--r-- | .vim/c-support/templates/cpp.statements.template | 72 |
11 files changed, 1777 insertions, 0 deletions
diff --git a/.vim/c-support/templates/Templates b/.vim/c-support/templates/Templates new file mode 100644 index 0000000..5841481 --- /dev/null +++ b/.vim/c-support/templates/Templates @@ -0,0 +1,30 @@ +$ +$ ============================================================= +$ ========== USER MACROS ====================================== +$ ============================================================= +$ +|AUTHOR| = bryan newbold +|AUTHORREF| = bnewbold +|EMAIL| = bnewbold@robocracy.org +|COMPANY| = +|COPYRIGHT| = Copyright (c) |YEAR|, |AUTHOR| +|STYLE| = default +$ +$ ============================================================= +$ ========== FILE INCLUDES ==================================== +$ ============================================================= +$ +|includefile| = c.comments.template +|includefile| = c.cpp.template +|includefile| = c.idioms.template +|includefile| = c.preprocessor.template +|includefile| = c.statements.template +$ +== IF |STYLE| IS CPP == +|includefile| = cpp.comments.template +|includefile| = cpp.cpp.template +|includefile| = cpp.idioms.template +|includefile| = cpp.preprocessor.template +|includefile| = cpp.statements.template +== ENDIF == +$ diff --git a/.vim/c-support/templates/c.comments.template b/.vim/c-support/templates/c.comments.template new file mode 100644 index 0000000..a500103 --- /dev/null +++ b/.vim/c-support/templates/c.comments.template @@ -0,0 +1,160 @@ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.end-of-line-comment == append == +/* <CURSOR> */ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.frame == +/*--------------------------------------------------------------------------- + * <CURSOR> + *---------------------------------------------------------------------------*/ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.function == +/* + * === FUNCTION ============================================================= + * Name: |?FUNCTION_NAME| + * Description: <CURSOR> + * ============================================================================ + */ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.method == +/* + *----------------------------------------------------------------------------- + * Class: |?CLASSNAME| + * Method: |?CLASSNAME| :: |?METHODNAME| + * Description: <CURSOR> + *----------------------------------------------------------------------------- + */ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.class == +/* + * ============================================================================ + * Class: |?CLASSNAME| + * Description: <CURSOR> + * ============================================================================ + */ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-description == start == +/*----------------------------------------------------------------------------- + * + * Filename: |FILENAME| + * Author: |AUTHOR| (|AUTHORREF|), |EMAIL| + * Created: |DATE| |TIME| + * Description: <CURSOR> + * + *---------------------------------------------------------------------------*/ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-description-header == start == +/*----------------------------------------------------------------------------- + * + * Filename: |FILENAME| + * Author: |AUTHOR| (|AUTHORREF|), |EMAIL| + * Created: |DATE| |TIME| + * Description: <CURSOR> + * + *---------------------------------------------------------------------------*/ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-cpp-header-includes == +/* ##### HEADER FILE INCLUDES ########################################## */ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-cpp-macros == +/* ##### MACROS - LOCAL TO THIS SOURCE FILE ########################## */ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-cpp-typedefs == +/* ##### TYPE DEFINITIONS - LOCAL TO THIS SOURCE FILE ################ */ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-cpp-data-types == +/* ##### DATA TYPES - LOCAL TO THIS SOURCE FILE ###################### */ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-cpp-class-defs == +/* ##### CLASS DEFINITIONS - LOCAL TO THIS SOURCE FILE ############### */ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-cpp-local-variables == +/* ##### VARIABLES - LOCAL TO THIS SOURCE FILE ####################### */ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-cpp-prototypes == +/* ##### PROTOTYPES - LOCAL TO THIS SOURCE FILE ###################### */ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-cpp-function-defs-exported == +/* ##### FUNCTION DEFINITIONS - EXPORTED FUNCTIONS ################### */ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-cpp-function-defs-local == +/* ##### FUNCTION DEFINITIONS - LOCAL TO THIS SOURCE FILE ############ */ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-cpp-class-implementations-exported == +/* ##### CLASS IMPLEMENTATIONS - EXPORTED CLASSES #################### */ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-cpp-class-implementations-local == +/* ##### CLASS IMPLEMENTATIONS - LOCAL CLASSES ####################### */ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-hpp-header-includes == +/* ##### HEADER FILE INCLUDES ########################################## */ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-hpp-macros == +/* ##### EXPORTED MACROS ############################################### */ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-hpp-exported-typedefs == +/* ##### EXPORTED TYPE DEFINITIONS ##################################### */ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-hpp-exported-data-types == +/* ##### EXPORTED DATA TYPES ########################################### */ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-hpp-exported-class-defs == +/* ##### EXPORTED CLASS DEFINITIONS #################################### */ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-hpp-exported-variables == +/* ##### EXPORTED VARIABLES ############################################ */ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-hpp-exported-function-declarations == +/* ##### EXPORTED FUNCTION DECLARATIONS ################################ */ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.keyword-bug == append == + /* :BUG:|DATE| |TIME|:|AUTHORREF|: <CURSOR> */ +== comment.keyword-compiler == append == + /* :COMPILER:|DATE| |TIME|:|AUTHORREF|: <CURSOR> */ +== comment.keyword-todo == append == + /* :TODO:|DATE| |TIME|:|AUTHORREF|: <CURSOR> */ +== comment.keyword-tricky == append == + /* :TRICKY:|DATE| |TIME|:|AUTHORREF|: <CURSOR> */ +== comment.keyword-warning == append == + /* :WARNING:|DATE| |TIME|:|AUTHORREF|: <CURSOR> */ +== comment.keyword-workaround == append == + /* :WORKAROUND:|DATE| |TIME|:|AUTHORREF|: <CURSOR> */ +== comment.keyword-keyword == append == + /* :|?KEYWORD:u|:|DATE| |TIME|:|AUTHORREF|: <CURSOR> */ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.special-empty == append == + /* EMPTY */<CURSOR> +== comment.special-fall-through == append == + /* FALL THROUGH */<CURSOR> +== comment.special-implicit-type-conversion == append == + /* IMPLICIT TYPE CONVERSION */<CURSOR> +== comment.special-no-return == append == + /* NO RETURN */<CURSOR> +== comment.special-not-reached == append == + /* NOT REACHED */<CURSOR> +== comment.special-remains-to-be-implemented == append == + /* REMAINS TO BE IMPLEMENTED */<CURSOR> +== comment.special-constant-type-is-long == append == + /* constant type is long */<CURSOR> +== comment.special-constant-type-is-unsigned == append == + /* constant type is unsigned */<CURSOR> +== comment.special-constant-type-is-unsigned-long == append == + /* constant type is unsigned long */<CURSOR> +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/.vim/c-support/templates/c.cpp.template b/.vim/c-support/templates/c.cpp.template new file mode 100644 index 0000000..97b9082 --- /dev/null +++ b/.vim/c-support/templates/c.cpp.template @@ -0,0 +1,487 @@ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +$ +== cpp.cin == +cin >> <CURSOR>; +$ +== cpp.cout == +cout << <CURSOR> << endl; +$ +== cpp.cout-operator == insert == +<< "<CURSOR>" +$ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.output-manipulator-boolalpha == insert == +<< boolalpha <CURSOR> +== cpp.output-manipulator-dec == insert == +<< dec <CURSOR> +== cpp.output-manipulator-endl == insert == +<< endl <CURSOR> +== cpp.output-manipulator-fixed == insert == +<< fixed <CURSOR> +== cpp.output-manipulator-flush == insert == +<< flush <CURSOR> +== cpp.output-manipulator-hex == insert == +<< hex <CURSOR> +== cpp.output-manipulator-internal == insert == +<< internal <CURSOR> +== cpp.output-manipulator-left == insert == +<< left <CURSOR> +== cpp.output-manipulator-oct == insert == +<< oct <CURSOR> +== cpp.output-manipulator-right == insert == +<< right <CURSOR> +== cpp.output-manipulator-scientific == insert == +<< scientific <CURSOR> +== cpp.output-manipulator-setbase == insert == +<< setbase(10<CURSOR>) +== cpp.output-manipulator-setfill == insert == +<< setfill(<CURSOR>) +== cpp.output-manipulator-setiosflag == insert == +<< setiosflags(<CURSOR>) +== cpp.output-manipulator-setprecision == insert == +<< setprecision(6<CURSOR>) +== cpp.output-manipulator-setw == insert == +<< setw(0<CURSOR>) +== cpp.output-manipulator-showbase == insert == +<< showbase <CURSOR> +== cpp.output-manipulator-showpoint == insert == +<< showpoint <CURSOR> +== cpp.output-manipulator-showpos == insert == +<< showpos <CURSOR> +== cpp.output-manipulator-uppercase == insert == +<< uppercase <CURSOR> +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.method-implementation == +void<CURSOR> +|?CLASSNAME|::|?METHODNAME| ( <+argument list+> ) +{ + return ; +} /* ----- end of method |CLASSNAME|::|?METHODNAME| ----- */ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.accessor-implementation == +/* + *----------------------------------------------------------------------------- + * Class: |?CLASSNAME| + * Method: get_|?ATTRIBUTE| + *----------------------------------------------------------------------------- + */ +inline int<CURSOR> +|CLASSNAME|::get_|ATTRIBUTE| ( ) +{ + return |ATTRIBUTE|; +} /* ----- end of method |CLASSNAME|::get_|ATTRIBUTE| ----- */ + +/* + *----------------------------------------------------------------------------- + * Class: |CLASSNAME| + * Method: set_|ATTRIBUTE| + *----------------------------------------------------------------------------- + */ +inline void +|CLASSNAME|::set_|ATTRIBUTE| ( <+argument list+> ) +{ + |ATTRIBUTE| = value; + return ; +} /* ----- end of method |CLASSNAME|::set_|ATTRIBUTE| ----- */ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.class-definition == +/* + * ============================================================================ + * Class: |?CLASSNAME:c| + * Description: <CURSOR> + * ============================================================================ + */ +class |CLASSNAME| +{ + public: + /* ==================== LIFECYCLE ============================== */ + |CLASSNAME| (); /* constructor */ + + /* ==================== ACCESSORS ============================== */ + + /* ==================== MUTATORS ============================== */ + + /* ==================== OPERATORS ============================== */ + + protected: + /* ==================== DATA MEMBERS ============================== */ + + private: + /* ==================== DATA MEMBERS ============================== */ + +}; /* ----- end of class |CLASSNAME| ----- */ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.class-implementation == +/* + *----------------------------------------------------------------------------- + * Class: |?CLASSNAME:c| + * Method: |CLASSNAME| + * Description: constructor + *----------------------------------------------------------------------------- + */ +|CLASSNAME|::|CLASSNAME| () +{<CURSOR> +} /* ----- end of method |CLASSNAME|::|CLASSNAME| (constructor) ----- */ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.class-using-new-definition == +/* + * ============================================================================ + * Class: |?CLASSNAME:c| + * Description: <CURSOR> + * ============================================================================ + */ +class |CLASSNAME| +{ + public: + + /* ==================== LIFECYCLE ============================== */ + |CLASSNAME| (); /* constructor */ + |CLASSNAME| ( const |CLASSNAME| &other ); /* copy constructor */ + ~|CLASSNAME| (); /* destructor */ + + /* ==================== ACCESSORS ============================== */ + + /* ==================== MUTATORS ============================== */ + + /* ==================== OPERATORS ============================== */ + + |CLASSNAME|& operator = ( const |CLASSNAME| &other ); /* assignment operator */ + + protected: + /* ==================== DATA MEMBERS ============================== */ + + private: + /* ==================== DATA MEMBERS ============================== */ + +}; /* ----- end of class |CLASSNAME| ----- */ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.class-using-new-implementation == +/* + *----------------------------------------------------------------------------- + * Class: |?CLASSNAME:c| + * Method: |CLASSNAME| + * Description: constructor + *----------------------------------------------------------------------------- + */ +|CLASSNAME|::|CLASSNAME| () +{<CURSOR> +} /* ----- 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 + *----------------------------------------------------------------------------- + */ +|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| ( string msg = "|CLASSNAME|" ):message(msg) { } + virtual ~|CLASSNAME| ( ) { } + virtual string what ( ) const throw ( ) { return message; } + protected: string message; +}; /* ----- end of class |CLASSNAME| ----- */ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.template-method-implementation == +template < class T > +void<CURSOR> |?CLASSNAME|<T>::|?METHODNAME| ( <+argument list+> ) +{ + return ; +} /* ----- end of method |CLASSNAME|<T>::|METHODNAME| ----- */ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.template-accessor-implementation == +/* + *----------------------------------------------------------------------------- + * Class: |?CLASSNAME| + * Method: get_|?ATTRIBUTE| + *----------------------------------------------------------------------------- + */ +template < class T > +inline int<CURSOR> |CLASSNAME|<T>::get_|ATTRIBUTE| ( ) +{ + return |ATTRIBUTE|; +} /* ----- end of method |CLASSNAME|<T>::get_|ATTRIBUTE| ----- */ + +/* + *----------------------------------------------------------------------------- + * Class: |CLASSNAME| + * Method: set_|ATTRIBUTE| + *----------------------------------------------------------------------------- + */ +template < class T > +inline void |CLASSNAME|<T>::set_|ATTRIBUTE| ( <+argument list+> ) +{ + |ATTRIBUTE| = value; + return ; +} /* ----- end of method |CLASSNAME|<T>::set_|ATTRIBUTE| ----- */ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.template-class-definition == +/* + * ============================================================================ + * Class: |?CLASSNAME:c| + * Description: <CURSOR> + * ============================================================================ + */ +template < class T > +class |CLASSNAME| +{ + public: + + /* ==================== LIFECYCLE ============================== */ + |CLASSNAME| (); /* constructor */ + + /* ==================== ACCESSORS ============================== */ + + /* ==================== MUTATORS ============================== */ + + /* ==================== OPERATORS ============================== */ + + protected: + /* ==================== DATA MEMBERS ============================== */ + + private: + /* ==================== DATA MEMBERS ============================== */ + +}; /* ---------- end of template class |CLASSNAME| ---------- */ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.template-class-implementation == +/* + *----------------------------------------------------------------------------- + * Class: |?CLASSNAME:c| + * Method: |CLASSNAME| + * Description: + *----------------------------------------------------------------------------- + */ +template < class T > +|CLASSNAME| < T >::|CLASSNAME| () +{<CURSOR> +} /* ---------- end of constructor of template class |CLASSNAME| ---------- */ + + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.template-class-using-new-definition == +/* + * ============================================================================ + * Class: |?CLASSNAME:c| + * Description: <CURSOR> + * ============================================================================ + */ + +template < class T > +class |CLASSNAME| +{ + public: + + // ==================== LIFECYCLE ============================== + |CLASSNAME| (); /* constructor */ + |CLASSNAME| ( const |CLASSNAME| &other ); /* copy constructor */ + ~|CLASSNAME| (); /* destructor */ + + /* ==================== ACCESSORS ============================== */ + + /* ==================== MUTATORS ============================== */ + + /* ==================== OPERATORS ============================== */ + + |CLASSNAME|& operator = ( const |CLASSNAME| &other ); // assignment operator + + protected: + /* ==================== DATA MEMBERS ============================== */ + + private: + /* ==================== DATA MEMBERS ============================== */ + +}; /* ----- end of template class |CLASSNAME| ----- */ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.template-class-using-new-implementation == +/* + *----------------------------------------------------------------------------- + * Class: |?CLASSNAME:c| + * Method: |CLASSNAME| + * Description: constructor + *----------------------------------------------------------------------------- + */ +template < class T > +|CLASSNAME|< T >::|CLASSNAME| () +{<CURSOR> +} /* ---------- 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 > +|CLASSNAME|< T >& |CLASSNAME|< T >::operator = ( const |CLASSNAME| &other ) +{ + return *this; +} /* ---------- end of assignment operator of template class |CLASSNAME| ---------- */ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.template-function == +template <class T> +void<CURSOR> |?TEMPALTE_FUNCTION_NAME| ( <+argument list+> ) +{ + 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 { +<SPLIT>} +catch ( const <CURSOR> &ExceptObj ) { /* handle exception: */ +} +catch (...) { /* handle exception: unspecified */ +} + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== 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); +} +<SPLIT>{-continue here-} +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); +} +<SPLIT>{-continue here-} +ofs.close (); /* close ofstream */ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.namespace-std == +using namespace std; +== cpp.namespace == +using namespace |?NAMESPACE|; +== cpp.namespace-block == +namespace |?NAMESPACE| {<CURSOR> +<SPLIT>} /* ----- end of namespace |NAMESPACE| ----- */ +== cpp.namespace-alias == +namespace |?NAMESPACE_ALIAS| = {-original namespace name-}; +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.rtti-typeid == insert == +typeid(<CURSOR><SPLIT>) +$ +== cpp.rtti-static-cast == insert == +static_cast<>(<CURSOR><SPLIT>) +$ +== cpp.rtti-const-cast == insert == +const_cast<>(<CURSOR><SPLIT>) +$ +== cpp.rtti-reinterpret-cast == insert == +reinterpret_cast<>(<CURSOR><SPLIT>) +$ +== cpp.rtti-dynamic-cast == insert == +dynamic_cast<>(<CURSOR><SPLIT>) +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/.vim/c-support/templates/c.idioms.template b/.vim/c-support/templates/c.idioms.template new file mode 100644 index 0000000..4565fab --- /dev/null +++ b/.vim/c-support/templates/c.idioms.template @@ -0,0 +1,133 @@ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== idioms.function == +/* + * === FUNCTION ====================================================================== + * Name: |?FUNCTION_NAME| + * Description: + * ===================================================================================== + */ +void<CURSOR> +|FUNCTION_NAME| ( <+argument list+> ) +{ +<SPLIT> return <+return value+>; +} /* ----- end of function |FUNCTION_NAME| ----- */ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== idioms.function-static == +/* + * === FUNCTION ====================================================================== + * Name: |?FUNCTION_NAME| + * Description: + * ===================================================================================== + */ +static void<CURSOR> +|FUNCTION_NAME| ( <+argument list+> ) +{ +<SPLIT> return <+return value+>; +} /* ----- end of static function |FUNCTION_NAME| ----- */ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== idioms.main == +#include <stdlib.h> + +/* + * === FUNCTION ====================================================================== + * Name: main + * Description: + * ===================================================================================== + */ +int +main ( int argc, char *argv[] ) +{<CURSOR> +<SPLIT> return EXIT_SUCCESS; +} /* ---------- end of function main ---------- */ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== idioms.enum == +enum |?ENUM_NAME| {<CURSOR> +<SPLIT>}; /* ---------- end of enum |ENUM_NAME| ---------- */ + +typedef enum |ENUM_NAME| |ENUM_NAME:c|; +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== idioms.struct == +struct |?STRUCT_NAME| {<CURSOR> +<SPLIT>}; /* ---------- end of struct |STRUCT_NAME| ---------- */ + +typedef struct |STRUCT_NAME| |STRUCT_NAME:c|; +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== idioms.union == +union |?UNION_NAME| {<CURSOR> +<SPLIT>}; /* ---------- end of union |UNION_NAME| ---------- */ + +typedef union |UNION_NAME| |UNION_NAME:c|; +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== idioms.printf == insert == +printf ( "<CURSOR>\n" ); +== idioms.scanf == insert == +scanf ( "<CURSOR>", & ); +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== idioms.calloc == +|?POINTER| = calloc ( (size_t)(<CURSOR><+COUNT+>), sizeof(<+TYPE+>) ); +if ( |POINTER|==NULL ) { + fprintf ( stderr, "\ndynamic memory allocation failed\n" ); + exit (EXIT_FAILURE); +} + +free (|POINTER|); +|POINTER| = NULL; + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== idioms.malloc == +|?POINTER| = malloc ( sizeof(<CURSOR><+TYPE+>) ); +if ( |POINTER|==NULL ) { + fprintf ( stderr, "\ndynamic memory allocation failed\n" ); + exit (EXIT_FAILURE); +} + +free (|POINTER|); +|POINTER| = NULL; + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== idioms.sizeof == insert == +sizeof(<CURSOR><SPLIT>) +== idioms.assert == insert == +assert(<CURSOR><SPLIT>); +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== idioms.open-input-file == +FILE *|?FILEPOINTER|; /* input-file pointer */ +char *|FILEPOINTER|_file_name = "<CURSOR>"; /* input-file name */ + +|FILEPOINTER| = fopen( |FILEPOINTER|_file_name, "r" ); +if ( |FILEPOINTER| == NULL ) { + fprintf ( stderr, "couldn't open file '%s'; %s\n", + |FILEPOINTER|_file_name, strerror(errno) ); + exit (EXIT_FAILURE); +} +<SPLIT>{-continue here-} +if( fclose(|FILEPOINTER|) == EOF ) { /* close input file */ + fprintf ( stderr, "couldn't close file '%s'; %s\n", + |FILEPOINTER|_file_name, strerror(errno) ); + exit (EXIT_FAILURE); +} + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== idioms.open-output-file == +FILE *|?FILEPOINTER|; /* output-file pointer */ +char *|FILEPOINTER|_file_name = "<CURSOR>"; /* output-file name */ + +|FILEPOINTER| = fopen( |FILEPOINTER|_file_name, "w" ); +if ( |FILEPOINTER| == NULL ) { + fprintf ( stderr, "couldn't open file '%s'; %s\n", + |FILEPOINTER|_file_name, strerror(errno) ); + exit (EXIT_FAILURE); +} +<SPLIT>{-continue here-} +if( fclose(|FILEPOINTER|) == EOF ) { /* close output file */ + fprintf ( stderr, "couldn't close file '%s'; %s\n", + |FILEPOINTER|_file_name, strerror(errno) ); + exit (EXIT_FAILURE); +} + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== idioms.fprintf == insert == +fprintf ( |?FILEPOINTER|, "<CURSOR>\n", ); +== idioms.fscanf == insert == +fscanf ( |?FILEPOINTER|, "<CURSOR>", & ); +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/.vim/c-support/templates/c.preprocessor.template b/.vim/c-support/templates/c.preprocessor.template new file mode 100644 index 0000000..f3aa127 --- /dev/null +++ b/.vim/c-support/templates/c.preprocessor.template @@ -0,0 +1,49 @@ +$------------------------------------------------------------------------- +== preprocessor.include-global == +#include <<CURSOR>> +$------------------------------------------------------------------------- +== preprocessor.include-local == +#include "<CURSOR>" +$------------------------------------------------------------------------- +== preprocessor.define == +#define <CURSOR> /* */ +$------------------------------------------------------------------------- +== preprocessor.undefine == +#undef <CURSOR> /* */ +$------------------------------------------------------------------------- +== preprocessor.if-else-endif == +#if |?CONDITION:u| +<CURSOR><SPLIT> +#else /* ----- not |CONDITION| ----- */ +<+ELSE PART+> +#endif /* ----- not |CONDITION| ----- */ +$------------------------------------------------------------------------- +== preprocessor.ifdef-else-endif == +#ifdef |?CONDITION:u| +<CURSOR><SPLIT> +#else /* ----- not |CONDITION| ----- */ +<+ELSE PART+> +#endif /* ----- not |CONDITION| ----- */ +$------------------------------------------------------------------------- +== preprocessor.ifndef-else-endif == +#ifndef |?CONDITION:u| +<CURSOR><SPLIT> +#else /* ----- not |CONDITION| ----- */ +<+ELSE PART+> +#endif /* ----- not |CONDITION| ----- */ +$------------------------------------------------------------------------- +== preprocessor.ifndef-def-endif == +#ifndef |?BASENAME:L|_INC +#define |BASENAME|_INC +<CURSOR><SPLIT> +#endif /* ----- #ifndef |BASENAME|_INC ----- */ +$------------------------------------------------------------------------- +== preprocessor.error == +#error "<CURSOR>" /* */ +$------------------------------------------------------------------------- +== preprocessor.line == +#line <CURSOR> /* */ +$------------------------------------------------------------------------- +== preprocessor.pragma == +#pragma <CURSOR> /* */ +$------------------------------------------------------------------------- diff --git a/.vim/c-support/templates/c.statements.template b/.vim/c-support/templates/c.statements.template new file mode 100644 index 0000000..574366d --- /dev/null +++ b/.vim/c-support/templates/c.statements.template @@ -0,0 +1,69 @@ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== statements.do-while == +do { +<SPLIT>} while ( <CURSOR> ); /* ----- end do-while ----- */ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== statements.for == +for ( <CURSOR>; ; ) +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== statements.for-block == +for ( <CURSOR>; ; ) { +<SPLIT>} +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== statements.if == +if ( <CURSOR> ) +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== statements.if-block == +if ( <CURSOR> ) { +<SPLIT><-IF PART-> +} +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== statements.if-else == +if ( <CURSOR> ) +<SPLIT>else +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== statements.if-block-else == +if ( <CURSOR> ) { +<SPLIT><-IF PART-> +} +else { +<-ELSE PART-> +} +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== statements.else-block == +else { +<CURSOR><SPLIT> +} +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== statements.while == +while ( <CURSOR> ) +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== statements.while-block == +while ( <CURSOR> ) { +<SPLIT>} +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== statements.switch == +switch ( <CURSOR> ) { + case <-LABEL->: + <SPLIT>break; + + case <-LABEL->: + break; + + case <-LABEL->: + break; + + default: + break; +} /* ----- end switch ----- */ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== statements.case == +case <CURSOR>: +break; + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== statements.block == +{ +<CURSOR><SPLIT> +} +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/.vim/c-support/templates/cpp.comments.template b/.vim/c-support/templates/cpp.comments.template new file mode 100644 index 0000000..b91ed44 --- /dev/null +++ b/.vim/c-support/templates/cpp.comments.template @@ -0,0 +1,168 @@ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.end-of-line-comment == append == +// <CURSOR> +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.frame == +//---------------------------------------------------------------------- +// <CURSOR> +//---------------------------------------------------------------------- +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.function == +// === FUNCTION ====================================================================== +// Name: |?FUNCTION_NAME| +// Description: <CURSOR> +// ===================================================================================== +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.method == +//-------------------------------------------------------------------------------------- +// Class: |?CLASSNAME| +// Method: |?METHODNAME| +// Description: <CURSOR> +//-------------------------------------------------------------------------------------- +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.class == +// ===================================================================================== +// Class: |?CLASSNAME| +// Description: <CURSOR> +// ===================================================================================== +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-description == start == +// ===================================================================================== +// +// Filename: |FILENAME| +// +// Description: <CURSOR> +// +// Version: 1.0 +// Created: |DATE| |TIME| +// Revision: none +// Compiler: g++ +// +// Author: |AUTHOR| (|AUTHORREF|), |EMAIL| +// Company: |COMPANY| +// +// ===================================================================================== +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-description-header == start == +// ===================================================================================== +// +// Filename: |FILENAME| +// +// Description: <CURSOR> +// +// Version: 1.0 +// Created: |DATE| |TIME| +// Revision: none +// Compiler: g++ +// +// Author: |AUTHOR| (|AUTHORREF|), |EMAIL| +// Company: |COMPANY| +// +// ===================================================================================== +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-cpp-header-includes == +// ##### HEADER FILE INCLUDES ################################################### + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-cpp-macros == +// ##### MACROS - LOCAL TO THIS SOURCE FILE ################################### + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-cpp-typedefs == +// ##### TYPE DEFINITIONS - LOCAL TO THIS SOURCE FILE ######################### + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-cpp-data-types == +// ##### DATA TYPES - LOCAL TO THIS SOURCE FILE ############################### + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-cpp-class-defs == +// ##### CLASS DEFINITIONS - LOCAL TO THIS SOURCE FILE ######################## + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-cpp-local-variables == +// ##### VARIABLES - LOCAL TO THIS SOURCE FILE ################################ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-cpp-prototypes == +// ##### PROTOTYPES - LOCAL TO THIS SOURCE FILE ############################### + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-cpp-function-defs-exported == +// ##### FUNCTION DEFINITIONS - EXPORTED FUNCTIONS ############################ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-cpp-function-defs-local == +// ##### FUNCTION DEFINITIONS - LOCAL TO THIS SOURCE FILE ##################### + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-cpp-class-implementations-exported == +// ##### CLASS IMPLEMENTATIONS - EXPORTED CLASSES ############################# + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-cpp-class-implementations-local == +// ##### CLASS IMPLEMENTATIONS - LOCAL CLASSES ################################ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-hpp-header-includes == +// ##### HEADER FILE INCLUDES ################################################### + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-hpp-macros == +// ##### EXPORTED MACROS ######################################################## + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-hpp-exported-typedefs == +// ##### EXPORTED TYPE DEFINITIONS ############################################## + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-hpp-exported-data-types == +// ##### EXPORTED DATA TYPES #################################################### + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-hpp-exported-class-defs == +// ##### EXPORTED CLASS DEFINITIONS ############################################# + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-hpp-exported-variables == +// ##### EXPORTED VARIABLES ##################################################### + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-hpp-exported-function-declarations == +// ##### EXPORTED FUNCTION DECLARATIONS ######################################### + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.keyword-bug == append == + // :BUG:|DATE| |TIME|:|AUTHORREF|: <CURSOR> +== comment.keyword-compiler == append == + // :COMPILER:|DATE| |TIME|:|AUTHORREF|: <CURSOR> +== comment.keyword-todo == append == + // :TODO:|DATE| |TIME|:|AUTHORREF|: <CURSOR> +== comment.keyword-tricky == append == + // :TRICKY:|DATE| |TIME|:|AUTHORREF|: <CURSOR> +== comment.keyword-warning == append == + // :WARNING:|DATE| |TIME|:|AUTHORREF|: <CURSOR> +== comment.keyword-workaround == append == + // :WORKAROUND:|DATE| |TIME|:|AUTHORREF|: <CURSOR> +== comment.keyword-keyword == append == + // :|?KEYWORD:u|:|DATE| |TIME|:|AUTHORREF|: <CURSOR> +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.special-empty == append == + // EMPTY<CURSOR> +== comment.special-fall-through == append == + // FALL THROUGH<CURSOR> +== comment.special-implicit-type-conversion == append == + // IMPLICIT TYPE CONVERSION<CURSOR> +== comment.special-no-return == append == + // NO RETURN<CURSOR> +== comment.special-not-reached == append == + // NOT REACHED<CURSOR> +== comment.special-remains-to-be-implemented == append == + // REMAINS TO BE IMPLEMENTED<CURSOR> +== comment.special-constant-type-is-long == append == + // constant type is long<CURSOR> +== comment.special-constant-type-is-unsigned == append == + // constant type is unsigned<CURSOR> +== comment.special-constant-type-is-unsigned-long == append == + // constant type is unsigned long<CURSOR> +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/.vim/c-support/templates/cpp.cpp.template b/.vim/c-support/templates/cpp.cpp.template new file mode 100644 index 0000000..6bdbe8b --- /dev/null +++ b/.vim/c-support/templates/cpp.cpp.template @@ -0,0 +1,450 @@ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +$ +== cpp.cin == +cin >> <CURSOR>; +$ +== cpp.cout == +cout << <CURSOR> << endl; +$ +== cpp.cout-operator == insert == +<< "<CURSOR>" +$ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.output-manipulator-boolalpha == insert == +<< boolalpha <CURSOR> +== cpp.output-manipulator-dec == insert == +<< dec <CURSOR> +== cpp.output-manipulator-endl == insert == +<< endl <CURSOR> +== cpp.output-manipulator-fixed == insert == +<< fixed <CURSOR> +== cpp.output-manipulator-flush == insert == +<< flush <CURSOR> +== cpp.output-manipulator-hex == insert == +<< hex <CURSOR> +== cpp.output-manipulator-internal == insert == +<< internal <CURSOR> +== cpp.output-manipulator-left == insert == +<< left <CURSOR> +== cpp.output-manipulator-oct == insert == +<< oct <CURSOR> +== cpp.output-manipulator-right == insert == +<< right <CURSOR> +== cpp.output-manipulator-scientific == insert == +<< scientific <CURSOR> +== cpp.output-manipulator-setbase == insert == +<< setbase(10<CURSOR>) +== cpp.output-manipulator-setfill == insert == +<< setfill(<CURSOR>) +== cpp.output-manipulator-setiosflag == insert == +<< setiosflags(<CURSOR>) +== cpp.output-manipulator-setprecision == insert == +<< setprecision(6<CURSOR>) +== cpp.output-manipulator-setw == insert == +<< setw(0<CURSOR>) +== cpp.output-manipulator-showbase == insert == +<< showbase <CURSOR> +== cpp.output-manipulator-showpoint == insert == +<< showpoint <CURSOR> +== cpp.output-manipulator-showpos == insert == +<< showpos <CURSOR> +== cpp.output-manipulator-uppercase == insert == +<< uppercase <CURSOR> +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.method-implementation == +void<CURSOR> +|?CLASSNAME|::|?METHODNAME| ( <+argument list+> ) +{ + return ; +} // ----- end of method |CLASSNAME|::|METHODNAME| ----- + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.accessor-implementation == +//-------------------------------------------------------------------------------------- +// Class: |?CLASSNAME| +// Method: get_|?ATTRIBUTE| +//-------------------------------------------------------------------------------------- +inline int<CURSOR> +|CLASSNAME|::get_|ATTRIBUTE| ( ) +{ + return |ATTRIBUTE|; +} // ----- end of method |CLASSNAME|::get_|ATTRIBUTE| ----- + +//-------------------------------------------------------------------------------------- +// Class: |CLASSNAME| +// Method: set_|ATTRIBUTE| +//-------------------------------------------------------------------------------------- +inline void +|CLASSNAME|::set_|ATTRIBUTE| ( <+argument list+> ) +{ + |ATTRIBUTE| = value; + return ; +} // ----- end of method |CLASSNAME|::set_|ATTRIBUTE| ----- + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.class-definition == +// ===================================================================================== +// Class: |?CLASSNAME:c| +// Description: <CURSOR> +// ===================================================================================== +class |CLASSNAME| +{ + public: + + // ==================== LIFECYCLE ======================================= + |CLASSNAME| (); // constructor + + // ==================== ACCESSORS ======================================= + + // ==================== MUTATORS ======================================= + + // ==================== OPERATORS ======================================= + + protected: + // ==================== DATA MEMBERS ======================================= + + private: + // ==================== DATA MEMBERS ======================================= + +}; // ----- end of class |CLASSNAME| ----- + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.class-implementation == +//-------------------------------------------------------------------------------------- +// Class: |?CLASSNAME| +// Method: |CLASSNAME| +// Description: constructor +//-------------------------------------------------------------------------------------- +|CLASSNAME|::|CLASSNAME| () +{<CURSOR> +} // ----- end of method |CLASSNAME|::|CLASSNAME| (constructor) ----- + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.class-using-new-definition == +// ===================================================================================== +// Class: |?CLASSNAME:c| +// Description: <CURSOR> +// ===================================================================================== +class |CLASSNAME| +{ + public: + + // ==================== LIFECYCLE ======================================= + |CLASSNAME| (); // constructor + |CLASSNAME| ( const |CLASSNAME| &other ); // copy constructor + ~|CLASSNAME| (); // destructor + + // ==================== ACCESSORS ======================================= + + // ==================== MUTATORS ======================================= + + // ==================== OPERATORS ======================================= + + |CLASSNAME|& operator = ( const |CLASSNAME| &other ); // assignment operator + + protected: + // ==================== DATA MEMBERS ======================================= + + private: + // ==================== DATA MEMBERS ======================================= + +}; // ----- end of class |CLASSNAME| ----- + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.class-using-new-implementation == +//-------------------------------------------------------------------------------------- +// Class: |?CLASSNAME| +// Method: |CLASSNAME| +// Description: constructor +//-------------------------------------------------------------------------------------- +|CLASSNAME|::|CLASSNAME| () +{<CURSOR> +} // ----- 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 +//-------------------------------------------------------------------------------------- +|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| ( string msg = "|CLASSNAME|" ):message(msg) { } + virtual ~|CLASSNAME| ( ) { } + virtual string what ( ) const throw ( ) { return message; } + protected: string message; +}; // ---------- end of class |CLASSNAME| ---------- + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.template-method-implementation == +template < class T > +void<CURSOR> |?CLASSNAME|<T>::|?METHODNAME| ( <+argument list+> ) +{ + return ; +} // ----- end of method |CLASSNAME|<T>::|METHODNAME| ----- +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.template-accessor-implementation == +//-------------------------------------------------------------------------------------- +// Class: |?CLASSNAME| +// Method: get_|?ATTRIBUTE| +//-------------------------------------------------------------------------------------- +template < class T > +inline int<CURSOR> |CLASSNAME|<T>::get_|ATTRIBUTE| ( ) +{ + return |ATTRIBUTE|; +} // ----- end of method |CLASSNAME|<T>::get_|ATTRIBUTE| ----- + +//-------------------------------------------------------------------------------------- +// Class: |CLASSNAME| +// Method: set_|ATTRIBUTE| +//-------------------------------------------------------------------------------------- +template < class T > +inline void |CLASSNAME|<T>::set_|ATTRIBUTE| ( <+argument list+> ) +{ + |ATTRIBUTE| = value; + return ; +} // ----- end of method |CLASSNAME|<T>::set_|ATTRIBUTE| ----- +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.template-class-definition == +// ===================================================================================== +// Class: |?CLASSNAME:c| +// Description: <CURSOR> +// ===================================================================================== + +template < class T > +class |CLASSNAME| +{ + public: + + // ==================== LIFECYCLE ======================================= + |CLASSNAME| (); // constructor + + // ==================== ACCESSORS ======================================= + + // ==================== MUTATORS ======================================= + + // ==================== OPERATORS ======================================= + + protected: + // ==================== DATA MEMBERS ======================================= + + private: + // ==================== DATA MEMBERS ======================================= + +}; // ----- end of template class |CLASSNAME| ----- + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.template-class-implementation == +//-------------------------------------------------------------------------------------- +// Class: |?CLASSNAME| +// Method: |CLASSNAME| +// Description: constructor +//-------------------------------------------------------------------------------------- +template < class T > +|CLASSNAME| <T>:: |CLASSNAME| () +{<CURSOR> +} // ----- end of constructor of template class |CLASSNAME| ----- + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.template-class-using-new-definition == +// ===================================================================================== +// Class: |?CLASSNAME:c| +// Description: <CURSOR> +// ===================================================================================== + +template < class T > +class |CLASSNAME| +{ + public: + + // ==================== LIFECYCLE ======================================= + |CLASSNAME| (); // constructor + |CLASSNAME| ( const |CLASSNAME| &other ); // copy constructor + ~|CLASSNAME| (); // destructor + + // ==================== ACCESSORS ======================================= + + // ==================== MUTATORS ======================================= + + // ==================== OPERATORS ======================================= + + |CLASSNAME|& operator = ( const |CLASSNAME| &other ); // assignment operator + + protected: + // ==================== DATA MEMBERS ======================================= + + private: + // ==================== DATA MEMBERS ======================================= + +}; // ----- end of template class |CLASSNAME| ----- + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.template-class-using-new-implementation == +//-------------------------------------------------------------------------------------- +// 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 ) +{<CURSOR> +} // ----- 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 > +|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> +void<CURSOR> |?TEMPALTE_FUNCTION_NAME| ( <+argument list+> ) +{ + 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 { +<SPLIT>} +catch ( const <CURSOR> &ExceptObj ) { // handle exception: +} +catch (...) { // handle exception: unspecified +} + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== 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 == +string ifs_file_name = "<CURSOR>"; // input file name +ifstream ifs; // create ifstream object + +ifs.open ( ifs_file_name.c_str() ); // open ifstream +if (!ifs) { + cerr << "\nERROR : failed to open input file " << ifs_file_name << endl; + exit (EXIT_FAILURE); +} +<SPLIT>{-continue here-} +ifs.close (); // close ifstream +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.open-output-file == +string ofs_file_name = "<CURSOR>"; // input file name +ofstream ofs; // create ofstream object + +ofs.open ( ofs_file_name.c_str() ); // open ofstream +if (!ofs) { + cerr << "\nERROR : failed to open output file " << ofs_file_name << endl; + exit (EXIT_FAILURE); +} +<SPLIT>{-continue here-} +ofs.close (); // close ofstream +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.namespace-std == +using namespace std; +== cpp.namespace == +using namespace |?NAMESPACE|; +== cpp.namespace-block == +namespace |?NAMESPACE| {<CURSOR> +<SPLIT>} // ----- end of namespace |NAMESPACE| ----- +== cpp.namespace-alias == +namespace |?NAMESPACE_ALIAS| = {-original namespace name-}; +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.rtti-typeid == insert == +typeid(<CURSOR><SPLIT>) +$ +== cpp.rtti-static-cast == insert == +static_cast<>(<CURSOR><SPLIT>) +$ +== cpp.rtti-const-cast == insert == +const_cast<>(<CURSOR><SPLIT>) +$ +== cpp.rtti-reinterpret-cast == insert == +reinterpret_cast<>(<CURSOR><SPLIT>) +$ +== cpp.rtti-dynamic-cast == insert == +dynamic_cast<>(<CURSOR><SPLIT>) +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/.vim/c-support/templates/cpp.idioms.template b/.vim/c-support/templates/cpp.idioms.template new file mode 100644 index 0000000..fa09ba8 --- /dev/null +++ b/.vim/c-support/templates/cpp.idioms.template @@ -0,0 +1,109 @@ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== idioms.function == +void<CURSOR> +|?FUNCTION_NAME| ( <+argument list+> ) +{ +<SPLIT> return <+return value+>; +} // ----- end of function |FUNCTION_NAME| ----- +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== idioms.function-static == +static void<CURSOR> +|?FUNCTION_NAME| ( <+argument list+> ) +{ +<SPLIT> return <+return value+>; +} // ----- end of static function |FUNCTION_NAME| ----- +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== idioms.main == +#include <cstdlib> + +int +main ( int argc, char *argv[] ) +{<CURSOR> +<SPLIT> return EXIT_SUCCESS; +} // ---------- end of function main ---------- +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== idioms.enum == +enum |?ENUM_NAME| {<CURSOR> +<SPLIT>}; // ---------- end of enum |ENUM_NAME| ---------- +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== idioms.struct == +struct |?STRUCT_NAME| {<CURSOR> +<SPLIT>}; // ---------- end of struct |STRUCT_NAME| ---------- +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== idioms.union == +union |?UNION_NAME| {<CURSOR> +<SPLIT>}; // ---------- end of union |UNION_NAME| ---------- +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== idioms.printf == insert == +printf ( "<CURSOR>\n" ); +== idioms.scanf == insert == +scanf ( "<CURSOR>", & ); +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== idioms.calloc == +|?POINTER| = calloc ( (size_t)(<CURSOR><+COUNT+>), sizeof(<+TYPE+>) ); +if ( |POINTER|==NULL ) { + fprintf ( stderr, "\ndynamic memory allocation failed\n" ); + exit (EXIT_FAILURE); +} + +free (|POINTER|); +|POINTER| = NULL; + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== idioms.malloc == +|?POINTER| = malloc ( sizeof(<CURSOR><+TYPE+>) ); +if ( |POINTER|==NULL ) { + fprintf ( stderr, "\ndynamic memory allocation failed\n" ); + exit (EXIT_FAILURE); +} + +free (|POINTER|); +|POINTER| = NULL; + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== idioms.sizeof == insert == +sizeof(<CURSOR><SPLIT>) +== idioms.assert == insert == +assert(<CURSOR><SPLIT>); +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== idioms.open-input-file == +FILE *|?FILEPOINTER|; // input-file pointer +char *|FILEPOINTER|_file_name = "<CURSOR>"; // input-file name + +|FILEPOINTER| = fopen( |FILEPOINTER|_file_name, "r" ); +if ( |FILEPOINTER| == NULL ) { + fprintf ( stderr, "couldn't open file '%s'; %s\n", + |FILEPOINTER|_file_name, strerror(errno) ); + exit (EXIT_FAILURE); +} +<SPLIT>{-continue here-} +if( fclose(|FILEPOINTER|) == EOF ) { // close input file + fprintf ( stderr, "couldn't close file '%s'; %s\n", + |FILEPOINTER|_file_name, strerror(errno) ); + exit (EXIT_FAILURE); +} + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== idioms.open-output-file == +FILE *|?FILEPOINTER|; // output-file pointer +char *|FILEPOINTER|_file_name = "<CURSOR>"; // output-file name + +|FILEPOINTER| = fopen( |FILEPOINTER|_file_name, "w" ); +if ( |FILEPOINTER| == NULL ) { + fprintf ( stderr, "couldn't open file '%s'; %s\n", + |FILEPOINTER|_file_name, strerror(errno) ); + exit (EXIT_FAILURE); +} +<SPLIT>{-continue here-} +if( fclose(|FILEPOINTER|) == EOF ) { // close output file + fprintf ( stderr, "couldn't close file '%s'; %s\n", + |FILEPOINTER|_file_name, strerror(errno) ); + exit (EXIT_FAILURE); +} + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== idioms.fprintf == insert == +fprintf ( |?FILEPOINTER|, "<CURSOR>\n", ); +== idioms.fscanf == insert == +fscanf ( |?FILEPOINTER|, "<CURSOR>", & ); +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/.vim/c-support/templates/cpp.preprocessor.template b/.vim/c-support/templates/cpp.preprocessor.template new file mode 100644 index 0000000..68de87f --- /dev/null +++ b/.vim/c-support/templates/cpp.preprocessor.template @@ -0,0 +1,50 @@ +$------------------------------------------------------------------------- +== preprocessor.include-global == +#include <<CURSOR>> +$------------------------------------------------------------------------- +== preprocessor.include-local == +#include "<CURSOR>" +$------------------------------------------------------------------------- +== preprocessor.define == +#define <CURSOR> // +$------------------------------------------------------------------------- +== preprocessor.undefine == +#undef <CURSOR> // +$------------------------------------------------------------------------- +== preprocessor.if-else-endif == +#if |?CONDITION:u| +<CURSOR><SPLIT> +#else // ----- not |CONDITION| ----- +<+ELSE PART+> + +#endif // ----- not |CONDITION| ----- +$------------------------------------------------------------------------- +== preprocessor.ifdef-else-endif == +#ifdef |?CONDITION:u| +<CURSOR><SPLIT> +#else // ----- not |CONDITION| ----- +<+ELSE PART+> +#endif // ----- not |CONDITION| ----- +$------------------------------------------------------------------------- +== preprocessor.ifndef-else-endif == +#ifndef |?CONDITION:u| +<CURSOR><SPLIT> +#else // ----- not |CONDITION| ----- +<+ELSE PART+> +#endif // ----- not |CONDITION| ----- +$------------------------------------------------------------------------- +== preprocessor.ifndef-def-endif == +#ifndef |?BASENAME:L|_INC +#define |BASENAME|_INC +<CURSOR><SPLIT> +#endif // ----- #ifndef |BASENAME|_INC ----- +$------------------------------------------------------------------------- +== preprocessor.error == +#error "<CURSOR>" // +$------------------------------------------------------------------------- +== preprocessor.line == +#line <CURSOR> // +$------------------------------------------------------------------------- +== preprocessor.pragma == +#pragma <CURSOR> // +$------------------------------------------------------------------------- diff --git a/.vim/c-support/templates/cpp.statements.template b/.vim/c-support/templates/cpp.statements.template new file mode 100644 index 0000000..c2fdecb --- /dev/null +++ b/.vim/c-support/templates/cpp.statements.template @@ -0,0 +1,72 @@ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== statements.do-while == +do { +<SPLIT>} while ( <CURSOR> ); // ----- end do-while ----- +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== statements.for == +for ( <CURSOR>; ; ) +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== statements.for-block == +for ( <CURSOR>; ; ) { +<SPLIT>} +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== statements.if == +if ( <CURSOR> ) +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== statements.if-block == +if ( <CURSOR> ) { +<SPLIT><-IF PART-> +} +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== statements.if-else == +if ( <CURSOR> ) +<SPLIT>else +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== statements.if-block-else == +if ( <CURSOR> ) { +<SPLIT><-IF PART-> +} +else { +<+ELSE PART+> +} +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== statements.else-block == +else { +<CURSOR><SPLIT> +} +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== statements.while == +while ( <CURSOR> ) +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== statements.while-block == +while ( <CURSOR> ) { +<SPLIT>} +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== statements.switch == +switch ( <CURSOR> ) { + case 1: + <SPLIT>break; + + case 2: + break; + + case 3: + break; + + case 4: + break; + + default: + break; +} // ----- end switch ----- +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== statements.case == +case <CURSOR>: +break; + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== statements.block == +{ +<CURSOR><SPLIT> +} +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |