3 * This source code is part of
7 * GROningen MAchine for Chemical Simulations
9 * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
10 * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
11 * Copyright (c) 2001-2009, The GROMACS development team,
12 * check out http://www.gromacs.org for more information.
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version 2
17 * of the License, or (at your option) any later version.
19 * If you want to redistribute modifications, please consider that
20 * scientific software is very special. Version control is crucial -
21 * bugs must be traceable. We will be happy to consider code for
22 * inclusion in the official distribution, but derived work must not
23 * be called official GROMACS. Details are found in the README & COPYING
24 * files - if they are missing, get the official version at www.gromacs.org.
26 * To help us fund GROMACS development, we humbly ask that you cite
27 * the papers on the package - you can find them in the top README file.
29 * For more info, check our website at http://www.gromacs.org
33 * Declares gmx::HelpTopicInterface.
35 * \author Teemu Murtola <teemu.murtola@cbr.su.se>
37 * \ingroup module_onlinehelp
39 #ifndef GMX_ONLINEHELP_HELPTOPICINTERFACE_H
40 #define GMX_ONLINEHELP_HELPTOPICINTERFACE_H
42 #include "../utility/uniqueptr.h"
47 class HelpWriterContext;
50 * Provides a single online help topic.
53 * Implementations of these methods should not throw, except that writeHelp()
54 * is allowed to throw on out-of-memory or I/O errors since those it cannot
57 * Header helptopic.h contains classes that implement this interface and make
58 * it simple to write concrete help topic classes.
61 * This class is in a public header, and exposed through HelpTopicPointer, but
62 * it is not intended to be used outside the library. To access a help topic
63 * with public API methods, use HelpManager.
66 * \ingroup module_onlinehelp
68 class HelpTopicInterface
71 virtual ~HelpTopicInterface() {}
74 * Returns the name of the topic.
76 * This should be a single lowercase word, used to identify the topic.
77 * It is not used for the root of the help topic tree.
79 virtual const char *name() const = 0;
81 * Returns a title for the topic.
83 * May return NULL, in which case the topic is omitted from normal
84 * subtopic lists and no title is printed by the methods provided in
87 virtual const char *title() const = 0;
89 //! Returns whether the topic has any subtopics.
90 virtual bool hasSubTopics() const = 0;
92 * Finds a subtopic by name.
94 * \param[in] name Name of subtopic to find.
95 * \returns Pointer to the found subtopic, or NULL if matching topic
98 virtual const HelpTopicInterface *findSubTopic(const char *name) const = 0;
101 * Prints the help text for this topic.
103 * \param[in] context Context object for writing the help.
104 * \throws std::bad_alloc if out of memory.
105 * \throws FileIOError on any I/O error.
107 virtual void writeHelp(const HelpWriterContext &context) const = 0;
110 //! Smart pointer type to manage a HelpTopicInterface object.
111 typedef gmx_unique_ptr<HelpTopicInterface>::type HelpTopicPointer;