/* * Copyright (C) 2017-2021, Kevin Brubeck Unhammer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #pragma once #ifndef b28736af078229c6_CHECKER_H #define b28736af078229c6_CHECKER_H #ifdef HAVE_CONFIG_H # include #endif #include #include #include #include #include #include #include #include #include #include "checkertypes.hpp" namespace divvun { /** * Public types and functions for divvun-gramcheck library */ class PipeSpec; class ArPipeSpec; class Checker; class CheckerSpec { public: explicit CheckerSpec(const std::string& file); ~CheckerSpec(); bool hasPipe(const std::string& pipename) const; const std::string defaultPipe() const; const std::set pipeNames() const; std::unique_ptr getChecker(const std::string& pipename, bool verbose); private: const std::unique_ptr pImpl; }; class ArCheckerSpec { public: explicit ArCheckerSpec(const std::string& file); ~ArCheckerSpec(); bool hasPipe(const std::string& pipename) const; const std::string defaultPipe() const; const std::set pipeNames() const; std::unique_ptr getChecker(const std::string& pipename, bool verbose); private: const std::unique_ptr pImpl; }; class Pipeline; class Checker { public: Checker(const std::unique_ptr& spec, const std::string& pipename, bool verbose); Checker(const std::unique_ptr& spec, const std::string& pipename, bool verbose); ~Checker(); // Run pipeline on input, printing to output void proc(std::stringstream& input, std::stringstream& output); // Run pipeline that ends in a SuggestCmd on input, // and instead of printing output with SuggestCmd.run, // we use SuggestCmd.run_errs as the last step. std::vector proc_errs(std::stringstream& input); const LocalisedPrefs& prefs() const; void setIgnores(const std::set& ignores); private: const std::unique_ptr pImpl; }; std::set searchPaths(); std::map> listLangs(const std::string& extraPath = ""); } // namespace divvun #endif