54 #if !(defined(QT_NO_SHAREDMEMORY) && defined(QT_NO_SYSTEMSEMAPHORE)) 84 #elif defined(Q_OS_SYMBIAN) 85 return result.
left(KMaxKernelName);
86 #elif defined(QT_POSIX_IPC) 92 #endif // QT_NO_SHAREDMEMORY && QT_NO_SHAREDMEMORY 94 #ifndef QT_NO_SHAREDMEMORY 226 if (key ==
d->key &&
d->makePlatformSafeKey(key) ==
d->nativeKey)
233 d->nativeKey =
d->makePlatformSafeKey(key);
261 if (key ==
d->nativeKey &&
d->key.isNull())
275 #ifndef QT_NO_SYSTEMSEMAPHORE 276 systemSemaphore.setKey(
QString(), 1);
277 systemSemaphore.setKey(
key, 1);
281 switch(systemSemaphore.error()) {
371 #ifndef QT_NO_SYSTEMSEMAPHORE 379 if (!
d->key.isNull() && !
d->tryLocker(&lock,
QLatin1String(
"QSharedMemory::create")))
383 if (!
d->create(size))
386 return d->attach(mode);
431 #ifndef QT_NO_SYSTEMSEMAPHORE 433 if (!
d->key.isNull() && !
d->tryLocker(&lock,
QLatin1String(
"QSharedMemory::attach")))
440 return d->attach(mode);
452 return (0 !=
d->memory);
471 #ifndef QT_NO_SYSTEMSEMAPHORE 473 if (!
d->key.isNull() && !
d->tryLocker(&lock,
QLatin1String(
"QSharedMemory::detach")))
519 #ifndef QT_NO_SYSTEMSEMAPHORE 535 qWarning(
"QSharedMemory::lock: already locked");
538 if (
d->systemSemaphore.acquire()) {
539 d->lockedByMe =
true;
561 d->lockedByMe =
false;
562 if (
d->systemSemaphore.release())
569 #endif // QT_NO_SYSTEMSEMAPHORE 623 return d->errorString;
626 #endif // QT_NO_SHAREDMEMORY
#define QT_END_NAMESPACE
This macro expands to.
The QRegExp class provides pattern matching using regular expressions.
bool unlock()
Releases the lock on the shared memory segment and returns true, if the lock is currently held by thi...
QByteArray toUtf8() const Q_REQUIRED_RESULT
Returns a UTF-8 representation of the string as a QByteArray.
QString & replace(int i, int len, QChar after)
The QByteArray class provides an array of bytes.
bool detach()
Detaches the process from the shared memory segment.
const void * constData() const
Returns a const pointer to the contents of the shared memory segment, if one is attached.
static QString tr(const char *sourceText, const char *comment=0, int n=-1)
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QString class provides a Unicode character string.
The QObject class is the base class of all Qt objects.
Q_CORE_EXPORT QTextStream & hex(QTextStream &s)
static char toHex(quint8 c)
#define QT_BEGIN_NAMESPACE
This macro expands to.
QString left(int n) const Q_REQUIRED_RESULT
Returns a substring that contains the n leftmost characters of the string.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
bool lock()
This is a semaphore that locks the shared memory segment for access by this process and returns true...
SharedMemoryError error() const
Returns a value indicating whether an error occurred, and, if so, which error it was.
Q_CORE_EXPORT void qWarning(const char *,...)
void setNativeKey(const QString &key)
Sets the native, platform specific, key for this shared memory object.
bool attach(AccessMode mode=ReadWrite)
Attempts to attach the process to the shared memory segment identified by the key that was passed to ...
static QString tempPath()
Returns the absolute path of the system's temporary directory.
~QSharedMemory()
The destructor clears the key, which forces the shared memory object to detach() {detach} from its un...
bool isAttached() const
Returns true if this process is attached to the shared memory segment.
int size() const
Returns the size of the attached shared memory segment.
bool create(int size, AccessMode mode=ReadWrite)
Creates a shared memory segment of size bytes with the key passed to the constructor, set with setKey() or set with setNativeKey(), then attaches to the new shared memory segment with the given access mode and returns true.
QString arg(qlonglong a, int fieldwidth=0, int base=10, const QChar &fillChar=QLatin1Char(' ')) const Q_REQUIRED_RESULT
QString & append(QChar c)
void clear()
Clears the contents of the string and makes it empty.
QObject * parent() const
Returns a pointer to the parent object.
void * data()
Returns a pointer to the contents of the shared memory segment, if one is attached.
The QSharedMemory class provides access to a shared memory segment.
void setKey(const QString &key)
Sets the platform independent key for this shared memory object.
QString nativeKey() const
Returns the native, platform specific, key for this shared memory object.
QString errorString() const
Returns a text description of the last error that occurred.
QString key() const
Returns the key assigned with setKey() to this shared memory, or a null key if no key has been assign...
static QString makePlatformSafeKey(const QString &key, const QString &prefix=QLatin1String("qipc_sharedmemory_"))
Generate a string from the key which can be any unicode string into the subset that the win/unix kern...
QSharedMemory
Constructs a shared memory object with the given parent.
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
static QByteArray hash(const QByteArray &data, Algorithm method)
Returns the hash of data using method.