常见编程软件注释 @brief @param @return

本文介绍了Qt开发中代码注释的规范,包括`@brief`、`@param`、`@return`等关键字段的使用,以及如何利用Qt的自动补全功能提高编码效率。此外,还提到了一些注意事项,如注释开头需为`/**`,`@`和`*`之间需有空格,并避免在注释中使用中文输入法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

/**
 * @brief  @param  @return @author @date @version是代码书写的一种规范
 * @brief  :简介,简单介绍函数作用
 * @param  :介绍函数参数
 * @return:函数返回类型说明
 * @exception NSException 可能抛出的异常.
 * @author zhangsan:  作者
 * @date 2011-07-27 22:30:00 :时间
 * @version 1.0 :版本  
 * @property :属性介绍
 * */

在上述注释中,输入注释后就会高亮。

在qt中有自带的会弹出注释,在输入@后这样你就可以选择了,有个小技巧,就是第二行开头输入一个星号*,回车后的其他行的星号* Qt是会自动补充的。

qt中有自带注释根据实测需注意一些几点,不同版本不同系统可能会有不同,欢迎留言补充:

(1)开头是/** 有两个星号不然无法自动弹出注释

(2)@和星号(*)之间需要一个空格不然无法自动弹出注释,

(3)@和星号*不能用中文输入法不然也无法自动弹出注释。


还可添加自己的注释字段

例如:

    /**
     * @brief Create new QToolButton
     *
     * @param name Name of button
     * @param action iconPath Path to button icon.
     * @return QToolButton Created QToolButton.
     */
    QToolButton* createToolButton(QAction *action);



 

给下列程序添加英文注释:namespace nav_core { /** * @class BaseGlobalPlanner * @brief Provides an interface for global planners used in navigation. All global planners written as plugins for the navigation stack must adhere to this interface. / class BaseGlobalPlanner{ public: /* * @brief Given a goal pose in the world, compute a plan * @param start The start pose * @param goal The goal pose * @param plan The plan... filled by the planner * @return True if a valid plan was found, false otherwise / virtual bool makePlan(const geometry_msgs::PoseStamped& start, const geometry_msgs::PoseStamped& goal, std::vector<geometry_msgs::PoseStamped>& plan) = 0; /* * @brief Given a goal pose in the world, compute a plan * @param start The start pose * @param goal The goal pose * @param plan The plan... filled by the planner * @param cost The plans calculated cost * @return True if a valid plan was found, false otherwise / virtual bool makePlan(const geometry_msgs::PoseStamped& start, const geometry_msgs::PoseStamped& goal, std::vector<geometry_msgs::PoseStamped>& plan, double& cost) { cost = 0; return makePlan(start, goal, plan); } /* * @brief Initialization function for the BaseGlobalPlanner * @param name The name of this planner * @param costmap_ros A pointer to the ROS wrapper of the costmap to use for planning / virtual void initialize(std::string name, costmap_2d::Costmap2DROS costmap_ros) = 0; /** * @brief Virtual destructor for the interface */ virtual ~BaseGlobalPlanner(){} protected: BaseGlobalPlanner(){} }; }; // namespace nav_core #endif // NAV_CORE_BASE_GLOBAL_PLANNER_H
06-12
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值