| 1 | /* | 
|---|
| 2 | * synergy -- mouse and keyboard sharing utility | 
|---|
| 3 | * Copyright (C) 2002 Chris Schoeneman | 
|---|
| 4 | * | 
|---|
| 5 | * This package is free software; you can redistribute it and/or | 
|---|
| 6 | * modify it under the terms of the GNU General Public License | 
|---|
| 7 | * found in the file COPYING that should have accompanied this file. | 
|---|
| 8 | * | 
|---|
| 9 | * This package is distributed in the hope that it will be useful, | 
|---|
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|---|
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|---|
| 12 | * GNU General Public License for more details. | 
|---|
| 13 | */ | 
|---|
| 14 |  | 
|---|
| 15 | #ifndef IARCHSTRING_H | 
|---|
| 16 | #define IARCHSTRING_H | 
|---|
| 17 |  | 
|---|
| 18 | #include "IInterface.h" | 
|---|
| 19 | #include "BasicTypes.h" | 
|---|
| 20 | #include <stdarg.h> | 
|---|
| 21 |  | 
|---|
| 22 | //! Interface for architecture dependent string operations | 
|---|
| 23 | /*! | 
|---|
| 24 | This interface defines the string operations required by | 
|---|
| 25 | synergy.  Each architecture must implement this interface. | 
|---|
| 26 | */ | 
|---|
| 27 | class IArchString : public IInterface { | 
|---|
| 28 | public: | 
|---|
| 29 | //! Wide character encodings | 
|---|
| 30 | /*! | 
|---|
| 31 | The known wide character encodings | 
|---|
| 32 | */ | 
|---|
| 33 | enum EWideCharEncoding { | 
|---|
| 34 | kUCS2,          //!< The UCS-2 encoding | 
|---|
| 35 | kUCS4,          //!< The UCS-4 encoding | 
|---|
| 36 | kUTF16,         //!< The UTF-16 encoding | 
|---|
| 37 | kUTF32          //!< The UTF-32 encoding | 
|---|
| 38 | }; | 
|---|
| 39 |  | 
|---|
| 40 | //! @name manipulators | 
|---|
| 41 | //@{ | 
|---|
| 42 |  | 
|---|
| 43 | //! printf() to limited size buffer with va_list | 
|---|
| 44 | /*! | 
|---|
| 45 | This method is equivalent to vsprintf() except it will not write | 
|---|
| 46 | more than \c n bytes to the buffer, returning -1 if the output | 
|---|
| 47 | was truncated and the number of bytes written not including the | 
|---|
| 48 | trailing NUL otherwise. | 
|---|
| 49 | */ | 
|---|
| 50 | virtual int                     vsnprintf(char* str, | 
|---|
| 51 | int size, const char* fmt, va_list ap) = 0; | 
|---|
| 52 |  | 
|---|
| 53 | //! Convert multibyte string to wide character string | 
|---|
| 54 | virtual int                     convStringMBToWC(wchar_t*, | 
|---|
| 55 | const char*, UInt32 n, bool* errors) = 0; | 
|---|
| 56 |  | 
|---|
| 57 | //! Convert wide character string to multibyte string | 
|---|
| 58 | virtual int                     convStringWCToMB(char*, | 
|---|
| 59 | const wchar_t*, UInt32 n, bool* errors) = 0; | 
|---|
| 60 |  | 
|---|
| 61 | //! Return the architecture's native wide character encoding | 
|---|
| 62 | virtual EWideCharEncoding | 
|---|
| 63 | getWideCharEncoding() = 0; | 
|---|
| 64 |  | 
|---|
| 65 | //@} | 
|---|
| 66 | }; | 
|---|
| 67 |  | 
|---|
| 68 | #endif | 
|---|