// $Id: Completer.hh 5770 2006-10-12 11:09:22Z m9710797 $ #ifndef COMPLETER_HH #define COMPLETER_HH #include "noncopyable.hh" #include #include #include namespace openmsx { class FileContext; class InterpreterOutput; class Completer : private noncopyable { public: const std::string& getName() const; /** Print help for this command. */ virtual std::string help(const std::vector& tokens) const = 0; /** Attempt tab completion for this command. * @param tokens Tokenized command line; * tokens[0] is the command itself. * The last token is incomplete, this method tries to complete it. */ virtual void tabCompletion(std::vector& tokens) const = 0; static void completeString(std::vector& tokens, std::set& set, bool caseSensitive = true); static void completeFileName(std::vector& tokens, const FileContext& context); static void completeFileName(std::vector& tokens, const FileContext& context, const std::set& extra); // should only be called by CommandConsole static void setOutput(InterpreterOutput* output); protected: Completer(const std::string& name); virtual ~Completer(); private: static bool completeString2(std::string &str, std::set& st, bool caseSensitive); const std::string name; static InterpreterOutput* output; }; } // namespace openmsx #endif