]> git.rmz.io Git - dotfiles.git/blobdiff - vim/ultisnips/cpp.snippets
vim/cpp: add noexcept qualifier to rule5 move ctr/opr
[dotfiles.git] / vim / ultisnips / cpp.snippets
index a92c41abd13505477cdebf1971cd87ee761a85aa..1d44b8c92f5e8ad44546d221fb9a64a5fbdf7449 100644 (file)
@@ -2,7 +2,9 @@
 priority 1
 
 # disable horrible one word snippets
-clearsnippets pri pro pub fr mu
+clearsnippets pri pro pub fr mu t pr
+
+clearsnippets set
 
 snippet inc "#include <>" b
 #include <${1:iostream}>
@@ -16,7 +18,7 @@ snippet cl "class .. (class)" b
 class ${1:`!p snip.rv = snip.basename or "name"`}
 {
 public:
-       ${1/(\w+).*/$1/}(${2:arguments}) = default;
+       ${1/(\w+).*/$1/}(${2}) = default;
        virtual ~${1/(\w+).*/$1/}() = default;
 
 private:
@@ -27,16 +29,16 @@ endsnippet
 snippet rule5 "Default constructors/destructors/operaters" b
 ${1:classname}() = default;
 ~$1() = default;
-$1(const $1 &) = default;
-$1($1 &&) = default;
-$1 &operator=(const $1 &) = default;
-$1 &operator=($1 &&) = default;
+$1($1 const &) = default;
+$1($1 &&) noexcept = default;
+$1 &operator=($1 const &) = default;
+$1 &operator=($1 &&) noexcept = default;
 endsnippet
 
 snippet ns "namespace .. (namespace)"
-namespace${1/.+/ /m}${1:`!p snip.rv = snip.basename or "name"`} {
+namespace${1/.+/ /m}${1} {
 ${VISUAL}${0}
-}${1/.+/ \/\/ namespace $0/m}
+}  // namespace${1/.+/ $0/m}
 endsnippet
 
 snippet mfun "Member Function" b
@@ -46,8 +48,9 @@ ${4:void} ${1:`!p snip.rv = snip.basename or "name"`}::${2:memberFunction}(${3})
 }
 endsnippet
 
-snippet for "for loop (for)"
-for (${4:int} ${2:i} = 0; $2 < ${1:count}; ${3:++$2})
+clearsnippets for
+snippet fori "for loop (for)" b
+for (${4:size_t} ${2:i} = 0; $2 < ${1:count}; ${3:++$2})
 {
        ${VISUAL}${0}
 }
@@ -145,3 +148,26 @@ snippet once "#pragma once" b
 
 ${0}
 endsnippet
+
+snippet ostream "operator<<(ostream)" b
+inline std::ostream & operator<<(std::ostream &os, ${1:Type} const & rhs)
+{
+       os << ${0};
+       return os;
+}
+endsnippet
+
+snippet pragma-ignore "ignore diagnostics"
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-W${1}"
+${VISUAL}${0}
+#pragma GCC diagnostic pop
+endsnippet
+
+snippet FPP "FPP Copyright" b
+// Copyright © Focal Point Positioning Limited `!v strftime("%Y")`. All Rights Reserved.
+// This code is the copyright of Focal Point Positioning Limited and
+// cannot be used, copied or distributed without the express written
+// permission of Focal Point Positioning Limited.
+${0}
+endsnippet