| 1 |
/* |
| 2 |
* Copyright (C) 2005-2024 Team Kodi |
| 3 |
* This file is part of Kodi - https://kodi.tv |
| 4 |
* |
| 5 |
* SPDX-License-Identifier: GPL-2.0-or-later |
| 6 |
* See LICENSES/README.md for more information. |
| 7 |
*/ |
| 8 |
|
| 9 |
#pragma once |
| 10 |
|
| 11 |
#include <memory> |
| 12 |
#include <string> |
| 13 |
#include <vector> |
| 14 |
|
| 15 |
class IInputCodingTable |
| 16 |
{ |
| 17 |
public: |
| 18 |
enum |
| 19 |
{ |
| 20 |
TYPE_WORD_LIST, |
| 21 |
TYPE_CONVERT_STRING |
| 22 |
}; |
| 23 |
virtual int GetType() { return TYPE_WORD_LIST; } |
| 24 |
|
| 25 |
virtual ~IInputCodingTable() = default; |
| 26 |
/*! \brief Called for the active keyboard layout when it's loaded, stick any initialization here |
| 27 |
|
| 28 |
This won't be needed for most implementations so we don't set it =0 but provide a default |
| 29 |
implementation. |
| 30 |
*/ |
| 31 |
virtual void Initialize() {} |
| 32 |
|
| 33 |
/*! \brief Called for the active keyboard layout when it's unloaded, stick any cleanup here |
| 34 |
|
| 35 |
This won't be needed for most implementations so we don't set it =0 but provide a default |
| 36 |
implementation. |
| 37 |
*/ |
| 38 |
virtual void Deinitialize() {} |
| 39 |
|
| 40 |
/*! \brief Can be overridden if initialization is expensive to avoid calling initialize more than |
| 41 |
needed |
| 42 |
|
| 43 |
\return true if initialization has been done and was successful, false otherwise. |
| 44 |
*/ |
| 45 |
virtual bool IsInitialized() const { return true; } |
| 46 |
virtual bool GetWordListPage(const std::string& strCode, bool isFirstPage) = 0; |
| 47 |
virtual std::vector<std::wstring> GetResponse(int response) = 0; |
| 48 |
const std::string& GetCodeChars() const { return m_codechars; } |
| 49 |
|
| 50 |
virtual void SetTextPrev(const std::string& strTextPrev) {} |
| 51 |
virtual std::string ConvertString(const std::string& strCode) { return std::string(""); } |
| 52 |
|
| 53 |
protected: |
| 54 |
std::string m_codechars; |
| 55 |
}; |
| 56 |
|
| 57 |
typedef std::shared_ptr<IInputCodingTable> IInputCodingTablePtr; |