diff options
Diffstat (limited to 'c++-mode')
64 files changed, 427 insertions, 0 deletions
diff --git a/c++-mode/.yas-parents b/c++-mode/.yas-parents new file mode 100644 index 0000000..ce9828b --- /dev/null +++ b/c++-mode/.yas-parents @@ -0,0 +1 @@ +cc-mode diff --git a/c++-mode/assert b/c++-mode/assert new file mode 100644 index 0000000..f8f6a49 --- /dev/null +++ b/c++-mode/assert @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: assert +# key: ass +# -- +assert($0);
\ No newline at end of file diff --git a/c++-mode/beginend b/c++-mode/beginend new file mode 100644 index 0000000..51748ae --- /dev/null +++ b/c++-mode/beginend @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name : v.begin(), v.end() +# key: beginend +# -- +${1:v}.begin(), $1.end
\ No newline at end of file diff --git a/c++-mode/boost_require b/c++-mode/boost_require new file mode 100644 index 0000000..804bb3f --- /dev/null +++ b/c++-mode/boost_require @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: boost_require +# key: req +# group: boost +# -- +BOOST_REQUIRE( ${1:condition} ); +$0
\ No newline at end of file diff --git a/c++-mode/cerr b/c++-mode/cerr new file mode 100644 index 0000000..2be4917 --- /dev/null +++ b/c++-mode/cerr @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: cerr +# key: err +# -- +cerr << $0; diff --git a/c++-mode/cin b/c++-mode/cin new file mode 100644 index 0000000..401ccda --- /dev/null +++ b/c++-mode/cin @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: cin +# key: cin +# -- +cin >> $0;
\ No newline at end of file diff --git a/c++-mode/class b/c++-mode/class new file mode 100644 index 0000000..18d0b54 --- /dev/null +++ b/c++-mode/class @@ -0,0 +1,11 @@ +# -*- mode: snippet -*- +# name: class +# key: cls +# -- +class ${1:Name} +{ +public: + ${1:$(yas/substr yas-text "[^: ]*")}(); + ${2:virtual ~${1:$(yas/substr yas-text "[^: ]*")}();} +}; +$0
\ No newline at end of file diff --git a/c++-mode/const_[] b/c++-mode/const_[] new file mode 100644 index 0000000..ef92ffb --- /dev/null +++ b/c++-mode/const_[] @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: const_[] +# key: c[ +# -- +const ${1:Type}& operator[](${2:int index}) const +{ + $0 +}
\ No newline at end of file diff --git a/c++-mode/constructor b/c++-mode/constructor new file mode 100644 index 0000000..95ed499 --- /dev/null +++ b/c++-mode/constructor @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: constructor +# key: ct +# -- +${1:Class}::$1(${2:args}) ${3: : ${4:init}} +{ + $0 +}
\ No newline at end of file diff --git a/c++-mode/cout b/c++-mode/cout new file mode 100644 index 0000000..a1a151b --- /dev/null +++ b/c++-mode/cout @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# contributor: York Zhao <gtdplatform@gmail.com> +# name: cout +# key: cout +# -- +`(progn (save-excursion) (goto-char (point-min)) (unless (re-search-forward +"^using\\s-+namespace std;" nil 'no-errer) "std::")) +`cout << $0${1: << '${2:\n}'};
\ No newline at end of file diff --git a/c++-mode/cpp b/c++-mode/cpp new file mode 100644 index 0000000..99ea53c --- /dev/null +++ b/c++-mode/cpp @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: cpp +# key: cpp +# -- +#include "`(file-name-nondirectory (file-name-sans-extension (buffer-file-name)))`.h"
\ No newline at end of file diff --git a/c++-mode/cstd b/c++-mode/cstd new file mode 100644 index 0000000..6148875 --- /dev/null +++ b/c++-mode/cstd @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: cstd +# key: cstd +# -- +#include <cstdlib>
\ No newline at end of file diff --git a/c++-mode/d+= b/c++-mode/d+= new file mode 100644 index 0000000..b3bf110 --- /dev/null +++ b/c++-mode/d+= @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: d+= +# key: d+= +# -- +${1:MyClass}& operator+=(${2:const $1 &});
\ No newline at end of file diff --git a/c++-mode/d_operator b/c++-mode/d_operator new file mode 100644 index 0000000..c7f40fc --- /dev/null +++ b/c++-mode/d_operator @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: d_operator<< +# key: << +# -- +friend std::ostream& operator<<(std::ostream&, const ${1:Class}&);
\ No newline at end of file diff --git a/c++-mode/d_operator[] b/c++-mode/d_operator[] new file mode 100644 index 0000000..d0555f7 --- /dev/null +++ b/c++-mode/d_operator[] @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: d_operator[] +# key: [ +# -- +${1:Type}& operator[](${2:int index});
\ No newline at end of file diff --git a/c++-mode/d_operator[]_const b/c++-mode/d_operator[]_const new file mode 100644 index 0000000..b4c1f8f --- /dev/null +++ b/c++-mode/d_operator[]_const @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: d_operator[]_const +# key: c[ +# -- +const ${1:Type}& operator[](${2:int index}) const;
\ No newline at end of file diff --git a/c++-mode/d_operator_istream b/c++-mode/d_operator_istream new file mode 100644 index 0000000..36f88e0 --- /dev/null +++ b/c++-mode/d_operator_istream @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: d_operator>> +# key: >> +# -- +friend std::istream& operator>>(std::istream&, const ${1:Class}&);
\ No newline at end of file diff --git a/c++-mode/d_operator_ostream b/c++-mode/d_operator_ostream new file mode 100644 index 0000000..c7f40fc --- /dev/null +++ b/c++-mode/d_operator_ostream @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: d_operator<< +# key: << +# -- +friend std::ostream& operator<<(std::ostream&, const ${1:Class}&);
\ No newline at end of file diff --git a/c++-mode/delete b/c++-mode/delete new file mode 100644 index 0000000..61119d1 --- /dev/null +++ b/c++-mode/delete @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: delete +# key: dl +# -- +delete ${1:pointer};
\ No newline at end of file diff --git a/c++-mode/delete[] b/c++-mode/delete[] new file mode 100644 index 0000000..69223c2 --- /dev/null +++ b/c++-mode/delete[] @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: delete[] +# key: dla +# -- +delete[] ${1:arr};
\ No newline at end of file diff --git a/c++-mode/doc b/c++-mode/doc new file mode 100644 index 0000000..b58550a --- /dev/null +++ b/c++-mode/doc @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: doc +# key: doc +# -- +/** + * $0 + */
\ No newline at end of file diff --git a/c++-mode/dynamic_casting b/c++-mode/dynamic_casting new file mode 100644 index 0000000..f09c171 --- /dev/null +++ b/c++-mode/dynamic_casting @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: dynamic_casting +# key: cast +# -- +check_and_cast<${1:Type} *>(${2:msg});
\ No newline at end of file diff --git a/c++-mode/enum b/c++-mode/enum new file mode 100644 index 0000000..7b22035 --- /dev/null +++ b/c++-mode/enum @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: enum +# key: enum +# -- +enum ${1:NAME}{ +$0 +};
\ No newline at end of file diff --git a/c++-mode/fixture b/c++-mode/fixture new file mode 100644 index 0000000..1a25aee --- /dev/null +++ b/c++-mode/fixture @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: fixture +# key: fixt +# -- +BOOST_FIXTURE_TEST_SUITE( ${1:name}, ${2:Fixture} ) + +$0 + +BOOST_AUTO_TEST_SUITE_END()
\ No newline at end of file diff --git a/c++-mode/fori b/c++-mode/fori new file mode 100644 index 0000000..7676a89 --- /dev/null +++ b/c++-mode/fori @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: fori +# key: fori +# -- +for (${1:auto }${2:it} = ${3:var}.begin(); $2 != $3.end(); ++$2) { + $0 +}
\ No newline at end of file diff --git a/c++-mode/friend b/c++-mode/friend new file mode 100644 index 0000000..d3c9009 --- /dev/null +++ b/c++-mode/friend @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: friend +# key: fr +# -- +friend $0;
\ No newline at end of file diff --git a/c++-mode/fun_declaration b/c++-mode/fun_declaration new file mode 100644 index 0000000..03184dc --- /dev/null +++ b/c++-mode/fun_declaration @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: fun_declaration +# key: f +# -- +${1:type} ${2:name}(${3:args})${4: const};
\ No newline at end of file diff --git a/c++-mode/function b/c++-mode/function new file mode 100644 index 0000000..c947c34 --- /dev/null +++ b/c++-mode/function @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: function +# key: f +# -- +${1:type} ${2:Class}::${3:name}(${4:args})${5: const} +{ + $0 +}
\ No newline at end of file diff --git a/c++-mode/gtest b/c++-mode/gtest new file mode 100644 index 0000000..8ba9c57 --- /dev/null +++ b/c++-mode/gtest @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: gtest +# key: gtest +# group: testing +# -- +#include <gtest/gtest.h>
\ No newline at end of file diff --git a/c++-mode/ignore b/c++-mode/ignore new file mode 100644 index 0000000..ac4085d --- /dev/null +++ b/c++-mode/ignore @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: ignore +# key: ignore +# -- +${1:std::}cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
\ No newline at end of file diff --git a/c++-mode/inline b/c++-mode/inline new file mode 100644 index 0000000..da5c320 --- /dev/null +++ b/c++-mode/inline @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: inline +# key: il +# -- +inline $0
\ No newline at end of file diff --git a/c++-mode/io b/c++-mode/io new file mode 100644 index 0000000..1355dac --- /dev/null +++ b/c++-mode/io @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: io +# key: io +# -- +#include <iostream>
\ No newline at end of file diff --git a/c++-mode/iterator b/c++-mode/iterator new file mode 100644 index 0000000..1aad629 --- /dev/null +++ b/c++-mode/iterator @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: iterator +# key: iter +# -- +${1:std::}${2:vector<int>}::iterator ${3:iter}; diff --git a/c++-mode/map b/c++-mode/map new file mode 100644 index 0000000..17ed9ae --- /dev/null +++ b/c++-mode/map @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: map +# key: map +# -- +std::map<${1:type1}$0> ${2:var};
\ No newline at end of file diff --git a/c++-mode/module b/c++-mode/module new file mode 100644 index 0000000..b962be4 --- /dev/null +++ b/c++-mode/module @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: module +# key: mod +# -- +class ${1:Class} : public cSimpleModule +{ + $0 +}
\ No newline at end of file diff --git a/c++-mode/namespace b/c++-mode/namespace new file mode 100644 index 0000000..5f702d8 --- /dev/null +++ b/c++-mode/namespace @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: namespace +# key: ns +# -- +namespace ${1:Namespace} { + + `yas/selected-text` + +} // $1
\ No newline at end of file diff --git a/c++-mode/ns b/c++-mode/ns new file mode 100644 index 0000000..0b736e7 --- /dev/null +++ b/c++-mode/ns @@ -0,0 +1,4 @@ +#name : namespace ... +# key: ns +# -- +namespace
\ No newline at end of file diff --git a/c++-mode/operator!= b/c++-mode/operator!= new file mode 100644 index 0000000..0b9c3c3 --- /dev/null +++ b/c++-mode/operator!= @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: operator!= +# key: != +# group: operator overloading +# -- +bool ${1:MyClass}::operator!=(const $1 &other) const +{ + return !(*this == other); +}
\ No newline at end of file diff --git a/c++-mode/operator+ b/c++-mode/operator+ new file mode 100644 index 0000000..cc1d9aa --- /dev/null +++ b/c++-mode/operator+ @@ -0,0 +1,11 @@ +# -*- mode: snippet -*- +# name: operator+ +# key: + +# group: operator overloading +# -- +${1:MyClass} $1::operator+(const $1 &other) +{ + $1 result = *this; + result += other; + return result; +}
\ No newline at end of file diff --git a/c++-mode/operator+= b/c++-mode/operator+= new file mode 100644 index 0000000..e913631 --- /dev/null +++ b/c++-mode/operator+= @@ -0,0 +1,10 @@ +# -*- mode: snippet -*- +# name: operator+= +# key: += +# group: operator overloading +# -- +${1:MyClass}& $1::operator+=(${2:const $1 &rhs}) +{ + $0 + return *this; +}
\ No newline at end of file diff --git a/c++-mode/operator= b/c++-mode/operator= new file mode 100644 index 0000000..272af5d --- /dev/null +++ b/c++-mode/operator= @@ -0,0 +1,14 @@ +# -*- mode: snippet -*- +# name: operator= +# key: = +# where this is a reference to myself +# group: operator overloading +# -- +${1:MyClass}& $1::operator=(const $1 &rhs) +{ + // Check for self-assignment! + if (this == &rhs) + return *this; + $0 + return *this; +}
\ No newline at end of file diff --git a/c++-mode/operator== b/c++-mode/operator== new file mode 100644 index 0000000..f8fb3e9 --- /dev/null +++ b/c++-mode/operator== @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: operator== +# key: == +# group: operator overloading +# -- +bool ${1:MyClass}::operator==(const $1 &other) const +{ + $0 +}
\ No newline at end of file diff --git a/c++-mode/operator[] b/c++-mode/operator[] new file mode 100644 index 0000000..5fb110b --- /dev/null +++ b/c++-mode/operator[] @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: operator[] +# key: [] +# group: operator overloading +# -- +${1:Type}& operator[](${2:int index}) +{ + $0 +}
\ No newline at end of file diff --git a/c++-mode/operator_istream b/c++-mode/operator_istream new file mode 100644 index 0000000..e2296ab --- /dev/null +++ b/c++-mode/operator_istream @@ -0,0 +1,10 @@ +# -*- mode: snippet -*- +# name: operator>> +# key: >> +# group: operator overloading +# -- +std::istream& operator>>(std::istream& is, const ${1:Class}& ${2:c}) +{ + $0 + return is; +}
\ No newline at end of file diff --git a/c++-mode/operator_ostream b/c++-mode/operator_ostream new file mode 100644 index 0000000..cd77eb4 --- /dev/null +++ b/c++-mode/operator_ostream @@ -0,0 +1,10 @@ +# -*- mode: snippet -*- +# name: operator<< +# key: << +# group: operator overloading +# -- +std::ostream& operator<<(std::ostream& os, const ${1:Class}& ${2:c}) +{ + $0 + return os; +}
\ No newline at end of file diff --git a/c++-mode/ostream b/c++-mode/ostream new file mode 100644 index 0000000..9371338 --- /dev/null +++ b/c++-mode/ostream @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: ostream +# key: os +# -- +#include <ostream>
\ No newline at end of file diff --git a/c++-mode/pack b/c++-mode/pack new file mode 100644 index 0000000..5172bb9 --- /dev/null +++ b/c++-mode/pack @@ -0,0 +1,10 @@ +# -*- mode: snippet -*- +# name: pack +# key: pack +# -- +void cNetCommBuffer::pack(${1:type}) +{ + +} + +$0
\ No newline at end of file diff --git a/c++-mode/private b/c++-mode/private new file mode 100644 index 0000000..849d7ee --- /dev/null +++ b/c++-mode/private @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: private +# key: pr +# -- +private: + $0
\ No newline at end of file diff --git a/c++-mode/protected b/c++-mode/protected new file mode 100644 index 0000000..a4f6d59 --- /dev/null +++ b/c++-mode/protected @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: protected +# key: pt +# -- +protected: + $0
\ No newline at end of file diff --git a/c++-mode/public b/c++-mode/public new file mode 100644 index 0000000..638ddfd --- /dev/null +++ b/c++-mode/public @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: public +# key: pb +# -- +public: + $0
\ No newline at end of file diff --git a/c++-mode/sstream b/c++-mode/sstream new file mode 100644 index 0000000..738fd11 --- /dev/null +++ b/c++-mode/sstream @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: <sstream> +# key: ss +# -- +#include <sstream>
\ No newline at end of file diff --git a/c++-mode/std b/c++-mode/std new file mode 100644 index 0000000..04d8772 --- /dev/null +++ b/c++-mode/std @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: std +# key: std +# -- +using namespace std;
\ No newline at end of file diff --git a/c++-mode/std_colon b/c++-mode/std_colon new file mode 100644 index 0000000..d9ea8e7 --- /dev/null +++ b/c++-mode/std_colon @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: std:: +# key: st +# -- +std::$0
\ No newline at end of file diff --git a/c++-mode/str b/c++-mode/str new file mode 100644 index 0000000..95b865c --- /dev/null +++ b/c++-mode/str @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: str +# key: str +# -- +#include <string>
\ No newline at end of file diff --git a/c++-mode/template b/c++-mode/template new file mode 100644 index 0000000..64814b8 --- /dev/null +++ b/c++-mode/template @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: template +# key: temp +# -- +template<${1:$$(yas/choose-value '("typename" "class"))} ${2:T}> +$0
\ No newline at end of file diff --git a/c++-mode/test case b/c++-mode/test case new file mode 100644 index 0000000..4977ae8 --- /dev/null +++ b/c++-mode/test case @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: test case +# key: tc +# group: testing +# -- +BOOST_AUTO_TEST_CASE( ${1:test_case} ) +{ + $0 +}
\ No newline at end of file diff --git a/c++-mode/test_main b/c++-mode/test_main new file mode 100644 index 0000000..9321cf3 --- /dev/null +++ b/c++-mode/test_main @@ -0,0 +1,10 @@ +# -*- mode: snippet -*- +# name: test_main +# key: test_main +# group: testing +# -- +int main(int argc, char **argv) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +}
\ No newline at end of file diff --git a/c++-mode/test_suite b/c++-mode/test_suite new file mode 100644 index 0000000..84d0f46 --- /dev/null +++ b/c++-mode/test_suite @@ -0,0 +1,10 @@ +# -*- mode: snippet -*- +# name: test_suite +# key: ts +# group: testing +# -- +BOOST_AUTO_TEST_SUITE( ${1:test_suite1} ) + +$0 + +BOOST_AUTO_TEST_SUITE_END()
\ No newline at end of file diff --git a/c++-mode/this b/c++-mode/this new file mode 100644 index 0000000..5c7e6a3 --- /dev/null +++ b/c++-mode/this @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: this +# key: th +# -- +this
\ No newline at end of file diff --git a/c++-mode/throw b/c++-mode/throw new file mode 100644 index 0000000..95616db --- /dev/null +++ b/c++-mode/throw @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: throw +# key: throw +# -- +throw ${1:MyError}($0);
\ No newline at end of file diff --git a/c++-mode/try b/c++-mode/try new file mode 100644 index 0000000..f44c67f --- /dev/null +++ b/c++-mode/try @@ -0,0 +1,10 @@ +# -*- mode: snippet -*- +# name: try +# key: try +# a bit too intrusive now still, not always I want to do this +# -- +try { + $0 +} catch (${1:type}) { + +} diff --git a/c++-mode/tryw b/c++-mode/tryw new file mode 100644 index 0000000..cf61928 --- /dev/null +++ b/c++-mode/tryw @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: tryw +# key: tryw +# -- +try { + `(or yas/selected-text (car kill-ring))` +} catch ${1:Exception} { + +} diff --git a/c++-mode/using b/c++-mode/using new file mode 100644 index 0000000..27ec885 --- /dev/null +++ b/c++-mode/using @@ -0,0 +1,5 @@ +#name : using namespace ... +# key: using +# -- +using namespace ${std}; +$0
\ No newline at end of file diff --git a/c++-mode/vector b/c++-mode/vector new file mode 100644 index 0000000..ef118a2 --- /dev/null +++ b/c++-mode/vector @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: vector +# key: vec +# -- +std::vector<${1:Class}> ${2:var}${3:(${4:10}, $1($5))};
\ No newline at end of file |