参考:https://www.jetbrains.com/help/clion/settings-file-and-code-templates.html
| Variable | Description |
|---|---|
| ${CALL_SUPER} | Base function call signature during the override generation |
| ${DATE} | Current system date |
| ${DAY} | Current day of the month |
| ${DEFAULT_RETURN_VALUE} | Default return value of the function |
| ${DIR_PATH} | Path to the directory of the new file (relative to the project root) |
| ${DS} | Dollar sign $. This variable is used to escape the dollar character, so that it is not treated as a prefix of a template variable. |
| ${FILE_NAME} | Name of the new C or C++ file |
| ${HEADER_COMMENTS} | Always returns true and is used for testing purposes |
| ${HEADER_FILENAME} | Name of the header file generated for a class or a source file |
| ${HOUR} | Current hour |
| ${INCLUDE_GUARD} | Prevents repeated include of a particular header file |
| ${MINUTE} | Current minute |
| ${SECOND} | Current second |
| ${MONTH} | Current month |
| ${MONTH_NAME_FULL} | Full name of the current month (January, February, and so on) |
| ${MONTH_NAME_SHORT} | First three letters of the current month name (Jan, Feb, and so on) |
| ${NAME} | Name of the new entity (file, %class%, interface, and so on) |
| ${NAMESPACE_CLOSE} | End of a namespace block created during refactoring |
| ${NAMESPACE_OPEN} | Beginning of a namespace block created during refactoring |
| ${PRODUCT_NAME} | Name of the IDE (for example, CLion) |
| ${PROJECT_NAME} | Name of the current project |
| ${RETURN_TYPE} | Type of the function’s return value (used for generating new functions) |
| ${SUIT_NAME} | Google test suite name |
| ${TEST_NAME} | Google test name |
| ${TIME} | Current system time |
| ${USER} | Login name of the current user (all platforms) |
| ${USER_NAME} | For Windows and Linux: login name of the current user For macOS: registered full name of the user |
| ${YEAR} | Current year |
/******************************************************************************
版权所有 (C), ${YEAR}-${YEAR},${USER_NAME}
******************************************************************************
文 件 名 : ${FILE_NAME}
版 本 号 : 初稿
作 者 : ${USER_NAME}
生成日期 : ${DATE}
最近修改 :
功能描述 :
函数列表 :
修改历史 :
1.日 期 : ${DATE}
作 者 : ${USER_NAME}
修改内容 : 创建文件
******************************************************************************/
/*----------------------------------------------*
* 包含头文件 *
*----------------------------------------------*/
/*----------------------------------------------*
* 外部变量说明 *
*----------------------------------------------*/
/*----------------------------------------------*
* 外部函数原型说明 *
*----------------------------------------------*/
/*----------------------------------------------*
* 内部函数原型说明 *
*----------------------------------------------*/
/*----------------------------------------------*
* 全局变量 *
*----------------------------------------------*/
/*----------------------------------------------*
* 模块级变量 *
*----------------------------------------------*/
/*----------------------------------------------*
* 常量定义 *
*----------------------------------------------*/
/*----------------------------------------------*
* 宏定义 *
*----------------------------------------------*/
/******************************************************************************
版权所有 (C), ${YEAR}-${YEAR}, ${USER_NAME}
******************************************************************************
文 件 名 : ${FILE_NAME}
版 本 号 : 初稿
作 者 : ${USER_NAME}
生成日期 : ${DATE}
最近修改 :
功能描述 :
函数列表 :
修改历史 :
1.日 期 : ${DATE}
作 者 : ${USER_NAME}
修改内容 : 创建文件
******************************************************************************/
#[[#ifndef]]# ${INCLUDE_GUARD}
#[[#define]]# ${INCLUDE_GUARD}
#[[#endif]]# //${INCLUDE_GUARD}

/*****************************************************************************
函 数 名 :
功能描述 :
输入参数 :
输出参数 : 无
返 回 值 :
调用函数 :
被调函数 :
修改历史 :
1.日 期 : $DATE$
作 者 : $USER$
修改内容 : 新生成函数
*****************************************************************************/



源文件:

头文件:

函数头:

添加修改:

其实我们还可以将这些模版开发成插件上传到插件市场(Java就可以开发),这些留给以后折腾吧,感兴趣的可以自行先研究一下。