286 lines
4.8 KiB
JSON
286 lines
4.8 KiB
JSON
{
|
|
"for": {
|
|
"prefix": "for",
|
|
"body": [
|
|
"for (${size_t} ${i} = ${1:0}; ${i} < ${2:length}; ${i}++)",
|
|
"{",
|
|
" $3",
|
|
"}"
|
|
],
|
|
"description": "Code snippet for 'for' loop"
|
|
},
|
|
"forr": {
|
|
"prefix": "forr",
|
|
"body": [
|
|
"for (int ${i} = ${1:length} - 1; ${i} >= ${2:0}; ${i}--)",
|
|
"{",
|
|
" $3",
|
|
"}"
|
|
],
|
|
"description": "Code snippet for reverse 'for' loop"
|
|
},
|
|
"do": {
|
|
"prefix": "do",
|
|
"body": [
|
|
"do",
|
|
"{",
|
|
" $1",
|
|
"} while($2);"
|
|
],
|
|
"description": "Code snippet for do...while loop"
|
|
},
|
|
"while": {
|
|
"prefix": "while",
|
|
"body": [
|
|
"while ($1)",
|
|
"{",
|
|
" $2",
|
|
"}"
|
|
],
|
|
"description": ""
|
|
},
|
|
"foreach": {
|
|
"prefix": "foreach",
|
|
"body": [
|
|
"for(auto ${var} : ${collection_to_loop})",
|
|
"{",
|
|
" $1",
|
|
"}"
|
|
],
|
|
"description": "Code snippet for range-based for loop (c++11) statement"
|
|
},
|
|
"if": {
|
|
"prefix": "if",
|
|
"body": [
|
|
"if ($1)",
|
|
"{",
|
|
" $2",
|
|
"}"
|
|
],
|
|
"description": "Code snippet for if statement"
|
|
},
|
|
"else": {
|
|
"prefix": "else",
|
|
"body": [
|
|
"else",
|
|
"{",
|
|
" $1",
|
|
"}"
|
|
],
|
|
"description": "Code snippet for else statement"
|
|
},
|
|
"else if": {
|
|
"prefix": "else if",
|
|
"body": [
|
|
"else if ($1)",
|
|
"{",
|
|
" $2",
|
|
"}"
|
|
],
|
|
"description": "Code snippet for else-if statement"
|
|
},
|
|
"enum": {
|
|
"prefix": "enum",
|
|
"body": [
|
|
"enum ${MyEnum}",
|
|
"{",
|
|
" $1",
|
|
"};"
|
|
],
|
|
"description": "Code snippet for enum"
|
|
},
|
|
"enum class": {
|
|
"prefix": "enum class",
|
|
"body": [
|
|
"enum class ${MyClass} { };"
|
|
],
|
|
"description": "Code snippet for enum class (c++11)"
|
|
},
|
|
"class": {
|
|
"prefix": "class",
|
|
"body": [
|
|
"class ${MyClass}",
|
|
"{",
|
|
"public:",
|
|
" ${MyClass}();",
|
|
" ${MyClass}(${MyClass} &&) = default;",
|
|
" ${MyClass}(const ${MyClass} &) = default;",
|
|
" ${MyClass} &operator=(${MyClass} &&) = default;",
|
|
" ${MyClass} &operator=(const ${MyClass} &) = default;",
|
|
" ~${MyClass}();",
|
|
"",
|
|
"private:",
|
|
" $1",
|
|
"};",
|
|
"",
|
|
"${MyClass}::${MyClass}()",
|
|
"{",
|
|
"}",
|
|
"",
|
|
"${MyClass}::~${MyClass}()",
|
|
"{",
|
|
"}"
|
|
],
|
|
"description": "Code snippet for class"
|
|
},
|
|
"classi": {
|
|
"prefix": "classi",
|
|
"body": [
|
|
"class ${MyClass}",
|
|
"{",
|
|
"public:",
|
|
" ${MyClass}() = default;",
|
|
" ${MyClass}(${MyClass} &&) = default;",
|
|
" ${MyClass}(const ${MyClass} &) = default;",
|
|
" ${MyClass} &operator=(${MyClass} &&) = default;",
|
|
" ${MyClass} &operator=(const ${MyClass} &) = default;",
|
|
" ~${MyClass}() = default;",
|
|
"",
|
|
"private:",
|
|
" $1",
|
|
"};"
|
|
],
|
|
"description": "Code snippet for class with inline constructor/destructor"
|
|
},
|
|
"interface": {
|
|
"prefix": "interface",
|
|
"body": [
|
|
"__interface I${Interface}",
|
|
"{",
|
|
" $1",
|
|
"};"
|
|
],
|
|
"description": "Code snippet for interface (Visual C++)"
|
|
},
|
|
"namespace": {
|
|
"prefix": "namespace",
|
|
"body": [
|
|
"namespace ${MyNamespace}",
|
|
"{",
|
|
" $1",
|
|
"}"
|
|
]
|
|
},
|
|
"#ifdef": {
|
|
"prefix": "#ifdef",
|
|
"body": [
|
|
"#ifdef ${DEBUG}",
|
|
"$1",
|
|
"#endif // ${DEBUG}"
|
|
],
|
|
"description": "Code snippet for #ifdef"
|
|
},
|
|
"#ifndef": {
|
|
"prefix": "#ifndef",
|
|
"body": [
|
|
"#ifndef ${1:1}",
|
|
"$2",
|
|
"#endif // !$1"
|
|
],
|
|
"description": "Code snippet for #ifndef"
|
|
},
|
|
"#if": {
|
|
"prefix": "#if",
|
|
"body": [
|
|
"#ifdef ${1:0}",
|
|
"$2",
|
|
"#endif // $1"
|
|
],
|
|
"description": "Code snippet for #if"
|
|
},
|
|
"struct": {
|
|
"prefix": "struct",
|
|
"body": [
|
|
"struct ${MyStruct}",
|
|
"{",
|
|
" $1",
|
|
"};"
|
|
],
|
|
"description": "Code snippet for struct"
|
|
},
|
|
"switch": {
|
|
"prefix": "switch",
|
|
"body": [
|
|
"switch (${switch_on})",
|
|
"{",
|
|
"default:",
|
|
" break;$1",
|
|
"}"
|
|
],
|
|
"description": "Code snippet for switch statement"
|
|
},
|
|
"try": {
|
|
"prefix": "try",
|
|
"body": [
|
|
"try",
|
|
"{",
|
|
" ",
|
|
"}",
|
|
"catch (const std::exception&)",
|
|
"{",
|
|
" $1",
|
|
"}"
|
|
],
|
|
"description": "Code snippet for try catch"
|
|
},
|
|
"union": {
|
|
"prefix": "union",
|
|
"body": [
|
|
"union ${MyUnion}",
|
|
"{",
|
|
" $1",
|
|
"};"
|
|
],
|
|
"description": "Code snippet for union"
|
|
},
|
|
"cout": {
|
|
"prefix": "cout",
|
|
"body": [
|
|
"std::cout << \"${1:/* message */}\" << std::endl;"
|
|
],
|
|
"description": "Code snippet for printing to std::cout, provided the header is set"
|
|
},
|
|
"#inc": {
|
|
"prefix": "#inc",
|
|
"body": [
|
|
"#include \"$1\""
|
|
],
|
|
"description": "Code snippet for #include \" \""
|
|
},
|
|
"#inc<": {
|
|
"prefix": "#inc<",
|
|
"body": [
|
|
"#include <$1>"
|
|
],
|
|
"description": "Code snippet for #include \" \""
|
|
},
|
|
"#def": {
|
|
"prefix": "#def",
|
|
"body": [
|
|
"#define \"$1\" \"$2\" "
|
|
],
|
|
"description": "Code snippet for #define \" \""
|
|
},
|
|
"main": {
|
|
"prefix": "main",
|
|
"body": [
|
|
"int main(int argc, const char** argv) {",
|
|
" return 0;",
|
|
"}"
|
|
],
|
|
"description": "Code snippet for 'for' loop"
|
|
},
|
|
"hpp": {
|
|
"prefix": "hpp",
|
|
"body": [
|
|
"#ifndef ${1:${TM_FILENAME/(.*)/${1:/upcase}/}}",
|
|
"#define $1",
|
|
"",
|
|
"$2",
|
|
"",
|
|
"#endif",
|
|
""
|
|
],
|
|
"description": "Headr file ifndef"
|
|
}
|
|
} |