Boost.Log BOOST_LOG_DOXYGEN_PASS是什么?
What's is BOOST_LOG_DOXYGEN_PASS for in Boost.Log?
在Boost.Log库中有一些奇怪的代码,例如在boostfilellogging .cpp中,它说
#ifndef BOOST_LOG_DOXYGEN_PASS
#define BOOST_LOG_INIT_LOG_TO_FILE_INTERNAL(z, n, data)
template< BOOST_PP_ENUM_PARAMS(n, typename T) >
inline shared_ptr< BOOST_LOG_FILE_SINK_FRONTEND_INTERNAL< sinks::text_file_backend > > add_file_log(BOOST_PP_ENUM_BINARY_PARAMS(n, T, const& arg))
{
return aux::add_file_log((
aux::wrap_file_name(arg0, typename parameter::aux::is_named_argument< T0 >::type())
BOOST_PP_COMMA_IF(BOOST_PP_GREATER(n, 1))
BOOST_PP_ENUM_SHIFTED_PARAMS(n, arg)
));
}
BOOST_PP_REPEAT_FROM_TO(1, BOOST_LOG_MAX_PARAMETER_ARGS, BOOST_LOG_INIT_LOG_TO_FILE_INTERNAL, ~)
#undef BOOST_LOG_INIT_LOG_TO_FILE_INTERNAL
#else // BOOST_LOG_DOXYGEN_PASS
/*!
* The function initializes the logging library to write logs to a file stream.
*
* param args A number of named arguments. The following parameters are supported:
* li c file_name The file name or its pattern. This parameter is mandatory.
* li c open_mode The mask that describes the open mode for the file. See <tt>std::ios_base::openmode</tt>.
* li c rotation_size The size of the file at which rotation should occur. See <tt>basic_text_file_backend</tt>.
* li c time_based_rotation The predicate for time-based file rotations. See <tt>basic_text_file_backend</tt>.
* li c auto_flush A boolean flag that shows whether the sink should automatically flush the file
* after each written record.
* li c target The target directory to store rotated files in. See <tt>sinks::file::make_collector</tt>.
* li c max_size The maximum total size of rotated files in the target directory. See <tt>sinks::file::make_collector</tt>.
* li c min_free_space Minimum free space in the target directory. See <tt>sinks::file::make_collector</tt>.
* li c scan_method The method of scanning the target directory for log files. See <tt>sinks::file::scan_method</tt>.
* li c filter Specifies a filter to install into the sink. May be a string that represents a filter,
* or a filter lambda expression.
* li c format Specifies a formatter to install into the sink. May be a string that represents a formatter,
* or a formatter lambda expression (either streaming or Boost.Format-like notation).
* return Pointer to the constructed sink.
*/
template< typename... ArgsT >
shared_ptr< BOOST_LOG_FILE_SINK_FRONTEND_INTERNAL< sinks::text_file_backend > > add_file_log(ArgsT... const& args);
#endif // BOOST_LOG_DOXYGEN_PASS
这个宏的动机是什么?我应该启用还是禁用它?
oxygen是一个解析源代码和生成文档的程序。
这样做的目的是为了让氧看到(和记录)一些与真正的编译器看到的不同的东西。
在这种情况下,氧将看到一个可变模板,所以HTML文档会这样说:
add_file_log (ArgsT…const&args);
模板参数:
- template<typename……ArgsT>
返回类型:
shared_ptr< BOOST_LOG_FILE_SINK_FRONTEND_INTERNAL< sinks::text_file_backend > >
函数初始化日志库,将日志写入文件流。
…等等
但是Boost Log显然在不支持可变模板的编译器上工作,所以真正的编译器看不到这个。编译器看到的是一堆非可变的模板,沿着这些行(尽管它与解释BOOST_LOG_DOXYGEN_PASS无关):
template<typename Arg1T> shared_ptr</*snip*/> add_file_log(Arg1T const& arg1);
template<typename Arg1T, typename Arg2T> shared_ptr</*snip*/> add_file_log(Arg1T const& arg1, Arg2T const& arg2);
template<typename Arg1T, typename Arg2T, typename Arg3T> shared_ptr</*snip*/> add_file_log(Arg1T const& arg1, Arg2T const& arg2, Arg3T const& arg3);
// and so on
您不希望每个条目都有单独的文档条目,这会使文档变得混乱。
相关文章:
- 为不同配置设置MSVC_RUNTIME_LIBRARY的正确方法是什么
- C++避免重复声明的语法是什么
- 在C++中,将大的无符号浮点数四舍五入为整数的最佳方法是什么
- 实现无开销push_back的最佳方法是什么
- C++从另一个类访问公共静态向量的正确方法是什么
- "throw expression code" 1e7 >返回 d 是什么?投掷标准::overflow_error( "too big" ) : d;意味 着?
- C++中名称篡改的目的是什么
- 在 c++ 中拥有一组结构的正确方法是什么?
- 这个指针和内存代码打印是什么?我不知道是打印垃圾还是如何打印我需要的值
- 是什么阻止DOMTimerCoordinator::NextID进入无休止的循环
- 派生类销毁的最佳实践是什么
- 这个语法std::class<>{}(arg1, arg2) 在C++中是什么意思?
- 通过JNI传递数据数组的最快方法是什么
- "using namespace std;"在C++的作用是什么?
- 在两台机器之间进行时间戳的最佳c++chrono函数是什么
- 文件系统:复制功能的速度秘诀是什么
- 用常见虚拟函数实现的任意组合来实现派生类的正确方法是什么
- 使用QQuickFramebufferObject时同步数据的最佳方式是什么
- 是什么原因导致它无法编译?它是声明签名还是在函数本身的实现中
- 使用不同的CRT将新的C++代码与旧的(二进制)组件隔离开来的最佳方法是什么