Merge pull request #26166 from ksooo/improve-plugin-ctx-menus
[xbmc.git] / xbmc / input / InputCodingTable.h
blobfa01ebc861083002beb67e2a6644c091bf95ca02
1 /*
2 * Copyright (C) 2005-2024 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
9 #pragma once
11 #include <memory>
12 #include <string>
13 #include <vector>
15 class IInputCodingTable
17 public:
18 enum
20 TYPE_WORD_LIST,
21 TYPE_CONVERT_STRING
23 virtual int GetType() { return TYPE_WORD_LIST; }
25 virtual ~IInputCodingTable() = default;
26 /*! \brief Called for the active keyboard layout when it's loaded, stick any initialization here
28 This won't be needed for most implementations so we don't set it =0 but provide a default
29 implementation.
31 virtual void Initialize() {}
33 /*! \brief Called for the active keyboard layout when it's unloaded, stick any cleanup here
35 This won't be needed for most implementations so we don't set it =0 but provide a default
36 implementation.
38 virtual void Deinitialize() {}
40 /*! \brief Can be overridden if initialization is expensive to avoid calling initialize more than
41 needed
43 \return true if initialization has been done and was successful, false otherwise.
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; }
50 virtual void SetTextPrev(const std::string& strTextPrev) {}
51 virtual std::string ConvertString(const std::string& strCode) { return std::string(""); }
53 protected:
54 std::string m_codechars;
57 typedef std::shared_ptr<IInputCodingTable> IInputCodingTablePtr;