C++ 什么';s是BOOST.LOG中的BOOST\u LOG\u DOXYGEN\u PASS吗?

C++ 什么';s是BOOST.LOG中的BOOST\u LOG\u DOXYGEN\u PASS吗?,c++,boost,C++,Boost,它说,Boost.Log库中有一些奇怪的代码,例如BoostFileLogging.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_I

它说,Boost.Log库中有一些奇怪的代码,例如BoostFileLogging.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
\ifndef增压\u日志\u氧气\u通过
#定义BOOST_LOG_INIT_LOG_到_FILE_INTERNAL(z,n,data)\
模板\
内联共享\u ptr>添加\u FILE\u LOG(BOOST\u PP\u ENUM\u BINARY\u参数(n、T、const和arg))\
{\
返回aux::添加文件\日志((\
aux::wrap_file_name(arg0,typename参数::aux::is_named_参数::type())\
BOOST_PP_逗号_IF(BOOST_PP_更大(n,1))\
BOOST_PP_ENUM_shift_参数(n,arg)\
));\
}
BOOST\u PP\u REPEAT\u FROM\u TO(1,BOOST\u LOG\u MAX\u参数参数,BOOST\u LOG\u INIT\u LOG\u TO\u FILE\u INTERNAL,~)
#undef BOOST_LOG_INIT_LOG_TO_FILE_INTERNAL
#else//BOOST\u LOG\u DOXYGEN\u PASS
/*!
*该函数初始化日志库以将日志写入文件流。
*
*\param参数包含许多命名参数。支持以下参数:
*\li\c file\u命名文件名或其模式。此参数是必需的。
*\li\c open\u mode描述文件打开模式的掩码。请参阅std::ios_base::openmode。
*\li\c rotation\u size应该进行旋转的文件的大小。请参阅基本\u文本\u文件\u后端。
*\li\c基于时间的\u旋转基于时间的文件旋转的谓词。请参阅基本\u文本\u文件\u后端。
*\li\c auto\u flush一个布尔标志,显示接收器是否应自动刷新文件
*每次书面记录之后。
*\li\c指向存储旋转文件的目标目录。请参阅接收器::文件::生成收集器。
*\li\c max\u size目标目录中旋转文件的最大总大小。请参阅接收器::文件::生成收集器。
*\li\c最小可用空间目标目录中的最小可用空间。请参阅接收器::文件::生成收集器。
*\li\c scan\u方法扫描目标目录中日志文件的方法。请参阅sinks::file::scan\u方法。
*\li\c筛选器指定要安装到接收器中的筛选器。可以是表示筛选器的字符串,
*或筛选器lambda表达式。
*\li\c format指定要安装到接收器中的格式化程序。可以是表示格式化程序的字符串,
*或格式化程序lambda表达式(流式或类似Boost.Format的表示法)。
*\返回指向构造接收器的指针。
*/
模板<类型名。。。ArgsT>
共享\u ptr>添加\u FILE\u LOG(ArgsT…const&args);
#endif//BOOST\u LOG\u DOXYGEN\u PASS

这个宏的动机是什么?我应该启用它还是禁用它?Doxygen是一个解析源代码并生成文档的程序

这样做的目的是让Doxygen看到(和文档)与真正的编译器看到的不同

在本例中,Doxygen将看到一个可变模板,因此HTML文档会这样说:

添加文件日志(ArgsT…const&args)

模板参数:

  • 模板<类型名。。。ArgsT>
返回类型:

shared_ptr< BOOST_LOG_FILE_SINK_FRONTEND_INTERNAL< sinks::text_file_backend > >
shared_ptr>
该函数初始化日志库以将日志写入文件流

。。。等等

但是Boost Log显然在不支持可变模板的编译器上工作,所以真正的编译器看不到这一点。编译器看到的是一堆非可变模板,大致如下(尽管它与解释BOOST\u LOG\u DOXYGEN\u PASS无关):

模板共享\u ptr添加文件\u日志(Arg1T const&arg1);
模板共享\u ptr添加\u文件\u日志(Arg1T const&arg1,Arg2T const&arg2);
模板共享\u ptr添加\u文件\u日志(Arg1T const&arg1、Arg2T const&arg2、Arg3T const&arg3);
//等等

您不需要为每一项都单独创建一个文档条目,这只会使文档变得杂乱无章。

看起来有助于使用doxygen生成文档。
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