From 0bf28391b00b1e28c44324bcd7647df416314667 Mon Sep 17 00:00:00 2001 From: bnewbold Date: Thu, 25 Mar 2010 06:29:54 -0400 Subject: lots and lots of vim stuff for c development... --- .vim/c-support/templates/c.cpp.template | 487 ++++++++++++++++++++++++++++++++ 1 file changed, 487 insertions(+) create mode 100644 .vim/c-support/templates/c.cpp.template (limited to '.vim/c-support/templates/c.cpp.template') 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 >> ; +$ +== cpp.cout == +cout << << endl; +$ +== cpp.cout-operator == insert == +<< "" +$ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.output-manipulator-boolalpha == insert == +<< boolalpha +== cpp.output-manipulator-dec == insert == +<< dec +== cpp.output-manipulator-endl == insert == +<< endl +== cpp.output-manipulator-fixed == insert == +<< fixed +== cpp.output-manipulator-flush == insert == +<< flush +== cpp.output-manipulator-hex == insert == +<< hex +== cpp.output-manipulator-internal == insert == +<< internal +== cpp.output-manipulator-left == insert == +<< left +== cpp.output-manipulator-oct == insert == +<< oct +== cpp.output-manipulator-right == insert == +<< right +== cpp.output-manipulator-scientific == insert == +<< scientific +== cpp.output-manipulator-setbase == insert == +<< setbase(10) +== cpp.output-manipulator-setfill == insert == +<< setfill() +== cpp.output-manipulator-setiosflag == insert == +<< setiosflags() +== cpp.output-manipulator-setprecision == insert == +<< setprecision(6) +== cpp.output-manipulator-setw == insert == +<< setw(0) +== cpp.output-manipulator-showbase == insert == +<< showbase +== cpp.output-manipulator-showpoint == insert == +<< showpoint +== cpp.output-manipulator-showpos == insert == +<< showpos +== cpp.output-manipulator-uppercase == insert == +<< uppercase +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.method-implementation == +void +|?CLASSNAME|::|?METHODNAME| ( <+argument list+> ) +{ + return ; +} /* ----- end of method |CLASSNAME|::|?METHODNAME| ----- */ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.accessor-implementation == +/* + *----------------------------------------------------------------------------- + * Class: |?CLASSNAME| + * Method: get_|?ATTRIBUTE| + *----------------------------------------------------------------------------- + */ +inline int +|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: + * ============================================================================ + */ +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| () +{ +} /* ----- end of method |CLASSNAME|::|CLASSNAME| (constructor) ----- */ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.class-using-new-definition == +/* + * ============================================================================ + * Class: |?CLASSNAME:c| + * Description: + * ============================================================================ + */ +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| () +{ +} /* ----- 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: + * ============================================================================ + */ +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 |?CLASSNAME|::|?METHODNAME| ( <+argument list+> ) +{ + return ; +} /* ----- end of method |CLASSNAME|::|METHODNAME| ----- */ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.template-accessor-implementation == +/* + *----------------------------------------------------------------------------- + * Class: |?CLASSNAME| + * Method: get_|?ATTRIBUTE| + *----------------------------------------------------------------------------- + */ +template < class T > +inline int |CLASSNAME|::get_|ATTRIBUTE| ( ) +{ + return |ATTRIBUTE|; +} /* ----- end of method |CLASSNAME|::get_|ATTRIBUTE| ----- */ + +/* + *----------------------------------------------------------------------------- + * Class: |CLASSNAME| + * Method: set_|ATTRIBUTE| + *----------------------------------------------------------------------------- + */ +template < class T > +inline void |CLASSNAME|::set_|ATTRIBUTE| ( <+argument list+> ) +{ + |ATTRIBUTE| = value; + return ; +} /* ----- end of method |CLASSNAME|::set_|ATTRIBUTE| ----- */ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.template-class-definition == +/* + * ============================================================================ + * Class: |?CLASSNAME:c| + * Description: + * ============================================================================ + */ +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| () +{ +} /* ---------- end of constructor of template class |CLASSNAME| ---------- */ + + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.template-class-using-new-definition == +/* + * ============================================================================ + * Class: |?CLASSNAME:c| + * Description: + * ============================================================================ + */ + +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| () +{ +} /* ---------- 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 +void |?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. ; + return os; +} /* ----- end of function operator << ----- */ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.operator-out == +istream & +operator >> ( istream & is, |?CLASSNAME| & obj ) +{ + is >> obj. ; + return is; +} /* ----- end of function operator >> ----- */ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.try-catch == +try { +} +catch ( const &ExceptObj ) { /* handle exception: */ +} +catch (...) { /* handle exception: unspecified */ +} + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.catch == +catch ( const &ExceptObj ) { /* handle exception: */ +} +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.catch-points == +catch (...) { /* handle exception: */ +} +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.extern == +extern "C" { +} +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.open-input-file == +char *ifs_file_name = ""; /* 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); +} +{-continue here-} +ifs.close (); /* close ifstream */ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.open-output-file == +char *ofs_file_name = ""; /* 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); +} +{-continue here-} +ofs.close (); /* close ofstream */ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.namespace-std == +using namespace std; +== cpp.namespace == +using namespace |?NAMESPACE|; +== cpp.namespace-block == +namespace |?NAMESPACE| { +} /* ----- end of namespace |NAMESPACE| ----- */ +== cpp.namespace-alias == +namespace |?NAMESPACE_ALIAS| = {-original namespace name-}; +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.rtti-typeid == insert == +typeid() +$ +== cpp.rtti-static-cast == insert == +static_cast<>() +$ +== cpp.rtti-const-cast == insert == +const_cast<>() +$ +== cpp.rtti-reinterpret-cast == insert == +reinterpret_cast<>() +$ +== cpp.rtti-dynamic-cast == insert == +dynamic_cast<>() +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -- cgit v1.2.3