13#if defined(Q_OS_DARWIN)
14# include "private/qcore_mac_p.h"
15# if !defined(SHM_NAME_MAX)
20# define SHM_NAME_MAX 30
22#elif defined(Q_OS_WINDOWS)
26#if QT_CONFIG(sharedmemory) || QT_CONFIG(systemsemaphore)
35 case QNativeIpcKey::Type::SystemV:
37 case QNativeIpcKey::Type::PosixRealtime:
39 case QNativeIpcKey::Type::Windows:
45static QString typeToString(QNativeIpcKey::Type
type)
49 case QNativeIpcKey::Type::SystemV:
50 case QNativeIpcKey::Type::PosixRealtime:
51 case QNativeIpcKey::Type::Windows:
58 typeString = staticTypeToString(QNativeIpcKey::Type::SystemV);
65static QNativeIpcKey::Type stringToType(
QStringView typeString)
67 if (typeString == staticTypeToString(QNativeIpcKey::Type::PosixRealtime))
68 return QNativeIpcKey::Type::PosixRealtime;
69 if (typeString == staticTypeToString(QNativeIpcKey::Type::Windows))
70 return QNativeIpcKey::Type::Windows;
75 if (!
ok || n < low || n > high)
76 return QNativeIpcKey::Type{};
77 return QNativeIpcKey::Type(
n);
80 QStringView sysv = staticTypeToString(QNativeIpcKey::Type::SystemV);
81 if (typeString.startsWith(sysv)) {
82 if (typeString.size() == sysv.size())
83 return QNativeIpcKey::Type::SystemV;
84 return fromNumber(typeString.sliced(sysv.size()), 1, 0xff);
88 return QNativeIpcKey::Type{};
103QNativeIpcKey QtIpcCommon::legacyPlatformSafeKey(
const QString &
key, QtIpcCommon::IpcType ipcType,
104 QNativeIpcKey::Type
type)
106 QNativeIpcKey k(
type);
112 if (
type == QNativeIpcKey::Type::PosixRealtime) {
113#if defined(Q_OS_DARWIN)
119 QNativeIpcKeyPrivate::setNativeAndLegacyKeys(k,
key,
key);
126 QNativeIpcKeyPrivate::setNativeAndLegacyKeys(k, native,
key);
135 case IpcType::SharedMemory:
136 result +=
"qipc_sharedmemory_"_L1;
138 case IpcType::SystemSemaphore:
139 result +=
"qipc_systemsem_"_L1;
144 if ((
ch >= u
'a' &&
ch <= u
'z') ||
145 (
ch >= u
'A' &&
ch <= u
'Z'))
151 case QNativeIpcKey::Type::Windows:
152 if (isIpcSupported(ipcType, QNativeIpcKey::Type::Windows))
153 QNativeIpcKeyPrivate::setNativeAndLegacyKeys(k,
result,
key);
155 case QNativeIpcKey::Type::PosixRealtime:
157 if (isIpcSupported(ipcType, QNativeIpcKey::Type::PosixRealtime))
158 QNativeIpcKeyPrivate::setNativeAndLegacyKeys(k,
result,
key);
160 case QNativeIpcKey::Type::SystemV:
163 if (isIpcSupported(ipcType, QNativeIpcKey::Type::SystemV)) {
165 QNativeIpcKeyPrivate::setNativeAndLegacyKeys(k,
result,
key);
177QNativeIpcKey QtIpcCommon::platformSafeKey(
const QString &
key, QtIpcCommon::IpcType ipcType,
178 QNativeIpcKey::Type
type)
180 QNativeIpcKey k(
type);
185 case QNativeIpcKey::Type::PosixRealtime:
186 if (isIpcSupported(ipcType, QNativeIpcKey::Type::PosixRealtime)) {
193 k.setNativeKey(u
'/' +
key);
198 case QNativeIpcKey::Type::Windows:
199 if (isIpcSupported(ipcType, QNativeIpcKey::Type::Windows)) {
203 for (
QStringView candidate : { u
"Local\\", u
"Global\\" }) {
204 if (!
key.startsWith(candidate))
213 case IpcType::SharedMemory: mid = u
"shm_";
break;
214 case IpcType::SystemSemaphore: mid = u
"sem_";
break;
225 case QNativeIpcKey::Type::SystemV:
230 if (isIpcSupported(ipcType, QNativeIpcKey::Type::SystemV)) {
231 if (
key.startsWith(u
'/')) {
235 k.setNativeKey(baseDir + u
'/' +
key);
362#if defined(Q_OS_DARWIN)
363QNativeIpcKey::Type QNativeIpcKey::defaultTypeForOs_internal() noexcept
366 return Type::PosixRealtime;
367 return Type::SystemV;
393void QNativeIpcKey::copy_internal(
const QNativeIpcKey &
other)
395 d =
new QNativeIpcKeyPrivate(*
other.d);
398void QNativeIpcKey::move_internal(QNativeIpcKey &&) noexcept
403QNativeIpcKey &QNativeIpcKey::assign_internal(
const QNativeIpcKey &
other)
411 d =
new QNativeIpcKeyPrivate(*
other.d);
420void QNativeIpcKey::destroy_internal() noexcept
476void QNativeIpcKey::setType_internal(
Type type)
496void QNativeIpcKey::setNativeKey_internal(
const QString &)
498 d->legacyKey_.clear();
512size_t qHash(
const QNativeIpcKey &ipcKey,
size_t seed)
noexcept
525int QNativeIpcKey::compare_internal(
const QNativeIpcKey &lhs,
const QNativeIpcKey &rhs)
noexcept
527 return (QNativeIpcKeyPrivate::legacyKey(lhs) == QNativeIpcKeyPrivate::legacyKey(rhs)) ? 0 : 1;
540QString QNativeIpcKey::toString()
const
549 copy.replace(u
'%',
"%25"_L1);
550 if (
copy.startsWith(
"//"_L1))
551 copy.replace(0, 2, u
"/%2F"_s);
558 if (!
d->legacyKey_.isEmpty())
575QNativeIpcKey QNativeIpcKey::fromString(
const QString &
text)
578 Type invalidType = {};
582 return QNativeIpcKey(invalidType);
586 return QNativeIpcKey(invalidType);
594 if (
item.first == u
"legacyKey"_s) {
596 QNativeIpcKeyPrivate::setLegacyKey(
result, std::move(legacyKey));
599 return QNativeIpcKey(invalidType);
608#include "moc_qtipccommon.cpp"
static QByteArray hash(QByteArrayView data, Algorithm method)
Returns the hash of data using method.
constexpr QLatin1StringView left(qsizetype n) const
static QString writableLocation(StandardLocation type)
constexpr void truncate(qsizetype n) noexcept
Truncates this string view to length length.
constexpr qsizetype size() const noexcept
Returns the size of this string view, in UTF-16 code units (that is, surrogate pairs count as two for...
constexpr QStringView sliced(qsizetype pos) const noexcept
\macro QT_RESTRICTED_CAST_FROM_ASCII
QString & replace(qsizetype i, qsizetype len, QChar after)
void reserve(qsizetype size)
Ensures the string has space for at least size characters.
bool isEmpty() const noexcept
Returns true if the string has no characters; otherwise returns false.
bool isNull() const
Returns true if this string is null; otherwise returns false.
static QString fromRawData(const QChar *, qsizetype size)
Constructs a QString that uses the first size Unicode characters in the array unicode.
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void addQueryItem(const QString &key, const QString &value)
Appends the pair key = value to the end of the query string of the URL.
QList< std::pair< QString, QString > > queryItems(QUrl::ComponentFormattingOptions encoding=QUrl::PrettyDecoded) const
Returns the query string of the URL, as a map of keys and values, using the options specified in enco...
QString userInfo(ComponentFormattingOptions options=PrettyDecoded) const
Returns the user info of the URL, or an empty string if the user info is undefined.
static QString fromPercentEncoding(const QByteArray &)
Returns a decoded copy of input.
bool isValid() const
Returns true if the URL is non-empty and valid; otherwise returns false.
QString host(ComponentFormattingOptions=FullyDecoded) const
Returns the host of the URL if it is defined; otherwise an empty string is returned.
void setQuery(const QString &query, ParsingMode mode=TolerantMode)
Sets the query string of the URL to query.
QString scheme() const
Returns the scheme of the URL.
void setScheme(const QString &scheme)
Sets the scheme of the URL to scheme.
int port(int defaultPort=-1) const
void setPath(const QString &path, ParsingMode mode=DecodedMode)
Sets the path of the URL to path.
QString toString(FormattingOptions options=FormattingOptions(PrettyDecoded)) const
Returns a string representation of the URL.
QString path(ComponentFormattingOptions options=FullyDecoded) const
Returns the path of the URL.
Combined button and popup list for selecting options.
static jboolean copy(JNIEnv *, jobject)
bool qt_apple_isSandboxed()
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
size_t qHash(const QFileSystemWatcherPathKey &key, size_t seed=0)
constexpr QtPrivate::QHashMultiReturnType< T... > qHashMulti(size_t seed, const T &... args) noexcept(std::conjunction_v< QtPrivate::QNothrowHashable< T >... >)
GLdouble GLdouble GLdouble GLdouble q
static Q_CONSTINIT QBasicAtomicInteger< unsigned > seed