文件头注释
开源项目:
/*** @file robot_base.cpp* @author Mr.Wu* @date 2025-05-28* @version 1.0.0* @brief Robot basic drive to communicate with controller** @copyright Copyright (c) 2025 google.** Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at** http://www.apache.org/licenses/LICENSE-2.0** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.* See the License for the specific language governing permissions and* limitations under the License.*/
不开源项目
没有许可证:
/*** @file robot_base.cpp* @author Mr.Wu* @date 2025-05-28* @version 1.0.0* @brief Robot basic drive to communicate with controller** @copyright Copyright (c) 2025 google.*/
有许可证:
/*** @file robot_base.cpp* @author Mr.Wu* @date 2025-05-28* @version 1.0.0* @brief Robot basic drive to communicate with controller** @copyright Copyright (c) 2025 google.** 许可证说明*/
(c)的作用
(c)
是 版权符号 © 的文本表示形式。
-
Doxygen 会自动将
(c)
转换为标准版权符号©
在生成的文档(如 HTML/PDF)中显示。 -
示例:
输入@copyright (c) 2025 google
→ 输出© 2025 google
。
copyright---版权
copyright的作用:
1. 核心作用
用途 | 说明 |
---|---|
法律声明 | 明确代码的版权归属方(个人、公司或组织),避免所有权纠纷。 |
许可证关联 | 与项目中的 LICENSE 文件配合,声明代码的使用条款(如开源协议)。 |
文档生成 | Doxygen 会将 @copyright 内容提取到生成的文档中(如 HTML/PDF 的页脚)。 |
代码溯源 | 帮助后续开发者了解代码的来源和修改历史。 |
公共许可证
Apache License 2.0
Apache License 2.0(Apache 2.0 许可证)是一种 宽松的开源软件许可证,由 Apache 软件基金会(ASF)制定,广泛用于允许商业使用、修改和分发的开源项目。
所以对于公司项目,不可使用这个许可证。
在 Doxygen 的文件头注释中,指令(如 @file
、@brief
等)的先后顺序没有严格的技术限制,但为了代码的可读性和一致性,建议遵循一定的逻辑顺序。以下是 Google C++ 风格和常见实践中的推荐顺序:
/*** @file <文件名> // 文件标识(通常放最前)* @author <作者> // 作者信息* @date <日期> // 创建/修改日期* @version <版本号> // 版本控制* @brief <简要描述> // 核心功能摘要* * @details <详细描述> // 可选:扩展说明* @copyright <版权信息> // 版权声明(通常放最后)*/
对象注释
函数注释
教程
doxygen