2012-06-10 16:50:54 +00:00
|
|
|
/*
|
2024-09-17 19:00:25 +00:00
|
|
|
* Deskflow -- mouse and keyboard sharing utility
|
2025-01-24 00:11:17 +00:00
|
|
|
* SPDX-FileCopyrightText: (C) 2012 - 2016 Symless Ltd.
|
|
|
|
|
* SPDX-FileCopyrightText: (C) 2002 Chris Schoeneman
|
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
|
2012-06-10 16:50:54 +00:00
|
|
|
*/
|
|
|
|
|
|
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
|
|
|
};
|