Comment file

  1 /// This is the head comment of a file.
  2
  3 /*************************************************************************
  4 *\CopyRight:  2015.9.21-NOW,Feel free to use and modify those codes. And
  5 any modifications or copies shall remain these sentence for the purpose
  6 of further development and code sharing.
  7 *\Module/Sys: [M]/[S]Test
  8 *\Version:    1.0.0.0
  9 *\Description:Use for the describ of the functions of the file.
 10 *\Author:     CityForNaive
 11 *\Date:       2015.9.21
 12 *\History:    <Date>                <Dev>                <Behavior>
 13 *\            2015.9.21             CityForNaive         Build.
 14 *************************************************************************/
 15
 16 #pragma once /// Use this as first option.
 17
 18 #ifndef _COMMENT_H_
 19 #define _COMMENT_H_
 20 #endif // _COMMENT_H_
 21
 22 /// Comments of the definations as follow.
 23
 24 #define _TEST_SUCCEED            1 /** Test succeed. */
 25 #define _TEST_PARTIAL_SUCCEED    2 /** Test partial succeed. */
 26 #define _TEST_FAILED            0 /** Test failed. */
 27
 28 /// This is the description of a class or a struct.
 29
 30 /**
 31 *\Description:Use for the test functions.
 32 *\Methods:    1.SetTester : Set the basic param of the test
 33               2.GetTester : Get the result of a test.
 34 *\Other:      This is a C based class.
 35 */
 36 class TestClass
 37     : public TestBaseClass
 38 {
 39 public:
 40     TestClass( void );
 41     virtual ~TestClass( void );
 42
 43 public:
 44     /**
 45     *\Description:Set function for the test class.
 46     *\Input:      1.const int& param1, the first param of the func.
 47                   2.const int& param2, the second param of the func.
 48     *\Output:     None.
 49     *\Return:     const int : _TEST_SUCCEED, succeed
 50                               _TEST_PARTIAL_SUCCEED, partial succeed
 51                               _TEST_FAILED, failed.
 52     *\Other:      None.
 53     */
 54     const int SetTester( const int& param1, const int& param2 );
 55
 56     /**
 57     *\Description:Get the result of a test.
 58     *\Input:      1.const int& token1, the first token of the func.
 59                   2.const int& token2, the second token of the func.
 60     *\Output:     1.int& result, the result of the test.
 61     *\Return:     const int : _TEST_SUCCEED, succeed
 62                               _TEST_PARTIAL_SUCCEED, partial succeed
 63                               _TEST_FAILED, failed.
 64     *\Other:      None.
 65     */
 66     const int GetTester( const int& token1, const int& token2,
 67         int& result );
 68
 69 private:
 70     int m_iParamFrst;    /// The first param of the test.
 71     int m_iParamScnd;    /// The second param of the test.
 72 }; // TestClass
 73
 74 /// The comments in detailed code lines.
 75
 76 /// I intended that the implementation of a method shall be in another file.
 77
 78 /** Set function for the test class. */
 79 int TestClass::SetTester( const int& param1, const int& param2 )
 80 {
 81     int rtnVal; // The return value of this function
 82     rtnVal = _TEST_FAILED;
 83
 84     // Set the param of the test
 85     if ( param1 >= 0 && param2 >= 0 )
 86     {
 87         rtnVal = _TEST_SUCCEED;
 88     }
 89     else if ( param1 >= 0 || param2 >= 0 )
 90     {
 91         rtnVal = _TEST_PARTIAL_SUCCEED;
 92     }
 93     else
 94     {
 95         rtnVal = _TEST_FAILED;
 96     }
 97
 98     m_iParamFrst = param1;
 99     m_iParamScnd = param2;
100
101     return rtnVal;
102 }
103
104 /** Get the result of a test. */
105 int TestClass::GetTester( const int& token1, const int& token2, int& result )
106 {
107     int rtnVal; // The return value of this function
108     rtnVal = _TEST_FAILED;
109
110     // Judge the token to decide the result
111     if ( token1 == m_iParamFrst && token2 == m_iParamScnd )
112     {
113         result = m_iParamFrst * m_iParamScnd;
114         rtnVal = _TEST_SUCCEED;
115     }
116     else if ( token1 == m_iParamFrst || token2 == m_iParamScnd )
117     {
118         result = m_iParamFrst / m_iParamScnd;
119         rtnVal = _TEST_PARTIAL_SUCCEED;
120     }
121     else
122     {
123         result = 0;
124         rtnVal = _TEST_FAILED;
125     }
126
127     return rtnVal;
128 }
129
130 /// For interface that we just write the brief of the function.
131
132 class __declspec( novtable ) ITestInterface
133 {
134 public:
135     /** This is a function of the interface. */
136     virtual void func( const int& param, const char* charParam ) = 0;
137 };
138
139 /// here we can also use EXTERN_C instead of extern "C" if under VS.
140 extern "C" __declspec( dllexport ) ITestInterface* getTestInterface();

以上是换了一家公司之后,根据公司内部的 code rule 自己整理的自己以后进行编码的参考格式(当然,现在这家并不是做什么开源项目的:3>)

时间: 2024-08-04 14:36:03

Comment file的相关文章

SaltStack源码分析之file状态模块

file模块用于对普通文件,目录,特殊文件和链接文件进行各种操作 /usr/lib/python2.6/site-packages/salt/states/file.py def managed(name,             source=None,             source_hash='',             user=None,             group=None,             mode=None,             template=No

SaltStack 常用模块介绍 - service - pkg - file

salt '*' sys.state_doc service salt-minion: ---------- service: Starting or restarting of services and daemons ============================================== Services are defined as system daemons typically started with system init or rc scripts, ser

Saltstack安装nginx+haproxy

@font-face {  font-family: "Times New Roman";}@font-face {  font-family: "宋体";}@font-face {  font-family: "Calibri";}p.MsoNormal { margin: 0 0 0; text-align: justify; font-family: Calibri; font-size: 14px; }span.msoIns { text

saltstack学习笔记7-States

States是saltstack中的配置语言,日常进行配置管理时需要编写大量的states文件.比如安装一个包,然后管理一个配置文件,最后保证某个服务正常运行. 编写一些states sls文件(描述状态配置的文件)去描述和实现我们的功能.编写states sls文件都是YAML语法.当然states sls文件也支持使用Python语言,其实编写states sls文件并不难,官方提供大量的示例,我们只需要记住编写格式,然后根据自己的实际需求去编写适合自己业务的states sls文件 查看所

JS高级程序设置笔记(六)

22.1.2 作用域安全的构造函数 作用域安全的构造函数在进行任何更改前,首先确认this 对象是正确类型的实例.如果不是,那 么会创建新的实例并返回. 多个程序员在同一个页面上写JavaScript 代码的环境中,作用域安全构造函数就很有用了.届时, 对全局对象意外的更改可能会导致一些常常难以追踪的错误.除非你单纯基于构造函数窃取来实现继 承,推荐作用域安全的构造函数作为最佳实践. 22.1.3 惰性载入函数 惰性载入表示函数执行的分支仅会发生一次.有两种实现惰性载入的方式,第一种就是在函数被

How to Write Doc Comments for the Javadoc Tool

http://www.oracle.com/technetwork/java/javase/documentation/index-137868.html This document describes the style guide, tag and image conventions we use in documentation comments for Java programs written at Java Software, Oracle. It does not rehash r

salt实现lamp自动化部署

三个文件夹: pkg 安装软件包 file  管理配置文件 service   服务管理 思路: lamp需要安装的软件包有  httpd, php, mysql, mysql-server, php-mysql, php-pdo cd  /srv/salt/dev/ mkdir   /srv/salt/dev/files/      ##放配置文件 vim  /srv/salt/dev/lamp.sls lamp配置文件如下: lamp-pkg-install: pkg.installed:

saltstack批量安装zabbix agent

1.准备zabbix agent的配置文件 由于没有啥特别要求,这里我选择yum安装zabbix22-agent [[email protected] init]# yum -y install zabbix22-agent [[email protected] zabbix]# cp zabbix_agentd.conf /etc/salt/states/init/files/ 2.创建zabbix_agent.sls [[email protected] ~]# vim /etc/salt/

saltstack之yum简单部署lnmp

今天使用salt简单部署lnmp 部署环境: node23.com 192.168.0.23 master/minion 部署nginx和phpnode24.com 192.168.0.24 minion 部署mysql 首先看一下结构目录: # tree . ├── dev │ ├── files │ │ ├── httpd.conf │ │ └── my.cnf │ └── lamp.sls ├── mysql │ ├── my.cnf │ └── mysql_installed.sls ├