Back to index

im-sdk  12.3.91
IMProtocol.hh
Go to the documentation of this file.
00001 /*
00002 Copyright 1990-2001 Sun Microsystems, Inc. All Rights Reserved.
00003 
00004 Permission is hereby granted, free of charge, to any person obtaining a
00005 copy of this software and associated documentation files (the
00006 "Software"), to deal in the Software without restriction, including
00007 without limitation the rights to use, copy, modify, merge, publish,
00008 distribute, sublicense, and/or sell copies of the Software, and to
00009 permit persons to whom the Software is furnished to do so, subject to
00010 the following conditions: The above copyright notice and this
00011 permission notice shall be included in all copies or substantial
00012 portions of the Software.
00013 
00014 
00015 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00016 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00017 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00018 IN NO EVENT SHALL THE OPEN GROUP OR SUN MICROSYSTEMS, INC. BE LIABLE
00019 FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
00020 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
00021 THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE EVEN IF
00022 ADVISED IN ADVANCE OF THE POSSIBILITY OF SUCH DAMAGES.
00023 
00024 
00025 Except as contained in this notice, the names of The Open Group and/or
00026 Sun Microsystems, Inc. shall not be used in advertising or otherwise to
00027 promote the sale, use or other dealings in this Software without prior
00028 written authorization from The Open Group and/or Sun Microsystems,
00029 Inc., as applicable.
00030 
00031 
00032 X Window System is a trademark of The Open Group
00033 
00034 OSF/1, OSF/Motif and Motif are registered trademarks, and OSF, the OSF
00035 logo, LBX, X Window System, and Xinerama are trademarks of the Open
00036 Group. All other trademarks and registered trademarks mentioned herein
00037 are the property of their respective owners. No right, title or
00038 interest in or to any trademark, service mark, logo or trade name of
00039 Sun Microsystems, Inc. or its licensors is granted.
00040 
00041 */
00042 #ifndef _improtocol_hh
00043 #define _improtocol_hh
00044 
00045 #include "IMLanguageList.hh"
00046 #include "IMTriggerKeyList.hh"
00047 #include "IMObjectDescriptorList.hh"
00048 #include "IMEditorDescriptorList.hh"
00049 #include "IMArg.h"
00050 #include "IMTrans.hh"
00051 
00052 class IMProtoHandler;
00053 
00054 class IMProtocol {
00055  public:
00056   enum IM_Attribute {
00057     ServerName = 1,         // "iiimd"
00058     TransportAddress = 2,   // "tcp/<hostname>:9010" for iiim,
00059                             // not used for ximp40
00060     VendorName = 3,         // "SunMicroSystems", optional
00061     PrimaryInputLocale = 4,
00062     LanguageList = 5,
00063     ConversionOnKeys = 6,
00064     ConversionOffKeys = 7,
00065     ProtocolHandler = 8,
00066     ObjectDescriptors = 9,
00067     IMEDescriptors = 10,
00068     DisplayConnection = 11,
00069     IFName = 12,
00070     AppName = 13,
00071     DisableStatusArea = 14,
00072     DefaultFontName = 15
00073   };
00074 
00075   virtual int set_values(IMArg*, int);
00076   int get_values(IMArg*, int);
00077 
00078   virtual int run()=0;
00079 
00080   int countOnKeys() const;
00081   int countOffKeys() const;
00082 
00083   IMTriggerKey &getOnKey(unsigned int index) const;
00084   IMTriggerKey &getOffKey(unsigned int index) const;
00085 
00086   int countLanguages() const;
00087   CompoundString &getLang(unsigned int index) const;
00088 
00089   int countObjectDescriptors() const;
00090   IMObjectDescriptorStruct &getObjectDescriptor(unsigned int index) const;
00091   IMObjectDescriptorStruct &getFirstObjectDescriptor();
00092   IMObjectDescriptorStruct &getNextObjectDescriptor();
00093 
00094   int countIME() const;
00095   IMEditorStruct &getIME(unsigned int index) const;
00096   IMEditorStruct &getFirstIME();
00097   IMEditorStruct &getNextIME();
00098 
00099   const CompoundString &getPrimaryLocale() const;
00100 
00101   IMTransAccept* getIMTransAccept(IMTransListen *trans_listen) const;
00102 
00103   IMProtoHandler *proto_handler; // ProtocolHandler
00104 
00105  protected:
00106   IMProtocol(IMArg*, int);
00107   virtual ~IMProtocol();
00108 
00109   CompoundString protocol_name;    // ProtocolName
00110   CompoundString im_name;          // ServerName
00111   CompoundString im_address;              // TransportAddress
00112   CompoundString input_locale;     // PrimaryInputLocale
00113   CompoundString vendor_name;             // VendorName
00114   IMLanguageList lang_list; // LanguageList
00115   IMTriggerKeyList on_keys; // ConversionOnKeys
00116   IMTriggerKeyList off_keys;       // ConversionOffKeys
00117 
00118   IMObjectDescriptorList od_list; // ObjectDescriptors
00119 
00120   IMEditorDescriptorList ime_list; // IMEDescriptors
00121 
00122   enum MODE {
00123     OPEN, SET, GET
00124   };
00125  private:
00126   int parseArgs(int mode, IMArg *args, int n);
00127 };
00128 
00129 #endif