/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012, 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) 2012,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
#define GMX_OPTIONS_FILENAMEOPTIONSTORAGE_H
#include <string>
+#include <vector>
-#include "filenameoption.h"
-#include "optionfiletype.h"
-#include "optionstoragetemplate.h"
+#include "gromacs/options/filenameoption.h"
+#include "gromacs/options/optionfiletype.h"
+#include "gromacs/options/optionstoragetemplate.h"
namespace gmx
{
class FileNameOption;
+class FileNameOptionManager;
/*! \internal \brief
* Converts, validates, and stores file names.
class FileNameOptionStorage : public OptionStorageTemplate<std::string>
{
public:
- //! \copydoc StringOptionStorage::StringOptionStorage()
- explicit FileNameOptionStorage(const FileNameOption &settings);
+ /*! \brief
+ * Initializes the storage from option settings.
+ *
+ * \param[in] settings Storage settings.
+ * \param manager Manager for this object (can be NULL).
+ */
+ FileNameOptionStorage(const FileNameOption &settings,
+ FileNameOptionManager *manager);
virtual OptionInfo &optionInfo() { return info_; }
- virtual const char *typeString() const { return "file"; }
+ virtual std::string typeString() const;
+ virtual std::string formatExtraDescription() const;
virtual std::string formatSingleValue(const std::string &value) const;
//! \copydoc FileNameOptionInfo::isInputFile()
//! \copydoc FileNameOptionInfo::isLibraryFile()
bool isLibraryFile() const { return bLibrary_; }
+ //! \copydoc FileNameOptionInfo::isDirectoryOption()
+ bool isDirectoryOption() const;
+ //! \copydoc FileNameOptionInfo::isTrajectoryOption()
+ bool isTrajectoryOption() const;
+ //! \copydoc FileNameOptionInfo::defaultExtension()
+ const char *defaultExtension() const;
+ //! \copydoc FileNameOptionInfo::extensions()
+ std::vector<const char *> extensions() const;
+ //! \copydoc FileNameOptionInfo::isValidType()
+ bool isValidType(int fileType) const;
+ //! \copydoc FileNameOptionInfo::fileTypes()
+ ConstArrayRef<int> fileTypes() const;
+
private:
virtual void convertValue(const std::string &value);
+ virtual void processAll();
FileNameOptionInfo info_;
- OptionFileType filetype_;
+ FileNameOptionManager *manager_;
+ int fileType_;
+ const char *defaultExtension_;
bool bRead_;
bool bWrite_;
bool bLibrary_;