Path: blob/trunk/cpp/imehandler/common/imehandler.h
2868 views
/*1Licensed to the Software Freedom Conservancy (SFC) under one2or more contributor license agreements. See the NOTICE file3distributed with this work for additional information4regarding copyright ownership. The SFC licenses this file5to you under the Apache License, Version 2.0 (the "License");6you may not use this file except in compliance with the License.7You may obtain a copy of the License at89http://www.apache.org/licenses/LICENSE-2.01011Unless required by applicable law or agreed to in writing, software12distributed under the License is distributed on an "AS IS" BASIS,13WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.14See the License for the specific language governing permissions and15limitations under the License.1617Author: [email protected]18*/192021#ifndef IMEHANDLER_H_22#define IMEHANDLER_H_2324#include <vector>25#include <string>2627// A macro to disallow the copy constructor and operator= functions28// This should be used in the private: declarations of all subclasses.29#define DISALLOW_COPY_AND_ASSIGN(TypeName) \30TypeName(const TypeName&); \31void operator=(const TypeName&)323334/*35* Abstract class representing a IME handler36* aka. the base class abstracting interactions for all IME on all systems.37*/38class ImeHandler {39public:40virtual ~ImeHandler() {}41/*42* Return the currently installed engines in a clear, human readable43* representation.44*/45virtual std::vector<std::string> GetInstalledEngines() const = 0;4647/*48* Return a list of all the available engines on the system.49*/50virtual std::vector<std::string> GetAvailableEngines() const = 0;5152/*53* Return a human readable representation of the currently active engine.54*/55virtual std::string GetActiveEngine() const = 0;5657/*58* Returns true if a non standard (aka. complex, IME type) input method59* is currently used.60*/61virtual bool IsActivated() const = 0;6263/*64* Switches back to a standard input method.65*/66virtual void Deactivate() = 0;6768/*69* Load engines in the system.70* Returns the number of loaded engines.71*/72virtual int LoadEngines(const std::vector<std::string>& engines) = 0;7374/*75* Sets the specified engine to be the one active.76* Returns true if set correctly, false otherwise.77*/78virtual bool ActivateEngine(const std::string& engine) = 0;79};8081/* To use the library with dlopen. */82typedef ImeHandler* create_h();83typedef void destroy_h(ImeHandler*);8485#endif // IMEHANDLER_H_868788