//![0]表示在Qt c++中的示例代码
What does //! [0] mean in Qt C++ example code?
我刚刚打开了一个Qt服务器示例源代码。下面是其中一个文件:http://code.qt.io/cgit/qt/qtbase.git/tree/examples/network/fortuneserver/server.cpp
有像//! [0]
这样的注释。下面是一个例子:
//! [3]
connect(tcpServer, &QTcpServer::newConnection, this, &Server::sendFortune);
//! [3]
我以前从未见过他们。它们是什么意思?
它在Qt中用于从源代码生成web文档。通常,无论您在哪里找到//! [NUMBER]
,您都可以在web文档中看到这段代码。此外,它位于代码的末尾,因此文档生成器工具可以知道代码的哪一部分去了哪里。
当然,//!
标记可以在源代码中找到,但不能在生成的文档中找到。否则,文档将变得不可读。
他们为什么要用这个?它以//
开头(这意味着它是一个注释,所以编译器会忽略它),并且他们为生成器工具添加了一个"!
",因此它可以将代码注释从文档信息中分离出来。
//![1] This line will be generated into the documentation explaining the following function
void somethingDifficult()
{
//This would be a normal comment, so not exported to documentation
}
//![1] Here we mark the end of the export to the documentation
我看不见//!但是//声明该行其余部分为注释
相关文章:
- C++我的数学有什么问题,为什么我的代码不能正确循环
- 代码在main()中运行,但在函数中出现错误
- 在VS代码中交叉编译Windows与Linux上的MinGW的SDL程序
- 编译包含字符串的代码时遇到问题
- 我在c++代码中生成了一个运行时#3异常
- 如何在linux终端中同时编译和运行c++代码
- 为cl.exe(Visual Studio代码)指定命令行C++版本
- 在Linux for Windows上编译C++代码时出错
- 我的字符计数代码计算错误.为什么
- 孤立代码块在结构中引发异常
- 在编译C++代码(具有dlib和opencv)到WASM时面临问题
- 为什么我的C#代码在调用回C++COM直到Task时会暂停.等待/线程.加入
- 处理小于cpu数据总线的数据类型.(c++转换为机器代码)
- 此代码是否违反一个定义规则
- 为什么我的代码在输出中增加了93天
- 我的简单if-else语句是如何无法访问的代码
- 使用动态分配的数组会导致代码分析发出虚假的C6386缓冲区溢出警告
- 为什么在这个代码结束循环中没有得到结束
- 在c代码之间共享数据的最佳方式
- 这个指针和内存代码打印是什么?我不知道是打印垃圾还是如何打印我需要的值