| 1 |
#ifndef CODEFORMATTERMANAGER_HPP |
| 2 |
#define CODEFORMATTERMANAGER_HPP |
| 3 |
|
| 4 |
#include "GenericFormatter.hpp" |
| 5 |
|
| 6 |
#include <memory> |
| 7 |
#include <unordered_map> |
| 8 |
#include <vector> |
| 9 |
|
| 10 |
class CodeFormatterManager |
| 11 |
{ |
| 12 |
std::vector<std::shared_ptr<GenericFormatter>> m_formatters; |
| 13 |
|
| 14 |
protected: |
| 15 |
void push_back(GenericFormatter* formatter); |
| 16 |
void initialize_defaults(); |
| 17 |
void clear(); |
| 18 |
|
| 19 |
public: |
| 20 |
CodeFormatterManager(); |
| 21 |
virtual ~CodeFormatterManager(); |
| 22 |
|
| 23 |
std::shared_ptr<GenericFormatter> GetFormatter(const wxString& filepath) const; |
| 24 |
std::shared_ptr<GenericFormatter> GetFormatterByName(const wxString& name) const; |
| 25 |
std::shared_ptr<GenericFormatter> GetFormatterByContent(const wxString& content) const; |
| 26 |
size_t GetAllNames(wxArrayString* names) const; |
| 27 |
|
| 28 |
// do we have a formatter that can handle `filepath`? |
| 29 |
bool CanFormat(const wxString& filepath) const; |
| 30 |
// can we format this content? |
| 31 |
bool CanFormatByContent(const wxString& content) const; |
| 32 |
|
| 33 |
// serialization API |
| 34 |
void Load(); |
| 35 |
void Save(); |
| 36 |
|
| 37 |
// discard all the settings and load the defaults |
| 38 |
void RestoreDefaults(); |
| 39 |
|
| 40 |
/// Remove all remote commands set in the formatters |
| 41 |
void ClearRemoteCommands(); |
| 42 |
}; |
| 43 |
|
| 44 |
#endif // CODEFORMATTERMANAGER_HPP |