主要内容

发布帮助文本MATLAB接口到c++库

当您发布接口时,clibgen.generateLibraryDefinition> < /代码函数插入c++头文件注释和其他关于类和函数的默认文本。的医生> < /代码函数将此文本显示给用户。您可以通过编辑库定义文件来禁用插入c++注释或修改文本。< / p >

请注意

如果你已经装载了clib> < /代码例如,通过调用医生> < /代码或者调用类构造函数,则必须重新启动MATLAB®更改接口。< / p >

自动使用c++注释帮助文本

如果这些公共构造包含c++注释,那么MATLAB将这些注释附加到默认的MATLAB描述中。< / p >

  • 功能和参数< / p >

  • 成员函数和参数< / p >

  • 类和结构体< / p >

  • 数据成员< / p >

  • 枚举和enumerants< / p >

MATLAB读取Doxygen风格,c++注释,但不是一个Doxygen解析器。例如,MATLAB处理Doxygen@brief> < /代码和@details> < /代码将内容添加到类或函数描述中的命令。MATLAB读取@param> < /代码和@return> < /代码增加参数描述的命令。MATLAB使用的内容@code> < /代码命令提供代码示例。在任何Doxygen命令中,MATLAB都忽略格式化标记。例如,显示一个Doxygen解析器词> < /代码如这个标签所示< / b > < b >词> < /代码粗体字体。MATLAB简单地包括文本< / b > < b >词> < /代码的帮助。MATLAB不显示html标签<代码>> < /代码,> < /代码> < /代码,< p >> < /代码,< / p >> < /代码,< br >> < /代码.< / p >< p >默认情况下,MATLAB将库头文件和源文件中的c++注释复制到描述> < /代码如果可用,DetailedDescription> < /代码这些方法的参数。枚举可以有EnumerantDescriptions> < /代码参数。控件可以查看和编辑内容.mlx> < /代码库定义文件。< / p >

描述> < /代码,DetailedDescription> < /代码,EnumerantDescriptions> < /代码参数接受字符串值。你可以手动更新这些值中的文本.例如,可能有更多的内容. hpp> < /代码文件比MATLAB包括默认。或者您可能想为您的用例包含代码示例。< / p >< p >如果你不想从头文件和源文件中复制c++注释,那么调用clibgen.generateLibraryDefinition> < /代码与“GenerateDocumentationFromHeaderFiles”参数设置为假> < /代码.您仍然可以在描述> < /代码参数在定义文件中。< / p >

手动更新帮助文本

这个例子使用了内置的接口发布接口到头文件专用c++库.另一个例子,见修改库帮助.< / p >< p >如果您创建了接口,请移动到包含defineschool.mlx> < /代码文件和学校> < /代码带有接口库的文件夹。或者,创建接口:< / p >

拷贝文件(fullfile (matlabroot,“外来的”“例子”“cpp_interface”“school.hpp”),“。”“f”) clibgen.generateLibraryDefinition (“school.hpp”)构建(defineschool)目录“学校”)总结(defineschool)

类的默认帮助文本人> < /代码是表示c++类Person> < /代码.要显示帮助,输入:< / p >

医生clib.school
clib中包含的类。学校: Person - clib.school.Person Representation of C++ class Person Teacher - clib.school.Teacher Representation of C++ class Teacher Student - clib.school.Student Representation of C++ class Student

要修改此文本,请编辑defineschool.mlx> < /代码.搜索文本表示c++类Person> < /代码.< / p >< p >修改“描述”> < /代码价值。变化:< / p >

“clib.school。人表示c++类Person."

:< / p >

“clib.school。人Class defined by name and age."

保存文件。< / p >< p >要重建库,请重新启动MATLAB。导航到包含的文件夹defineschool.mlx> < /代码.删除已有的接口文件。< / p >

删除学校\ * . dll

构建接口并更新路径。< / p >

构建(defineschool)目录学校

显示更新后的帮助。< / p >

医生clib.school
clib中包含的类。学校: Person - clib.school.Person Class defined by name and age Teacher - clib.school.Teacher Representation of C++ class Teacher Student - clib.school.Student Representation of C++ class Student

用头文件注释比较生成的帮助

中描述的例子修改库帮助显示生成的帮助将XMLPlatformUtils。初始化> < /代码方法在Apache™xerces - c++ XML解析器库中。这些内容来自Apache Xerces项目,https://xerces.apache.org,并在Apache 2.0许可下获得许可,https://www.apache.org/licenses/LICENSE-2.0.< / p >< p >在MATLAB中使用c++注释PlatformUtils.hpp> < /代码文件。< / p >

/** @name Initialization and Panic方法*/ //@{/**执行每进程的解析器初始化**初始化必须在任何客户端代码中首先调用。* * @param locale用于消息的区域设置。* *如果是第一次调用Initialize(),则设置区域设置,*以确保进程空间中的每个消息加载程序共享*相同的区域设置。* *所有Initialize()的后续调用,使用不同的区域设置,对消息加载器没有影响,无论是实例化的还是待实例化的。* *要设置为不同的区域设置,客户端应用程序需要Terminate()(或*在多个Initialize()之前调用*的情况下,多个Terminate()),然后是Initialize(new_locale)。* *默认区域设置为“en_US”。* * @param nlhome用户指定的位置,MsgLoader检索错误消息文件。上面关于locale的讨论同样适用于nlhome。* * @param panicHandler应用程序的恐慌处理程序,应用程序拥有这个处理程序。*应用程序应通过调用XMLPlatformUtils::Terminate()确保插入的恐慌处理程序持续存在。 * * @param memoryManager Plugged-in memory manager which is owned by the * application. Applications must make sure that the * plugged-in memory manager persist through the call to * XMLPlatformUtils::Terminate() */ static void Initialize(const char* const locale = XMLUni::fgXercescDefaultLocale , const char* const nlsHome = 0 , PanicHandler* const panicHandler = 0 , MemoryManager* const memoryManager = 0);

在实例中构建了界面后,显示了MATLAB的帮助初始化> < /代码方法。< / p >

帮助clib.MyXercesLibrary.xercesc_3_1.XMLPlatformUtils.Initialize
clib.MyXercesLibrary.xercesc_3_1.XMLPlatformUtils.InitializeMethod of C++ class xercesc_3_1::XMLPlatformUtils. Perform per-process parser initialization This content is from the external library documentation. Initialization must be called first in any client code. Inputs locale read-only string locale The locale to use for messages. nlsHome read-only string nlsHome User specified location where MsgLoader retrieves error message files. the discussion above with regard to locale, applies to nlsHome as well. panicHandler clib.MyXercesLibrary.xercesc_3_1.PanicHandler panicHandler Application's panic handler, application owns this handler. Application shall make sure that the plugged panic handler persists through the call to XMLPlatformUtils::Terminate(). memoryManager clib.MyXercesLibrary.xercesc_3_1.MemoryManager memoryManager Plugged-in memory manager which is owned by the application. Applications must make sure that the plugged-in memory manager persist through the call to XMLPlatformUtils::Terminate() No outputs

另请参阅

|

相关的话题