当前位置: 首页>>代码示例>>C++>>正文


C++ TDesC8::Mid方法代码示例

本文整理汇总了C++中TDesC8::Mid方法的典型用法代码示例。如果您正苦于以下问题:C++ TDesC8::Mid方法的具体用法?C++ TDesC8::Mid怎么用?C++ TDesC8::Mid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TDesC8的用法示例。


在下文中一共展示了TDesC8::Mid方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: httpCreateConnectionLC

//returns >0 or CONNERR.
int Syscall::httpCreateConnectionLC(const TDesC8& parturl, CHttpConnection*& conn,
	int method, SocketType socketType)
{
	int port_m1_index = parturl.Locate(':');
	int path_index = parturl.Locate('/');
	if(path_index == KErrNotFound) {
		return CONNERR_URL;
	}
	if(port_m1_index > path_index) {
		port_m1_index = KErrNotFound;
	}
	TPtrC8 path(parturl.Mid(path_index));
	int hostname_length;
	TUint16 port;
	if(port_m1_index == KErrNotFound) {
		port = (socketType == SSL) ? 443 : 80;
		hostname_length = path_index;
	} else {
		TLex8 portLex(parturl.Mid(port_m1_index + 1, path_index - (port_m1_index + 1)));
		hostname_length = port_m1_index;
		if(portLex.Val(port, EDecimal) != KErrNone) {
			return CONNERR_URL;
		}
	}
	TPtrC8 hostname(parturl.Left(hostname_length));
	conn = new (ELeave) CHttpConnection(createSocket(socketType), method, port, gHttpStringPool);
	CleanupStack::PushL(conn);
	conn->ConstructL(hostname, path);
	return 1;
}
开发者ID:Felard,项目名称:MoSync,代码行数:31,代码来源:netImpl.cpp

示例2: LogLit

// ------------------------------------------------
// LogLit
// ------------------------------------------------
//
void CMdSLogger::LogLit( const TDesC8& aText )
    {
    if (!iValid)
    	{
    	return;
    	}

    TInt offset = 0;
    TInt linecount = 0;
    TInt length = aText.Length();
    while( offset < length )
        {
        TInt partLength = Min( length-offset, KLineLength );
#ifdef MDE_FILE_LOGGING
        iLog.Write( aText.Mid( offset, partLength ) );
#else
        TBuf<KLineLength> buffer;
        buffer.Copy( aText.Mid( offset, partLength ) );
        RDebug::Print( buffer );
#endif
        ++linecount;
        offset += partLength;
        }
    CheckSize( linecount );
    }
开发者ID:cdaffara,项目名称:symbiandump-mw2,代码行数:29,代码来源:mdslogger.cpp

示例3: ExtractEnumeratorComponentsL

LOCAL_C void ExtractEnumeratorComponentsL(
    const TDesC8& aMessageBuffer,
    TDes8& aStore,
    TDes8& aNamespace,
    TDes8& aHashKey )
    {
    TInt len;
    TInt offset;
    TInt total = aMessageBuffer.Length();

	offset = 0;
	len = aMessageBuffer[offset];
	if ( len <= 0 || len > KMaxWmDrmStoreNameSize || offset + len + 1> total )
	    {
	    User::Leave( KErrArgument );
	    }
    aStore.Copy( aMessageBuffer.Mid( offset + 1, len ) );
    
    offset += len + 1;
    if ( offset >= total )
        {
        User::Leave( KErrArgument );
        }
	len = aMessageBuffer[offset];
	if ( len <= 0 || len > KMaxWmDrmNamespaceNameSize || offset + len + 1 > total )
	    {
	    User::Leave( KErrArgument );
	    }
	aNamespace.Copy( aMessageBuffer.Mid( offset + 1, len ) );
	    
    offset += len + 1;
	len = aMessageBuffer[offset];
    if ( offset >= total )
        {
        User::Leave( KErrArgument );
        }
	if ( ( len > 0 && len != KWmDrmIdSize ) || offset + len + 1 > total )
	    {
	    User::Leave( KErrArgument );
	    }
	else if ( len > 0 )
	    {
	    aHashKey.Copy( aMessageBuffer.Mid( offset + 1, len ) );
	    }
	else
	    {
	    aHashKey.SetLength( 0 );
	    }
    }
开发者ID:kuailexs,项目名称:symbiandump-mw1,代码行数:49,代码来源:enumerator.cpp

示例4: generatedFirstPartOfEucJpPacked

/**
@SYMTestCaseID          SYSLIB-CHARCONV-CT-0536
@SYMTestCaseDesc        Splitting and converting from Unicode to EucJpPacked test
@SYMTestPriority        Medium
@SYMTestActions         Tests for conversion after splitting, from Unicode to EucJpPacked and back to Unicode
@SYMTestExpectedResults Test must not fail
@SYMREQ                 REQ0000
*/
void CT_EUCJP_PACKED_2::TestSplittingConvertingFromUnicodeToEucJpPacked(CCnvCharacterSetConverter& aCharacterSetConverter, TInt aMaximumLengthLowerLimit, TInt aMaximumLengthUpperLimit, TInt aExpectedNumberOfUnicodeCharactersNotConvertedAtSplit, TInt aExpectedLengthOfFirstPartOfEucJpPacked, const TDesC8& aExpectedEucJpPacked, const TDesC16& aOriginalUnicode)
	{
	INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-CHARCONV-CT-0536 "));
	test(aMaximumLengthLowerLimit<=aMaximumLengthUpperLimit);
	test(aMaximumLengthUpperLimit<=KBufferLength);
	TUint8 eucJpPackedBuffer[KBufferLength];
	for (TInt i=aMaximumLengthLowerLimit; i<=aMaximumLengthUpperLimit; ++i)
		{
		TPtr8 generatedFirstPartOfEucJpPacked(eucJpPackedBuffer, i);
		test(aCharacterSetConverter.ConvertFromUnicode(generatedFirstPartOfEucJpPacked, aOriginalUnicode)==aExpectedNumberOfUnicodeCharactersNotConvertedAtSplit);
		test(generatedFirstPartOfEucJpPacked==aExpectedEucJpPacked.Left(aExpectedLengthOfFirstPartOfEucJpPacked));
		TBuf8<KBufferLength> generatedSecondPartOfEucJpPacked;
		test(aCharacterSetConverter.ConvertFromUnicode(generatedSecondPartOfEucJpPacked, aOriginalUnicode.Right(aExpectedNumberOfUnicodeCharactersNotConvertedAtSplit))==0);
		test(generatedSecondPartOfEucJpPacked==aExpectedEucJpPacked.Mid(aExpectedLengthOfFirstPartOfEucJpPacked));
		TInt state=CCnvCharacterSetConverter::KStateDefault;
		TBuf16<KBufferLength> generatedUnicode;
		test(aCharacterSetConverter.ConvertToUnicode(generatedUnicode, generatedFirstPartOfEucJpPacked, state)==0);
		test(state==CCnvCharacterSetConverter::KStateDefault);
		TBuf16<KBufferLength> generatedSecondPartOfUnicode;
		test(aCharacterSetConverter.ConvertToUnicode(generatedSecondPartOfUnicode, generatedSecondPartOfEucJpPacked, state)==0);
		test(state==CCnvCharacterSetConverter::KStateDefault);
		generatedUnicode.Append(generatedSecondPartOfUnicode);
		test(generatedUnicode==aOriginalUnicode);
		}
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:33,代码来源:t_eucjp_packed_2.cpp

示例5: PrintHex

EXPORT_C void CTestUtils::PrintHex(const TDesC8& aDes)
	{
	TBuf<256> temp;
	TInt pos = 0;
	const TInt len = aDes.Length();

	while (pos < len)
		{
		temp.Zero();
		TPtrC8 ptr = aDes.Mid(pos, Min(KNumberOfHex, len - pos));
		const TInt ptrLen = ptr.Length();

		for (TInt i = 0; i < ptrLen; i++)
			{
			temp.AppendFormat(_L("%2.2x "), ptr[i]);
			}

		if (ptrLen < KNumberOfHex)
			{
			temp.AppendFill(' ', (KNumberOfHex - ptrLen) * 3);
			}

		TBuf<KNumberOfHex> buf16;
		buf16.Copy(ptr);
		temp.Append(buf16);
		Printf(temp);

		pos += KNumberOfHex;
		}
	}
开发者ID:cdaffara,项目名称:symbiandump-mw2,代码行数:30,代码来源:MsvTestUtilsBase.cpp

示例6: ReadAssignment

TInt CVBookmarkConverter::ReadAssignment( const TDesC8& aBuffer,
    TInt& aPosition, TPtrC8& aTag, TPtrC8& aValue )
    {
    LOGGER_ENTERFN( "CVBookmarkConverter::ReadAssignment" );    
        
    TPtrC8 start = aBuffer.Mid( aPosition );
    TInt assignment = start.Find( KVBMKAssignment );
    TInt linefeed = start.Find( KVBMKLinefeed );
    
    // Did we find the delimeter and the linefeed
    if ( ( assignment == KErrNotFound) || ( linefeed == KErrNotFound ) )
        {
        return KErrNotFound;
        }
    // Linefeed must reside behind the delimeter
    if ( linefeed <= assignment )
        {
        return KErrNotFound;
        }
    // Extract tag
    aTag.Set( start.Left( assignment ) );
    IgnoreSpaces( aTag );

    // Extract value
    aValue.Set( start.Mid( assignment + 1, ( linefeed - 1 ) - assignment ) );
    IgnoreSpaces( aValue );
    
    // update position
    aPosition += ( linefeed + KVBMKLinefeed().Length() );

    LOGGER_LEAVEFN( "CVBookmarkConverter::ReadAssignment" );        
    return KErrNone;
    }
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:33,代码来源:vbookmarkconverter.cpp

示例7: ValueWithoutQuotes

// -----------------------------------------------------------------------------
// SIPCodecUtils::ValueWithoutQuotes
// -----------------------------------------------------------------------------
//
TInt SIPCodecUtils::ValueWithoutQuotes(
    const TDesC8& aValue,
    TPtrC8& aWithoutQuotes)
    {
    if (aValue.Length() > 0)
        {
        TLex8 lex(aValue);
        lex.SkipSpace();
        if (lex.Get() == '"')
            {
            // Remove first quote
            TPtrC8 remainder(aValue.Mid(1));
            // Ensure that ending quote exists.
            if(remainder.LocateReverse('"') != (remainder.Length()-1))
                {
                return KErrArgument;
                }
	        aWithoutQuotes.Set(remainder.Left(remainder.Length()-1));
            }
        else
            {
            return KErrArgument;
            }
        }
    return KErrNone;
    }
开发者ID:kuailexs,项目名称:symbiandump-mw1,代码行数:30,代码来源:SIPCodecUtils.cpp

示例8: ProcessLicenseResponse

// ----------------------------------------------------------------------------
// CWmDrmDlaParser::ProcessLicenseResponse
// ----------------------------------------------------------------------------
//
TInt CWmDrmDlaParser::ProcessLicenseResponse(
    const TDesC8& aLicenseResponse,
    HBufC8*& aTID,
    HBufC8*& aContentURL)
    {
    TInt error = KErrNone;
    
    LOGFNR( "CWmDrmDlaParser::ProcessLicenseResponse", error );
    
    // Find beginning of XML document ('<')
    TInt pos = aLicenseResponse.Locate( '<' );
    if ( pos != KErrNotFound )
      {
      iContentUrl = &aContentURL;
      iTID = &aTID;
      iErrorCode = KErrNone;
      TPtrC8 ptrUrl = aLicenseResponse.Mid( pos );
      TRAP( error, Xml::ParseL( *iParser, ptrUrl ) );
      if ( !error )
        {
        error = iErrorCode;
        }

      iTID = NULL;
      iContentUrl = NULL;

      delete iServerUrl;
      iServerUrl = NULL;
      }
    else
      {
      error = KErrCorrupt;
      }
    return error;
    }
开发者ID:kuailexs,项目名称:symbiandump-mw1,代码行数:39,代码来源:wmdrmdlaparser.cpp

示例9: RemoveSIPSchemaL

// ----------------------------------------------------------------------------
// CSIPProfileSIMRecord::FindSIPSchema
// ----------------------------------------------------------------------------
//
TPtrC8 CSIPProfileSIMRecord::RemoveSIPSchemaL( const TDesC8& aValue )
    {
    __ASSERT_ALWAYS (aValue.Length() > 0, User::Leave(KErrArgument));

	_LIT8(KSIPAndColon, "sip:");
	_LIT8(KSIPSAndColon, "sips:");

	TPtrC8 schemeAndColon;
	TInt sipSchemePos = aValue.FindF(KSIPAndColon);
	if (sipSchemePos < 0)
		{
		TInt sipsSchemePos = aValue.FindF(KSIPSAndColon);
		if (sipsSchemePos != 0) 
            {
            User::Leave (KErrArgument);
            }
		schemeAndColon.Set(KSIPSAndColon);
		}
	else
		{
		if (sipSchemePos != 0) 
            {
            User::Leave (KErrArgument);
            }
		schemeAndColon.Set(KSIPAndColon);
		}
	TPtrC8 remainder(aValue.Mid(schemeAndColon.Length()));
	return remainder;
    }    
开发者ID:kuailexs,项目名称:symbiandump-mw1,代码行数:33,代码来源:Sipimsprofilesimrecord.cpp

示例10: DoRecognizeL

void CApaDRMRecognizer::DoRecognizeL( const TDesC& aName, const TDesC8& aBuffer )
{
    if ( aBuffer.Size() < 3)
        {
        return;
        }

#ifdef RECOGNIZE_KEY_CHAIN
    // Recognize device key chain
    if ( aName.Length() > 3 && aName.Right(4).CompareF(_L(".dkc")) == 0)
        {
        iConfidence = ECertain;
        iDataType = TDataType( _L8("application/x-device-key-chain") );
        return;
        }
#endif

#ifdef DRM_OMA2_ENABLED
    // Recognize ROAP Trigger
    if ( RecognizeRoapTrigger( aBuffer ) )
        {
        return;
        }

    // Recognize DCFv2
    if ( RecognizeODF( aBuffer ) )
        {
        return;
        }
#endif
    // Recognize DCFv1
    TUint8 version = aBuffer[0];
    TUint8 contentTypeLen = aBuffer[1];
    TUint8 contentURILen = aBuffer[2];

    if ( contentTypeLen < KMinContentTypeLen || contentURILen == 0 )
    {
        return;
    }
    if ( version != KDCFVersionSupported )
    {
        return;
    }

    // Too little data received
    if ( aBuffer.Size() < ( contentTypeLen + KDCFHeaderLength ) )
    {
        return;
    }

    TPtrC8 mimeType = aBuffer.Mid( KDCFHeaderLength, contentTypeLen );
    if ( mimeType.Locate( '/' ) != KErrNotFound )
    {
        iConfidence = ECertain;
        iDataType=TDataType( mimeType );
    }


    return;
}
开发者ID:kuailexs,项目名称:symbiandump-mw1,代码行数:60,代码来源:RecDRM.cpp

示例11: ConstructL

// ----------------------------------------------------------
// CSimplePresenceList::ConstructL
// ----------------------------------------------------------
//
void CSimplePresenceList::ConstructL(
  const TDesC8& aData, const TDesC8& aBoundary, const TDesC8& aStart )
    {       
    _LIT(KUrl, "http://dummy.com/d1/d.html");
           
    // body part array
    RPointerArray<CBodyPart> bodyPartArray;
    // Cleanup-routine
    TCleanupItem clItem( ResetAndDestroy, &bodyPartArray  );
    CleanupStack::PushL( clItem );
    
    // remove "..." characters from boundary if needed
    TPtrC8 pUnQuoted = aBoundary;
    TInt quoted = aBoundary.Locate('"');
    if (!quoted)
        {
        pUnQuoted.Set( aBoundary.Mid( 1, aBoundary.Length() - 2 ));
        } 
        
            
    // parse
    MultipartParser::ParseL( aData, KSimpleMultipartType, pUnQuoted, KUrl, bodyPartArray  );    
    DoConstructL( bodyPartArray, aStart );
   
    CleanupStack::PopAndDestroy( ); // bodyPartArray 
    }
开发者ID:cdaffara,项目名称:symbiandump-mw2,代码行数:30,代码来源:simplepresencelist.cpp

示例12: Write

// ==========================================================================
// METHOD:  Write
//
// DESIGN:  Write the given buffer.  Chunk the string if it is longer than
//          KDebugLogBufferSize. 
// ==========================================================================
void CLogFileHandler::Write( const TDesC8& aClassName,
                             const TDesC8& aFuncName,
                             const TDesC8& aDes )
    {
    TRAP_IGNORE( AddTimestampToOutputBufferL() );
        
    TInt prefixLength = iOutputBuffer.Length();
        
    TRAP_IGNORE( AddClassAndFunctionToOutputBufferL( aClassName, aFuncName ) );
            
    TInt curPos = 0;
    
	while( curPos < aDes.Length() )
    	{
        TInt lengthToWrite = Min( KMaxTextPerLine - iOutputBuffer.Length(), aDes.Length() - curPos );        

    	TRAP_IGNORE( WriteLineL( aDes.Mid( curPos, lengthToWrite ) ) );
		    
		iOutputBuffer.SetLength( prefixLength );
				    
		curPos += lengthToWrite;

    	} // end while

    } // END Write
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:31,代码来源:DebugLog.cpp

示例13: ParseLengthL

// -----------------------------------------------------------------------------
// CNATFWUNSAFAttribute::ParseLengthL
// -----------------------------------------------------------------------------
//
TUint16 CNATFWUNSAFAttribute::ParseLengthL(const TDesC8& aByteStream)
    {
    __ASSERT_ALWAYS(aByteStream.Length() >= EValueOffset,
                    User::Leave(KErrArgument));

    return BigEndian::Get16(aByteStream.Mid(ELengthOffset).Ptr());
    }
开发者ID:kuailexs,项目名称:symbiandump-mw1,代码行数:11,代码来源:natfwunsafattribute.cpp

示例14: ParseTypeAndLengthL

// -----------------------------------------------------------------------------
// CNATFWUNSAFAttribute::ParseTypeAndLengthL
// -----------------------------------------------------------------------------
//
void CNATFWUNSAFAttribute::ParseTypeAndLengthL(const TDesC8& aByteStream,
                                           TUint16& aType,
                                           TUint16& aTotalLength)
    {
    //Stream must have enough data to contain at least an attribute with
    //zero-length value
    __ASSERT_ALWAYS(aByteStream.Length() >= EValueOffset,
                    User::Leave(KErrArgument));

    TUint16 totalLength = ParseLengthL(aByteStream) + EValueOffset;

    //Increase total length if it's not a multiple of 4 bytes.
    //This is because of possible padding in text attributes not visible from
    //attribute length field.
    const TUint16 KGranularity = 4;
    TUint16 bytesInLastBlock = totalLength % KGranularity;
    TUint16 bytesPadded = KGranularity - bytesInLastBlock;
    if (0 < bytesInLastBlock )
        {
        totalLength += bytesPadded;
        }

    __ASSERT_ALWAYS(aByteStream.Length() >= totalLength,
                    User::Leave(KErrArgument));

    aTotalLength = totalLength;
    aType = BigEndian::Get16(aByteStream.Mid(ETypeOffset).Ptr());
    }
开发者ID:kuailexs,项目名称:symbiandump-mw1,代码行数:32,代码来源:natfwunsafattribute.cpp

示例15: HandleGetArtistResponse

/**
Extracts the artist from the 'get artist' response data and calls 
the relevant mixin function on the observer.	
	
@param The data passed with the response.
*/	
void CRemConTrackInfoController::HandleGetArtistResponse(TInt aError, const TDesC8& aData)
	{
	LOG_FUNC

	TPckgBuf<TName> buf;
	buf.Copy((aData.Mid(KRemConExtApi1ResultDataLength)));
	iObserver.MrcticoGetArtistResponse(aError, buf());
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:14,代码来源:trackinfocontroller.cpp


注:本文中的TDesC8::Mid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。