/**
@return Represents the content of the current flat buffer field as text (16 bit) descriptor.
		If the current flat buffer field type does not refer to a text block of data, then 
		the function will do a data conversion as described in the table which can be found
		in SqlBufIterator.h file.
*/
TPtrC16 TSqlBufRIterator::Text() const
	{
	__ASSERT_DEBUG(iCurrent >= iBegin && iCurrent < iEnd, __SQLPANIC(ESqlPanicInternalError));
	TInt size = Size();
	if(Type() != ESqlText || size == 0)
		{
		return 	TPtrC16();
		}
	return TPtrC16(reinterpret_cast <const TUint16*> (reinterpret_cast <const TUint8*> (iBegin) + iCurrent->iPos), size);
	}
Example #2
0
LOCAL_C void testTLitC16()
	{
	test.Start(_L("All members"));
	test (_L16("")==KNullDesC16);			// operator const TDesC16&
	test (KNullDesC16()==TPtrC16());		// operator()
	const TDesC16* pNull=&KNullDesC16;	// operator&
	test (pNull->Compare(_L16(""))==0);
	test (&testByRef16(KNullDesC16)==&KNullDesC16);	// operator const TRefByValue<const TDesC16>
//
	test.Next(_L("Literal values"));
	const TDesC16& t1=KLitTest1_16;
	test (t1.Length()==1);
	test (t1[0]=='1');
	test (t1==_L16("1"));
	const TDesC16& t12=KLitTest12_16;
	test (t12.Length()==2);
	test (t12[0]=='1');
	test (t12==_L16("12"));
	const TDesC16& t123=KLitTest123_16;
	test (t123.Length()==3);
	test (t123[0]=='1');
	test (t123==_L16("123"));
	const TDesC16& t1234=KLitTest1234_16;
	test (t1234.Length()==4);
	test (t1234[0]=='1');
	test (t1234==_L16("1234"));
	const TDesC16& talpha=KLitTestalpha_16;
	test (talpha.Length()==26);
	test (talpha[0]=='a');
	test (talpha==_L16("abcdefghijklmnopqrstuvwxyz"));
//
	test.End();
	}
Example #3
0
EXPORT_C void NSmlDebugPrintArgs16L( const TText16* aFmt, ... )
	{
	VA_LIST args;
	VA_START (args, aFmt);
	TInt err(KErrNone);
	TRAP(err, _NSmlDebugPrintArgs16L(TPtrC16(aFmt), args));
	VA_END(args);
	}
Example #4
0
TPtrC16 TEnvVar::ValuePtr(const wchar_t* aValue)
//
// Turn a zero-terminated string into a descriptor which contains the terminator
//
	{
	TText16* value = (TText16*)aValue;
	return TPtrC16(value, User::StringLength(value)+1);
	}
Example #5
0
LOCAL_C void testTLitC()
	{
	test.Start(_L("All members"));
	test (_L("")==KNullDesC);			// operator const TDesC&
	test (KNullDesC()==TPtrC());		// operator()
	const TDesC* pNull=&KNullDesC;	// operator&
	test (pNull->Compare(_L(""))==0);
	test (&testByRef(KNullDesC)==&KNullDesC);	// operator const TRefByValue<const TDesC>
#if defined(_UNICODE)
	test (_L16("")==KNullDesC);			// operator const TDesC&
	test (KNullDesC()==TPtrC16());		// operator()
	const TDesC16* pNull16=&KNullDesC;	// operator&
	test (pNull16->Compare(_L16(""))==0);
	test (&testByRef16(KNullDesC)==&KNullDesC);	// operator const TRefByValue<const TDesC>
#else
	test (_L8("")==KNullDesC);			// operator const TDesC&
	test (KNullDesC()==TPtrC8());		// operator()
	const TDesC8* pNull8=&KNullDesC;	// operator&
	test (pNull8->Compare(_L8(""))==0);
	test (&testByRef8(KNullDesC)==&KNullDesC);	// operator const TRefByValue<const TDesC>
#endif
//
	test.Next(_L("Literal values"));
	const TDesC& t1=KLitTest1;
	test (t1.Length()==1);
	test (t1[0]=='1');
	test (t1==_L("1"));
	const TDesC& t12=KLitTest12;
	test (t12.Length()==2);
	test (t12[0]=='1');
	test (t12==_L("12"));
	const TDesC& t123=KLitTest123;
	test (t123.Length()==3);
	test (t123[0]=='1');
	test (t123==_L("123"));
	const TDesC& t1234=KLitTest1234;
	test (t1234.Length()==4);
	test (t1234[0]=='1');
	test (t1234==_L("1234"));
	const TDesC& talpha=KLitTestalpha;
	test (talpha.Length()==26);
	test (talpha[0]=='a');
	test (talpha==_L("abcdefghijklmnopqrstuvwxyz"));
//
	test.End();
	}
bool DirChecker::checkDir(const QDir& dir)
{
    bool pathFound = false;
    // In Symbian, going cdUp() in a c:/private/<uid3>/ will result in *platsec* error at fileserver (requires AllFiles capability)
    // Also, trying to cd() to a nonexistent directory causes *platsec* error. This does not cause functional harm, but should
    // nevertheless be changed to use native Symbian methods to avoid unnecessary platsec warnings (as per qpluginloader.cpp).
    // Use native Symbian code to check for directory existence, because checking
    // for files from under non-existent protected dir like E:/private/<uid> using
    // QDir::exists causes platform security violations on most apps.
    QString nativePath = QDir::toNativeSeparators(dir.absolutePath());
    TPtrC ptr = TPtrC16(static_cast<const TUint16*>(nativePath.utf16()), nativePath.length());
    TUint attributes;
    TInt err = rfs.Att(ptr, attributes);
    if (err == KErrNone) {
        // yes, the directory exists.
        pathFound = true;
    }
    return pathFound;
}
bool XQCentralRepositoryUtilsPrivate::createKey(const XQCentralRepositorySettingsKey& key, const QVariant& value)
{
    CCentralRepositoryHandler* handler = m_settingsManagerPrivate.cenRepHandlerInstance(key.uid());

    if (handler)
    {
        switch (value.type())
        {
        case QVariant::Int:
        {
            m_settingsManagerPrivate.iError = handler->createKey(key.key(), value.toInt());
            break;
        }
        case QVariant::Double:
        {
            m_settingsManagerPrivate.iError = handler->createKey(key.key(), value.toDouble());
            break;
        }
        case QVariant::String:
        {
            m_settingsManagerPrivate.iError = handler->createKey(key.key(), TPtrC16(reinterpret_cast<const TUint16*>(value.toString().utf16())));
            break;
        }
        case QVariant::ByteArray:
        {
            m_settingsManagerPrivate.iError = handler->createKey(key.key(), TPtrC8((TUint8*)(value.toByteArray().constData())));
            break;
        }
        default:
        {
            m_settingsManagerPrivate.iError = KErrArgument;
            break;
        }
        }
    }
    else
    {
        m_settingsManagerPrivate.iError = XQSettingsManager::UnknownError;
    }
    return m_settingsManagerPrivate.iError == KErrNone;
}
Example #8
0
TPtrC16 CPresetList::MdcaPoint(TInt aIndex) const
	{
	const TPresetEle& ele = iArray[aIndex];
	return TPtrC16(*ele.iName);	
	}
Example #9
0
GLDEF_C TInt GetFullPath(TParse& aParse, const TText16* upath, RFs& aSession, TDes* aFileName)
//
// Parse a path of the form "[C:][\]AAA\..\.\BBB\xxx" where:
// .  indicates the current directory
// .. indicates move to the parent directory
// An optional "\" at the start of the path indicates the path is not relative to the current path,
// and is implied if the drive specifier is present
// If aFileName is non-NULL then the final component is a filename and should be copied into 
// the aFileName descriptor.
//
	{

	TInt r;
	TBuf<3> drive;
	TFileName nextBit;
	TText16 c=*upath;

	if (c && upath[1]==KDriveDelimiter) 
		{
		// drive name specified
		if (c==L'?')
			drive.Zero();			// use "?:" to mean scan across drives
		else
			{
			drive.Copy(TPtrC16(upath, 2));
			drive.UpperCase();
			}
		upath+=2;
		drive.Append(TChar(KPathDelimiter));	// enforce absoluteness
		}
	else
		{
		// no leading drive specifier
		drive.Zero();
		if (c==KPathDelimiter||c==L'/')
			{
			upath+=1;
			drive.Append(TChar(KPathDelimiter));
			}
		}
	r = aSession.Parse(drive, aParse);

	// upath now looks like a relative pathname, to be added onto
	// aParse a directory at a time. Note that '/' is not allowed in
	// EPOC32 file or directory names, so treat it as an alternative separator

	c=*upath;
	while (c && (r==KErrNone))
		{
		const TText16* ustart=upath;
		do 
			c=*upath++;
		while (c && c!=KPathDelimiter && c!=L'/');

		TInt len=(upath-ustart)-1;		// excludes delimiter
		if (len==0)
			continue;
		if (ustart[0]==L'.')
			{
			if (len==1)
				continue;	// directory . ignored
			if (len==2 && ustart[1]==L'.')
				{
				// directory ..
				(void) aParse.PopDir();	// just stick at root dir, no errors
				continue;
				}
			}
		if (len>=KMaxFileName)
			return ENAMETOOLONG;
		if (c==L'\0' && aFileName!=NULL)
			{
			// it's the trailing filename
			aFileName->Copy(TPtrC16(ustart, len));
			break;
			}
		else	
			{
			// it's a component of the accumulating path
			nextBit.Copy(TPtrC16(ustart, len));
			r = aParse.AddDir(nextBit);
			}
		}
	return(r);
	}
TPtrC S60MediaRecognizer::QString2TPtrC( const QString& string )
{
    // Returned TPtrC is valid as long as the given parameter is valid and unmodified
    return TPtrC16(static_cast<const TUint16*>(string.utf16()), string.length());
}