本文整理汇总了C++中qt_QString2TPtrC函数的典型用法代码示例。如果您正苦于以下问题:C++ qt_QString2TPtrC函数的具体用法?C++ qt_QString2TPtrC怎么用?C++ qt_QString2TPtrC使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qt_QString2TPtrC函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: absoluteName
//static
bool QFileSystemEngine::renameFile(const QFileSystemEntry &source, const QFileSystemEntry &target, QSystemError &error)
{
QString sourcepath = absoluteName(source).nativeFilePath();
QString targetpath = absoluteName(target).nativeFilePath();
RFs& fs(qt_s60GetRFs());
TInt err = fs.Rename(qt_QString2TPtrC(sourcepath), qt_QString2TPtrC(targetpath));
if (err == KErrNone)
return true;
error = QSystemError(err, QSystemError::NativeError);
return false;
}
开发者ID:AlekSi,项目名称:phantomjs,代码行数:12,代码来源:qfilesystemengine_symbian.cpp
示例2: absoluteName
//static
bool QFileSystemEngine::createDirectory(const QFileSystemEntry &entry, bool createParents)
{
QString abspath = absoluteName(entry).nativeFilePath();
if (!abspath.endsWith(QLatin1Char('\\')))
abspath.append(QLatin1Char('\\'));
TInt r;
if (createParents)
r = qt_s60GetRFs().MkDirAll(qt_QString2TPtrC(abspath));
else
r = qt_s60GetRFs().MkDir(qt_QString2TPtrC(abspath));
if (createParents && r == KErrAlreadyExists)
return true; //# Qt5 - QDir::mkdir returns false for existing dir, QDir::mkpath returns true (should be made consistent in Qt 5)
return (r == KErrNone);
}
开发者ID:KDE,项目名称:android-qt,代码行数:15,代码来源:qfilesystemengine_symbian.cpp
示例3: TRAPD
//static
bool QFileSystemEngine::copyFile(const QFileSystemEntry &source, const QFileSystemEntry &target, QSystemError &error)
{
//CFileMan is allocated each time because it is not thread-safe
CFileMan *fm = 0;
TRAPD(err, fm = CFileMan::NewL(qt_s60GetRFs()));
if (err == KErrNone) {
err = fm->Copy(qt_QString2TPtrC(absoluteName(source).nativeFilePath()), qt_QString2TPtrC(absoluteName(target).nativeFilePath()), 0);
delete fm;
}
if (err == KErrNone)
return true;
error = QSystemError(err, QSystemError::NativeError);
return false;
}
开发者ID:AlekSi,项目名称:phantomjs,代码行数:15,代码来源:qfilesystemengine_symbian.cpp
示例4: handleOtherSchemes
static bool handleOtherSchemes(const QUrl &url)
{
QString encUrl(QString::fromUtf8(url.toEncoded()));
TPtrC urlPtr(qt_QString2TPtrC(encUrl));
TRAPD( err, handleOtherSchemesL(urlPtr));
return err ? false : true;
}
开发者ID:cdaffara,项目名称:symbiandump-mw3,代码行数:7,代码来源:qdesktopservices_s60.cpp
示例5: QLatin1String
bool QSharedMemoryPrivate::attach(QSharedMemory::AccessMode /* mode */)
{
// Grab a pointer to the memory block
if (!chunk.Handle()) {
QString function = QLatin1String("QSharedMemory::handle");
QString safeKey = makePlatformSafeKey(key);
if (safeKey.isEmpty()) {
error = QSharedMemory::KeyError;
errorString = QSharedMemory::tr("%1: unable to make key").arg(function);
return false;
}
TPtrC ptr(qt_QString2TPtrC(safeKey));
TInt err = KErrNoMemory;
err = chunk.OpenGlobal(ptr, false);
if (err != KErrNone) {
setErrorString(function, err);
return false;
}
}
size = chunk.Size();
memory = chunk.Base();
return true;
}
开发者ID:Akheon23,项目名称:chromecast-mirrored-source.vendor,代码行数:29,代码来源:qsharedmemory_symbian.cpp
示例6: makePlatformSafeKey
bool QSharedMemoryPrivate::create(int size)
{
// Get a windows acceptable key
QString safeKey = makePlatformSafeKey(key);
QString function = QLatin1String("QSharedMemory::create");
if (safeKey.isEmpty()) {
error = QSharedMemory::KeyError;
errorString = QSharedMemory::tr("%1: key error").arg(function);
return false;
}
TPtrC ptr(qt_QString2TPtrC(safeKey));
TInt err = chunk.CreateGlobal(ptr, size, size);
setErrorString(function, err);
if (err != KErrNone)
return false;
// Zero out the created chunk
Mem::FillZ(chunk.Base(), chunk.Size());
return true;
}
开发者ID:Akheon23,项目名称:chromecast-mirrored-source.vendor,代码行数:25,代码来源:qsharedmemory_symbian.cpp
示例7: name
int QSystemSemaphorePrivate::handle(QSystemSemaphore::AccessMode)
{
if (semaphore.Handle()) {
return semaphore.Handle();
}
// don't allow making handles on empty keys
if (key.isEmpty())
return 0;
TPtrC name(qt_QString2TPtrC(fileName));
int err = KErrAlreadyExists;
int tryCount = 10;
// Sort out race conditions by retrying several times until existing handle is acquired.
// Sometimes opening can fail inexplicably with KErrPermissionDenied many times in a row.
while (err != KErrNoMemory && err != KErrNone && tryCount-- >= 0) {
err = semaphore.CreateGlobal(name, initialValue, EOwnerProcess);
if (err != KErrNoMemory && err != KErrNone)
err = semaphore.OpenGlobal(name,EOwnerProcess);
}
if (err){
setErrorString(QLatin1String("QSystemSemaphore::handle"),err);
return 0;
}
return semaphore.Handle();
}
开发者ID:Marforius,项目名称:qt,代码行数:26,代码来源:qsystemsemaphore_symbian.cpp
示例8: labelPtr
QString CSmfCredMgrClientSymbian::storeRSAKeysL(const QString KeyLabel,
const QString keydata, const QDateTime Validity)
{
RDebug::Printf("Sending store RSA key message to server");
TPtrC labelPtr(qt_QString2TPtrC(KeyLabel));
TPtr dataPtr((qt_QString2HBufC(keydata)->Des()));
QDateTime CurrentTime = QDateTime::currentDateTime();
TTimeIntervalSeconds duration(CurrentTime.secsTo(Validity));
TTime startDate;
startDate.UniversalTime();
TTime endDate(startDate);
endDate += duration;
CSmfRsaKeyParameters* storeRSAKeysparams = CSmfRsaKeyParameters::NewL(
labelPtr, startDate, endDate, (dataPtr.Collapse()));
CleanupStack::PushL(storeRSAKeysparams);
CBufFlat* buf = CBufFlat::NewL(KMinBufSize);
CleanupStack::PushL(buf);
RBufWriteStream stream(*buf);
CleanupClosePushL(stream);
storeRSAKeysparams->ExternalizeL(stream);
stream.CommitL();
TPtr8 bufPtr = buf->Ptr(0);
TIpcArgs args;
args.Set(0, &bufPtr);
CleanupStack::PopAndDestroy(&stream);
HBufC8* retBuf = HBufC8::NewLC(KSHA1HashLengthBytes);
TPtr8 retBufPtr(retBuf->Des());
args.Set(1, &retBufPtr);
iSession.RequestService(ESmfStoreRSAKey, args);
RDebug::Printf("SMF: Message completed");
TBuf<KSHA1HashLengthBytes> key;
key.Copy(retBufPtr);
QString RetString(qt_TDesC2QString(key));
CleanupStack::Pop(retBuf);
CleanupStack::PopAndDestroy(buf);
CleanupStack::PopAndDestroy(storeRSAKeysparams);
RDebug::Printf("-In storeAuthDataL()");
return (RetString);
}
开发者ID:cdaffara,项目名称:symbiandump-mw4,代码行数:58,代码来源:smfcredmgrclient_p.cpp
示例9: handleUrl
// The biggest advantage of schemehandler is that it can handle
// wide range of schemes and is extensible by plugins
static bool handleUrl(const QUrl &url)
{
if (!url.isValid())
return false;
QString urlString(url.toString());
TPtrC urlPtr(qt_QString2TPtrC(urlString));
TRAPD( err, handleUrlL(urlPtr));
return err ? false : true;
}
开发者ID:cdaffara,项目名称:symbiandump-mw3,代码行数:12,代码来源:qdesktopservices_s60.cpp
示例10: fontSpec
CFont *QFontEngineS60::fontWithSize(qreal size) const
{
CFont *result = 0;
TFontSpec fontSpec(qt_QString2TPtrC(QFontEngine::fontDef.family), TInt(size));
fontSpec.iFontStyle.SetBitmapType(EAntiAliasedGlyphBitmap);
fontSpec.iFontStyle.SetPosture(QFontEngine::fontDef.style == QFont::StyleNormal?EPostureUpright:EPostureItalic);
fontSpec.iFontStyle.SetStrokeWeight(QFontEngine::fontDef.weight > QFont::Normal?EStrokeWeightBold:EStrokeWeightNormal);
const TInt errorCode = S60->screenDevice()->GetNearestFontToDesignHeightInPixels(result, fontSpec);
Q_ASSERT(result && (errorCode == 0));
return result;
}
开发者ID:venkatarajasekhar,项目名称:ECE497,代码行数:11,代码来源:qfontengine_s60.cpp
示例11: openDocument
static bool openDocument(const QUrl &file)
{
if (!file.isValid())
return false;
QString filePath = file.toLocalFile();
filePath = QDir::toNativeSeparators(filePath);
TPtrC filePathPtr(qt_QString2TPtrC(filePath));
TRAPD(err, openDocumentL(filePathPtr));
return err ? false : true;
}
开发者ID:cdaffara,项目名称:symbiandump-mw3,代码行数:11,代码来源:qdesktopservices_s60.cpp
示例12: lastError
QT_BEGIN_NAMESPACE
QFileSystemIterator::QFileSystemIterator(const QFileSystemEntry &path, QDir::Filters filters,
const QStringList &nameFilters, QDirIterator::IteratorFlags iteratorFlags)
: lastError(KErrNone), entryIndex(-1)
{
RFs& fs = qt_s60GetRFs();
nativePath = path.nativeFilePath();
if (!nativePath.endsWith(QLatin1Char('\\')))
nativePath.append(QLatin1Char('\\'));
QString absPath = QFileSystemEngine::absoluteName(path).nativeFilePath();
if (!absPath.endsWith(QLatin1Char('\\')))
absPath.append(QLatin1Char('\\'));
int pathLen = absPath.length();
if (pathLen > KMaxFileName) {
lastError = KErrBadName;
return;
}
//set up server side filtering to reduce IPCs
//RDir won't accept all valid name filters e.g. "*. bar"
if (nameFilters.count() == 1 && !(filters & QDir::AllDirs) && iteratorFlags
== QDirIterator::NoIteratorFlags && pathLen + nameFilters[0].length()
<= KMaxFileName) {
//server side supports one mask - skip this for recursive mode or if only files should be filtered
absPath.append(nameFilters[0]);
}
TUint symbianMask = 0;
if ((filters & QDir::Dirs) || (filters & QDir::AllDirs) || (iteratorFlags
& QDirIterator::Subdirectories))
symbianMask |= KEntryAttDir; //include directories
if (filters & QDir::Hidden)
symbianMask |= KEntryAttHidden;
if (filters & QDir::System)
symbianMask |= KEntryAttSystem;
//Do not use KEntryAttMatchExclusive to optimise to return only
//directories for QDir::Dirs. There may be a file which is actually
//a "mount point" for a file engine and needs to be returned so it
//can be overriden to be a directory, see QTBUG-23688
if (symbianMask == 0
&& ((filters & QDir::PermissionMask) == QDir::Writable)) {
symbianMask = KEntryAttMatchExclude | KEntryAttReadOnly;
}
lastError = dirHandle.Open(fs, qt_QString2TPtrC(absPath), symbianMask);
}
开发者ID:maxxant,项目名称:qt,代码行数:51,代码来源:qfilesystemiterator_symbian.cpp
示例13: writeToSymbianStoreLX
void writeToSymbianStoreLX(const QMimeData* aData, CClipboard* clipboard)
{
// This function both leaves and throws exceptions. There must be no destructor
// dependencies between cleanup styles, and no cleanup stack dependencies on stacked objects.
if (aData->hasText()) {
CPlainText* text = CPlainText::NewL();
CleanupStack::PushL(text);
TPtrC textPtr(qt_QString2TPtrC(aData->text()));
text->InsertL(KPlainTextBegin, textPtr);
text->CopyToStoreL(clipboard->Store(), clipboard->StreamDictionary(),
KPlainTextBegin, textPtr.Length());
CleanupStack::PopAndDestroy(text);
}
}
开发者ID:phen89,项目名称:rtqt,代码行数:15,代码来源:qclipboard_s60.cpp
示例14: load
/*!
\property QPluginLoader::fileName
\brief the file name of the plugin
To be loadable, the file's suffix must be a valid suffix for a
loadable library in accordance with the platform, e.g. \c .so on
Unix, \c .dylib on Mac OS X, and \c .dll on Windows. The suffix
can be verified with QLibrary::isLibrary().
If the file name does not exist, it will not be set. This property
will then contain an empty string.
By default, this property contains an empty string.
Note: In Symbian the \a fileName must point to plugin stub file.
\sa load()
*/
void QPluginLoader::setFileName(const QString &fileName)
{
#if defined(QT_SHARED)
QLibrary::LoadHints lh;
if (d) {
lh = d->loadHints;
d->release();
d = 0;
did_load = false;
}
#if defined(Q_OS_SYMBIAN)
// In Symbian we actually look for plugin stub, so modify the filename
// to make canonicalFilePath find the file, if .dll is specified.
QFileInfo fi(fileName);
if (fi.suffix() == QLatin1String("dll")) {
QString stubName = fileName;
stubName.chop(3);
stubName += QLatin1String("qtplugin");
fi = QFileInfo(stubName);
}
QString fn = fi.canonicalFilePath();
// If not found directly, check also all the available drives
if (!fn.length()) {
QString stubPath(fi.fileName().length() ? fi.absoluteFilePath() : QString());
if (stubPath.length() > 1) {
if (stubPath.at(1).toAscii() == ':')
stubPath.remove(0,2);
QFileInfoList driveList(QDir::drives());
RFs rfs = qt_s60GetRFs();
foreach(const QFileInfo& drive, driveList) {
QString testFilePath(drive.absolutePath() + stubPath);
testFilePath = QDir::cleanPath(testFilePath);
// Use native Symbian code to check for file existence, because checking
// for file from under non-existent protected dir like E:/private/<uid> using
// QFile::exists causes platform security violations on most apps.
QString nativePath = QDir::toNativeSeparators(testFilePath);
TPtrC ptr(qt_QString2TPtrC(nativePath));
TUint attributes;
TInt err = rfs.Att(ptr, attributes);
if (err == KErrNone) {
fn = testFilePath;
break;
}
}
}
开发者ID:phanimohan,项目名称:phantomjs,代码行数:66,代码来源:qpluginloader.cpp
示例15: ptr
bool QSharedMemoryPrivate::create(int size)
{
if (!handle())
return false;
TPtrC ptr(qt_QString2TPtrC(nativeKey));
TInt err = chunk.CreateGlobal(ptr, size, size);
if (err != KErrNone) {
setErrorString(QLatin1String("QSharedMemory::create"), err);
return false;
}
// Zero out the created chunk
Mem::FillZ(chunk.Base(), chunk.Size());
return true;
}
开发者ID:maxxant,项目名称:qt,代码行数:19,代码来源:qsharedmemory_symbian.cpp
示例16: localizedDirectoryName
EXPORT_C QString localizedDirectoryName(QString& rawPath)
{
QString ret;
std::exception dummy; // voodoo fix for "Undefined symbol typeinfo for std::exception" in armv5 build
TRAPD(err,
QT_TRYCATCH_LEAVING(
CDirectoryLocalizer* localizer = CDirectoryLocalizer::NewL();
CleanupStack::PushL(localizer);
localizer->SetFullPath(qt_QString2TPtrC(QDir::toNativeSeparators(rawPath)));
if(localizer->IsLocalized()){
TPtrC locName(localizer->LocalizedName());
ret = qt_TDesC2QString(locName);
}
CleanupStack::PopAndDestroy(localizer);
)
)
if (err != KErrNone)
开发者ID:Akheon23,项目名称:chromecast-mirrored-source.vendor,代码行数:19,代码来源:qdesktopservices_3_2.cpp
示例17: setSelect
bool QSymSQLResult::prepare(const QString &query)
{
if (!driver() || !driver()->isOpen() || driver()->isOpenError())
return false;
d->cleanup();
setSelect(false);
TInt res = d->stmt.Prepare(d->access, qt_QString2TPtrC(query));
if (res != KErrNone) {
setLastError(qMakeError(d->access, QCoreApplication::translate("QSymSQLResult",
"Unable to execute statement"), QSqlError::StatementError, res));
d->finalize();
return false;
}
d->prepareCalled = true;
return true;
}
开发者ID:maxxant,项目名称:qt,代码行数:21,代码来源:qsql_symsql.cpp
示例18: storageLocation
QString QDesktopServices::displayName(StandardLocation type)
{
QString ret;
#ifdef Q_WS_S60
QString rawPath = storageLocation(type);
TRAPD(err,
QT_TRYCATCH_LEAVING(
CDirectoryLocalizer* localizer = CDirectoryLocalizer::NewL();
CleanupStack::PushL(localizer);
localizer->SetFullPath(qt_QString2TPtrC(QDir::toNativeSeparators(rawPath)));
if (localizer->IsLocalized()) {
TPtrC locName(localizer->LocalizedName());
ret = qt_TDesC2QString(locName);
}
CleanupStack::PopAndDestroy(localizer);
)
)
if (err != KErrNone)
开发者ID:Suneal,项目名称:qt,代码行数:21,代码来源:qdesktopservices_s60.cpp
示例19: Q_D
bool QFSFileEngine::setSize(qint64 size)
{
Q_D(QFSFileEngine);
bool ret = false;
TInt err = KErrNone;
if (d->symbianFile.SubSessionHandle()) {
TInt err = d->symbianFile.SetSize(size);
ret = (err == KErrNone);
if (ret && d->symbianFilePos > size)
d->symbianFilePos = size;
}
else if (d->fd != -1)
ret = QT_FTRUNCATE(d->fd, size) == 0;
else if (d->fh)
ret = QT_FTRUNCATE(QT_FILENO(d->fh), size) == 0;
else {
RFile tmp;
QString symbianFilename(d->fileEntry.nativeFilePath());
err = tmp.Open(qt_s60GetRFs(), qt_QString2TPtrC(symbianFilename), EFileWrite);
if (err == KErrNone)
{
err = tmp.SetSize(size);
tmp.Close();
}
ret = (err == KErrNone);
}
if (!ret) {
QSystemError error;
if (err)
error = QSystemError(err, QSystemError::NativeError);
else
error = QSystemError(errno, QSystemError::StandardLibraryError);
setError(QFile::ResizeError, error.toString());
}
return ret;
}
开发者ID:AlekSi,项目名称:phantomjs,代码行数:36,代码来源:qfsfileengine_unix.cpp
示例20: fs
//static
bool QFileSystemEngine::fillMetaData(const QFileSystemEntry &entry, QFileSystemMetaData &data, QFileSystemMetaData::MetaDataFlags what)
{
if (what & QFileSystemMetaData::SymbianTEntryFlags) {
RFs& fs(qt_s60GetRFs());
TInt err;
QFileSystemEntry absentry(absoluteName(entry));
if (entry.isEmpty()) {
err = KErrNotFound;
} else if (absentry.isRoot()) {
//Root directories don't have an entry, and Entry() returns KErrBadName.
//Therefore get information about the volume instead.
TInt drive;
err = RFs::CharToDrive(TChar(absentry.nativeFilePath().at(0).unicode()), drive);
if (!err) {
TVolumeInfo info;
err = fs.Volume(info, drive);
if (!err)
data.fillFromVolumeInfo(info);
}
} else {
TEntry ent;
err = fs.Entry(qt_QString2TPtrC(absentry.nativeFilePath()), ent);
if (!err)
data.fillFromTEntry(ent);
}
if (err) {
data.size_ = 0;
data.modificationTime_ = TTime(0);
data.entryFlags &= ~(QFileSystemMetaData::SymbianTEntryFlags);
}
//files in /sys/bin on any drive are executable, even though we don't normally have permission to check whether they exist or not
if(absentry.filePath().midRef(1,10).compare(QLatin1String(":/sys/bin/"), Qt::CaseInsensitive) == 0)
data.entryFlags |= QFileSystemMetaData::ExecutePermissions;
}
return data.hasFlags(what);
}
开发者ID:AlekSi,项目名称:phantomjs,代码行数:37,代码来源:qfilesystemengine_symbian.cpp
注:本文中的qt_QString2TPtrC函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论