Gromacs  2021.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Member Functions | Protected Member Functions
gmx::SimpleHelpTopic< HelpText > Class Template Reference

#include <gromacs/onlinehelp/helptopic.h>

+ Inheritance diagram for gmx::SimpleHelpTopic< HelpText >:
+ Collaboration diagram for gmx::SimpleHelpTopic< HelpText >:

Description

template<class HelpText>
class gmx::SimpleHelpTopic< HelpText >

Template for simple implementation of AbstractSimpleHelpTopic.

Template Parameters
HelpTextStruct that defines the data for the topic.

HelpText should have public static members "const char name[]", "const char title[]" and "const char *const text[]".

Typical use:

struct ExampleHelpText
{
static const char name[];
static const char title[];
static const char *const text[];
};
const char ExampleHelpText::name[] = "example";
const char ExampleHelpText::title[] =
"Example title";
const char *const ExampleHelpText::text[] = {
"Text for the topic.",
"More text for the topic."
};
typedef SimpleHelpTopic<ExampleHelpText> ExampleHelpTopic;
*

Public Member Functions

const char * name () const override
 Returns the name of the topic. More...
 
const char * title () const override
 Returns a title for the topic. More...
 
bool hasSubTopics () const override
 Returns whether the topic has any subtopics.
 
const IHelpTopicfindSubTopic (const char *name) const override
 Finds a subtopic by name. More...
 
void writeHelp (const HelpWriterContext &context) const override
 Prints the help text for this topic. More...
 

Protected Member Functions

std::string helpText () const override
 Returns the help text for this topic. More...
 

Member Function Documentation

const IHelpTopic * gmx::AbstractSimpleHelpTopic::findSubTopic ( const char *  name) const
overridevirtualinherited

Finds a subtopic by name.

Parameters
[in]nameName of subtopic to find.
Returns
Pointer to the found subtopic, or NULL if matching topic is not found.

Implements gmx::IHelpTopic.

template<class HelpText >
std::string gmx::SimpleHelpTopic< HelpText >::helpText ( ) const
inlineoverrideprotectedvirtual

Returns the help text for this topic.

writeHelp() calls this method to obtain the actual text to format for the topic. Markup substitution etc. is done automatically by writeHelp().

Implements gmx::AbstractSimpleHelpTopic.

template<class HelpText >
const char* gmx::SimpleHelpTopic< HelpText >::name ( ) const
inlineoverridevirtual

Returns the name of the topic.

This should be a single lowercase word, used to identify the topic. It is not used for the root of the help topic tree.

Implements gmx::AbstractSimpleHelpTopic.

template<class HelpText >
const char* gmx::SimpleHelpTopic< HelpText >::title ( ) const
inlineoverridevirtual

Returns a title for the topic.

May return NULL, in which case the topic is omitted from normal subtopic lists and no title is printed by the methods provided in helptopic.h.

Implements gmx::AbstractSimpleHelpTopic.

void gmx::AbstractSimpleHelpTopic::writeHelp ( const HelpWriterContext context) const
overridevirtualinherited

Prints the help text for this topic.

Parameters
[in]contextContext object for writing the help.
Exceptions
std::bad_allocif out of memory.
FileIOErroron any I/O error.

Implements gmx::IHelpTopic.


The documentation for this class was generated from the following file: