2012-06-10 16:50:54 +00:00
|
|
|
/*
|
2024-09-17 19:00:25 +00:00
|
|
|
* Deskflow -- mouse and keyboard sharing utility
|
2016-09-07 14:24:00 +00:00
|
|
|
* Copyright (C) 2012-2016 Symless Ltd.
|
2012-09-04 02:09:56 +00:00
|
|
|
* Copyright (C) 2002 Chris Schoeneman
|
2024-07-02 19:07:06 +00:00
|
|
|
*
|
2012-06-10 16:50:54 +00:00
|
|
|
* This package is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU General Public License
|
2015-05-03 02:33:52 +00:00
|
|
|
* found in the file LICENSE that should have accompanied this file.
|
2024-07-02 19:07:06 +00:00
|
|
|
*
|
2012-06-10 16:50:54 +00:00
|
|
|
* This package is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
|
2014-02-28 12:36:45 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "common/IInterface.h"
|
2025-01-11 02:14:00 +00:00
|
|
|
#include "common/common.h"
|
2012-06-10 16:50:54 +00:00
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
|
|
//! Interface for architecture dependent string operations
|
|
|
|
|
/*!
|
|
|
|
|
This interface defines the string operations required by
|
2024-09-17 19:00:25 +00:00
|
|
|
deskflow. Each architecture must implement this interface.
|
2012-06-10 16:50:54 +00:00
|
|
|
*/
|
2024-10-17 18:04:35 +00:00
|
|
|
class IArchString : public IInterface
|
|
|
|
|
{
|
2012-06-10 16:50:54 +00:00
|
|
|
public:
|
2024-07-02 19:07:06 +00:00
|
|
|
IArchString() = default;
|
|
|
|
|
IArchString(const IArchString &) = delete;
|
|
|
|
|
IArchString(IArchString &&) = delete;
|
|
|
|
|
virtual ~IArchString();
|
2012-06-10 16:50:54 +00:00
|
|
|
|
2024-07-02 19:07:06 +00:00
|
|
|
IArchString &operator=(const IArchString &) = delete;
|
|
|
|
|
IArchString &operator=(IArchString &&) = delete;
|
2020-11-03 10:52:56 +00:00
|
|
|
|
2024-07-02 19:07:06 +00:00
|
|
|
//! Wide character encodings
|
|
|
|
|
/*!
|
|
|
|
|
The known wide character encodings
|
|
|
|
|
*/
|
2024-10-17 18:04:35 +00:00
|
|
|
enum EWideCharEncoding
|
|
|
|
|
{
|
2024-07-02 19:07:06 +00:00
|
|
|
kUCS2, //!< The UCS-2 encoding
|
|
|
|
|
kUCS4, //!< The UCS-4 encoding
|
|
|
|
|
kUTF16, //!< The UTF-16 encoding
|
|
|
|
|
kUTF32, //!< The UTF-32 encoding
|
|
|
|
|
kPlatformDetermined
|
|
|
|
|
};
|
2012-06-10 16:50:54 +00:00
|
|
|
|
2024-07-02 19:07:06 +00:00
|
|
|
//! @name manipulators
|
|
|
|
|
//@{
|
2012-06-10 16:50:54 +00:00
|
|
|
|
2024-07-02 19:07:06 +00:00
|
|
|
//! printf() to limited size buffer with va_list
|
|
|
|
|
/*!
|
|
|
|
|
This method is equivalent to vsprintf() except it will not write
|
|
|
|
|
more than \c n bytes to the buffer, returning -1 if the output
|
|
|
|
|
was truncated and the number of bytes written not including the
|
|
|
|
|
trailing NUL otherwise.
|
|
|
|
|
*/
|
|
|
|
|
virtual int vsnprintf(char *str, int size, const char *fmt, va_list ap);
|
2012-06-10 16:50:54 +00:00
|
|
|
|
2024-07-02 19:07:06 +00:00
|
|
|
//! Convert multibyte string to wide character string
|
2025-01-11 02:13:19 +00:00
|
|
|
virtual int convStringMBToWC(wchar_t *, const char *, uint32_t n, bool *errors);
|
2012-06-10 16:50:54 +00:00
|
|
|
|
2024-07-02 19:07:06 +00:00
|
|
|
//! Convert wide character string to multibyte string
|
2025-01-11 02:13:19 +00:00
|
|
|
virtual int convStringWCToMB(char *, const wchar_t *, uint32_t n, bool *errors);
|
2012-06-10 16:50:54 +00:00
|
|
|
|
2024-07-02 19:07:06 +00:00
|
|
|
//! Return the architecture's native wide character encoding
|
|
|
|
|
virtual EWideCharEncoding getWideCharEncoding() = 0;
|
2012-06-10 16:50:54 +00:00
|
|
|
|
2024-07-02 19:07:06 +00:00
|
|
|
//@}
|
2012-06-10 16:50:54 +00:00
|
|
|
};
|