Branch data Line data Source code
1 : : /****************************************************************************** 2 : : * Top contributors (to current version): 3 : : * Gereon Kremer, Kshitij Bansal, Tim King 4 : : * 5 : : * This file is part of the cvc5 project. 6 : : * 7 : : * Copyright (c) 2009-2024 by the authors listed in the file AUTHORS 8 : : * in the top-level source directory and their institutional affiliations. 9 : : * All rights reserved. See the file COPYING in the top-level source 10 : : * directory for licensing information. 11 : : * **************************************************************************** 12 : : * 13 : : * Did-you-mean style suggestions. 14 : : * 15 : : * ``What do you mean? I don't understand.'' An attempt to be more 16 : : * helpful than that. Similar to one in git. 17 : : * 18 : : * There are no dependencies on cvc5 (except namespace). 19 : : */ 20 : : 21 : : #pragma once 22 : : 23 : : #include <cvc5/cvc5_export.h> 24 : : 25 : : #include <string> 26 : : #include <vector> 27 : : 28 : : namespace cvc5::internal { 29 : : 30 : : class CVC5_EXPORT DidYouMean { 31 : : public: 32 : 823 : void addWord(const std::string& word) { d_words.emplace_back(word); } 33 : 24 : void addWords(const std::vector<std::string>& words) 34 : : { 35 : 24 : d_words.insert(d_words.end(), words.begin(), words.end()); 36 : 24 : } 37 : : 38 : : std::vector<std::string> getMatch(const std::string& input); 39 : : 40 : : /** 41 : : * This is provided to make it easier to ensure consistency of 42 : : * output. Returned string is empty if there are no matches. 43 : : */ 44 : : std::string getMatchAsString(const std::string& input); 45 : : 46 : : private: 47 : : std::vector<std::string> d_words; 48 : : }; 49 : : 50 : : } // namespace cvc5::internal