Sort all includes in src/gromacs
[alexxy/gromacs.git] / src / gromacs / commandline / cmdlinehelpcontext.h
index 9e12f4a1d46769eb633b98102a97d5c44fc868fa..57aa7363c3275f9ab531844fcbd834eabea490c7 100644 (file)
@@ -1,10 +1,10 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2013, by the GROMACS development team, led by
- * David van der Spoel, Berk Hess, Erik Lindahl, and including many
- * others, as listed in the AUTHORS file in the top-level source
- * directory and at http://www.gromacs.org.
+ * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
+ * and including many others, as listed in the AUTHORS file in the
+ * top-level source directory and at http://www.gromacs.org.
  *
  * GROMACS is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
 #ifndef GMX_COMMANDLINE_CMDLINEHELPCONTEXT_H
 #define GMX_COMMANDLINE_CMDLINEHELPCONTEXT_H
 
-#include "../onlinehelp/helpwritercontext.h"
-#include "../utility/common.h"
+#include "gromacs/onlinehelp/helpwritercontext.h"
+#include "gromacs/utility/common.h"
 
 namespace gmx
 {
 
+class ShellCompletionWriter;
+
 /*! \libinternal \brief
  * Context information for writing out command-line help.
  *
@@ -57,17 +59,31 @@ namespace gmx
  * onlinehelp module is not exposed to extra features of the command-line help
  * export.
  *
+ * Copying a context works like with HelpWriterContext: the output file and
+ * most state is shared.  However, setModuleDisplayName() and setShowHidden()
+ * can be set independently for the child context.  Defaults for these options
+ * are inherited from the parent.
+ *
  * \ingroup module_commandline
  */
 class CommandLineHelpContext
 {
     public:
         /*! \brief
-         * Creates the context.
+         * Creates a context for help export.
          *
          * Wraps the constructor of HelpWriterContext.
          */
-        CommandLineHelpContext(File *file, HelpOutputFormat format);
+        CommandLineHelpContext(File *file, HelpOutputFormat format,
+                               const HelpLinks *links);
+        //! Creates a context for a particular HelpWriterContext.
+        explicit CommandLineHelpContext(const HelpWriterContext &writerContext);
+        /*! \brief
+         * Creates a context for shell completion.
+         */
+        explicit CommandLineHelpContext(ShellCompletionWriter *writer);
+        //! Creates a copy of the context.
+        explicit CommandLineHelpContext(const CommandLineHelpContext &other);
         ~CommandLineHelpContext();
 
         /*! \brief
@@ -76,14 +92,6 @@ class CommandLineHelpContext
          * \throws std::bad_alloc if out of memory.
          */
         void setModuleDisplayName(const std::string &name);
-        /*! \brief
-         * Sets the links to process in help output.
-         *
-         * A reference to \p links is stored until the CommandLineHelpContext
-         * is destructed.  The caller is responsible for ensuring that the
-         * links object remains valid long enough.
-         */
-        void setLinks(const HelpLinks &links);
         //! Sets whether hidden options should be shown in help output.
         void setShowHidden(bool bHidden);
 
@@ -97,11 +105,21 @@ class CommandLineHelpContext
         const char *moduleDisplayName() const;
         //! Returns whether hidden options should be shown in help output.
         bool showHidden() const;
+        //! Returns whether this context is for exporting shell completions.
+        bool isCompletionExport() const;
+        /*! \brief
+         * Returns the shell completion writer for this context.
+         *
+         * Can only be called if isCompletionExport() returns `true`.
+         */
+        ShellCompletionWriter &shellCompletionWriter() const;
 
     private:
         class Impl;
 
         PrivateImplPointer<Impl> impl_;
+
+        GMX_DISALLOW_ASSIGN(CommandLineHelpContext);
 };
 
 /*! \libinternal \brief