码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • doxygen c++ 语法


    doxygen c++ 语法

      • c++基本语法模板
      • 1 文件头部信息
      • 2 class
      • 2 变量
      • 3 函数
      • 4 重载
      • 5 结构体
      • 6 枚举
      • 7 宏

    c++基本语法模板

    以 /*! 开头, */ 结尾

    /*!
       \关键字1
       \关键字2
    */
    
    • 1
    • 2
    • 3
    • 4

    1 文件头部信息

    /*! \file ClassA.h
     *  \brief     文件说明 定义了类fatherA
     *  \details   This class is used to demonstrate a number of section commands.
     *  \author    John Doe
     *  \author    Jan Doe
     *  \version   4.1a
     *  \date      2023-2199
     *  \pre       First initialize the system.
     *  \bug       Not all memory is freed when deleting an object of this class.
     *  \warning   Improper use can crash your application
     *  \copyright GNU Public License.
     */
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12

    2 class

    /*! \class Test classA.h "inc/classA.h"
        \brief fatherA类
        Some details about the Test class.
     */
    
    • 1
    • 2
    • 3
    • 4

    2 变量

    /*! \var int errno
        \brief Contains the last error code.
        \warning Not thread safe!
    */
    
    • 1
    • 2
    • 3
    • 4

    3 函数

    例子1

    /*! \fn int read(int fd,char *buf,size_t count)
        \brief Read bytes from a file descriptor.
        \param fd The descriptor to read from.
        \param buf The buffer to read into.
        \param count The number of bytes to read.
    */
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    例子2

    /*! \fn void Overload_Test::drawRect(int x,int y,int w,int h)
     * This command draws a rectangle with a left upper corner at ( \a x , \a y ),
     * width \a w and height \a h. 
     */
    
    • 1
    • 2
    • 3
    • 4

    在这里插入图片描述
    例子3

    class Fn_Test
    {
      public:
        const char *member(char,int) throw(std::out_of_range);
    };
    
    const char *Fn_Test::member(char c,int n) throw(std::out_of_range) {}
    
    /*! \class Fn_Test
     * \brief Fn_Test class.
     *
     * Details about Fn_Test.
     */
    
    /*! \fn const char *Fn_Test::member(char c,int n) 
     *  \brief A member function.
     *  \param c a character.
     *  \param n an integer.
     *  \exception std::out_of_range parameter is out of range.
     *  \return a character pointer.
     */
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21

    在这里插入图片描述

    4 重载

    /*!
     * \overload void Overload_Test::drawRect(const Rect &r)
     */
    
    • 1
    • 2
    • 3

    5 结构体

    /*! \struct CoordStruct
     * A coordinate pair.
     */
    struct CoordStruct
    {
      /*! The x coordinate */
      float x;
      /*! The y coordinate */
      float y;
    };
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11

    在这里插入图片描述

    6 枚举

    class Enum_Test
    {
      public:
        enum TEnum { Val1, Val2 };
    
        /*! Another enum, with inline docs */
        enum AnotherEnum 
        { 
          V1, /*!< value 1 */
          V2  /*!< value 2 */
        };
    };
    
    /*! \class Enum_Test
     * The class description.
     */
    
    /*! \enum Enum_Test::TEnum
     * A description of the enum type.
     */
    
    /*! \var Enum_Test::TEnum Enum_Test::Val1
     * The description of the first enum value.
     */
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24

    在这里插入图片描述

    7 宏

    /*! 
       \brief Computes the absolute value of its argument \a x.
       \param x input value.
       \returns absolute value of \a x.
    */
    #define ABS(x) (((x)>0)?(x):-(x))
    
    /*!
      \def MAX(x,y)
      Computes the maximum of \a x and \a y.
    */
    #define MAX(x,y) ((x)>(y)?(x):(y))
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12

    在这里插入图片描述
    还有其他关键字,就不一一列举了:
    手册里面有详细说明,并有例子
    在这里插入图片描述
    下载文档:
    操作手册

  • 相关阅读:
    TeamTalk中msg_server初始化工作,如何维护与其他服务器的心跳连接
    static应用知识:单例设计模式
    springSecurity基础(二)连接数据库的登录
    纽约时报夏季读写竞赛复盘
    微信小程序-WXS脚本
    Redis基本命令和常用数据类型
    情人节程序员用HTML网页表白【春娇-志明结婚邀请函】 HTML5七夕情人节表白网页源码 HTML+CSS+JavaScript
    Spring Cloud 配置中心多环境配置bootstrap.yml
    墙裂推荐:GitHub 上这个开源项目可以让你在短短几分钟之内了解一门技术
    Linux操作系统入门(适用java软件开发)
  • 原文地址:https://blog.csdn.net/jiangliuhuan123/article/details/133175851
  • 最新文章
  • 攻防演习之三天拿下官网站群
    数据安全治理学习——前期安全规划和安全管理体系建设
    企业安全 | 企业内一次钓鱼演练准备过程
    内网渗透测试 | Kerberos协议及其部分攻击手法
    0day的产生 | 不懂代码的"代码审计"
    安装scrcpy-client模块av模块异常,环境问题解决方案
    leetcode hot100【LeetCode 279. 完全平方数】java实现
    OpenWrt下安装Mosquitto
    AnatoMask论文汇总
    【AI日记】24.11.01 LangChain、openai api和github copilot
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1
正则表达式工具 cron表达式工具 密码生成工具

京公网安备 11010502049817号