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


C++ VString::BeginsWith方法代码示例

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


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

示例1: ConsumeMultiLineComment

bool HTMLLexer::ConsumeMultiLineComment( TokenList *ioTokens, sLONG inType )
{
	// We have to override the default behavior for multiline comment consumption because we define
	// a bunch of "special" comment types for 4D.  So we will let the default consumer do its job, but
	// we will look at the comment that was consumed afterwards to see if we have a special comment
	// type.  If we do, we need only modify the token's type accordingly.
	bool ret = VLexerBase::ConsumeMultiLineComment( ioTokens, inType );

	// Look at the last token in the list (it should be a comment or an open comment), and grab its text
	ILexerToken *token = ioTokens->back();
	xbox_assert( token->GetType() == ILexerToken::TT_COMMENT || token->GetType() == ILexerToken::TT_OPEN_COMMENT );

	// For right now, we only care about finished comments because it makes the logic easier.  We don't have to
	// worry so much about handling the syntax highlighting aspects of things.
	VString tokenText = token->GetText();
	if (token->GetType() == ILexerToken::TT_COMMENT && tokenText.BeginsWith( CVSTR( "<!--#4D" ) )) {
		// We probably have one of the special comment types.  We're going to remove the old token and create a new
		// one with the appropriate information, but only after we've verified that this isn't just garbage!
		if (tokenText.BeginsWith( CVSTR( "<!--#4DVAR" ) ) ||
			tokenText.BeginsWith( CVSTR( "<!--#4DHTMLVAR" ) ) ||
			tokenText.BeginsWith( CVSTR( "<!--#4DINCLUDE" ) ) ||
			tokenText.BeginsWith( CVSTR( "<!--#4DACTION" ) ) ||
			tokenText.BeginsWith( CVSTR( "<!--#4DSCRIPT" ) ) ||
			tokenText.BeginsWith( CVSTR( "<!--#4DMETHOD" ) ) ||
			tokenText.BeginsWith( CVSTR( "<!--#4DIF" ) ) ||
			tokenText.BeginsWith( CVSTR( "<!--#4DELSE" ) ) ||
			tokenText.BeginsWith( CVSTR( "<!--#4DENDIF" ) ) ||
			tokenText.BeginsWith( CVSTR( "<!--#4DLOOP" ) ) ||
			tokenText.BeginsWith( CVSTR( "<!--#4DENDLOOP" ) )) {
				ioTokens->pop_back();
				ioTokens->push_back( new HTMLLexerToken( ILexerToken::TT_SPECIAL_4D_COMMENT, token->GetPosition(), token->GetLength(), tokenText, token->GetValue() ) );
		}
	}

	return ret;
}
开发者ID:StephaneH,项目名称:core-Components,代码行数:36,代码来源:HTMLLexer.cpp

示例2: GetRelativeURL

VError VFolder::GetRelativeURL(VFolder* inBaseFolder, VString& outURL, bool inEncoded)
{
	VString folderURL;
	VError err = GetURL(outURL, inEncoded);
	if (inBaseFolder != NULL)
	{
		inBaseFolder->GetURL(folderURL, inEncoded);
		if (outURL.BeginsWith(folderURL))
		{
			outURL.Remove(1, folderURL.GetLength());
		}

	}
	return err;
}
开发者ID:sanyaade-webdev,项目名称:core-XToolbox,代码行数:15,代码来源:VFolder.cpp

示例3: SwapComment

void VHTMLSyntax::SwapComment( ICodeEditorDocument* inDocument, VString& ioString, bool inComment )
{
	if ( inComment )
	{
		ioString.Insert( CVSTR( "<!--" ), 1 );
		ioString += CVSTR( "-->" );
	}
	else
	{
		if ( ioString.BeginsWith( CVSTR( "<!--" ) ) )
			ioString.Remove( 1, 4 );

		if ( ioString.EndsWith( CVSTR( "-->" ) ) )
			ioString.Truncate( ioString.GetLength() - 3 );
	}
}
开发者ID:sanyaade-webdev,项目名称:core-Components,代码行数:16,代码来源:HTMLSyntax.cpp

示例4: ColorToValue

void ColorToValue(const RGBAColor inColor, VString& outValue)
{
	outValue.FromHexLong(inColor);
	sLONG len = outValue.GetLength();
	//ignorer le canal alpha
	if(len==8 && outValue.BeginsWith("FF"))
	{
		outValue.Replace("",1,2);
	}

	for(int i=0; i < 6-len;i++)
	{
		outValue = "0" + outValue;
	}

	outValue = "#" + outValue;
}
开发者ID:sanyaade-mobiledev,项目名称:core-XToolbox,代码行数:17,代码来源:VSpanText.cpp

示例5: lNamespaceKey

	virtual	VError HandleRequest( IHTTPResponse* inResponse)
			{
				if (inResponse == NULL)
					return VE_INVALID_PARAMETER;

				VError err = VE_OK;
				bool done = false;

				// First, extract the relative path from the url
				VString path = inResponse->GetRequest().GetURLPath();
				VRegexMatcher *matcher = VRegexMatcher::Create( fPattern, &err);
				if ((matcher != NULL) && (err == VE_OK))
				{
					bool match = matcher->Find( path, 1, false, &err);
					if (match && (err == VE_OK))
					{
						// Remove the pattern from the path
						path.Remove( matcher->GetGroupStart(0), matcher->GetGroupLength(0));

						// Check whether a namespace is specified
						VString lNamespaceKey( L"namespace=");
						VString lNamespace = inResponse->GetRequest().GetURLQuery();
						if (lNamespace.BeginsWith( lNamespaceKey))
							lNamespace.Remove( 1, lNamespaceKey.GetLength());
						else
							lNamespace.Clear();

						// Now, we have a relative  module path
						VString proxy;
						err = fService->GetProxy( proxy, path, lNamespace, &inResponse->GetRequest(), inResponse);
						if (err == VE_OK)
						{
							VString contentType( L"application/javascript");
							err = SetHTTPResponseString( inResponse, proxy, &contentType);
							done = true;
						}
					}
				}
				ReleaseRefCountable( &matcher);

				if (!done)
					err = inResponse->ReplyWithStatusCode( HTTP_NOT_FOUND);

				return err;
			}
开发者ID:StephaneH,项目名称:core-Wakanda,代码行数:45,代码来源:VRPCService.cpp

示例6: GetProxy

XBOX::VError VRPCService::GetProxy( XBOX::VString& outProxy, const XBOX::VString& inModulePath, const XBOX::VString& inNamespace, const IHTTPRequest* inRequest, IHTTPResponse* inResponse)
{
	VError err = VE_OK;

	outProxy.Clear();

	if (fApplication != NULL)
	{
		VRIAContext *riaContext = fApplication->RetainNewContext( err);
		if (err == VE_OK)
		{
			VRPCCatalog *catalog = fApplication->RetainRPCCatalog( riaContext, &err, inRequest, inResponse);
			if (err == VE_OK)
			{
				if (catalog != NULL)
				{
					MapOfRPCSchema schemas;

					err = catalog->RetainSchemasByModule( inModulePath, schemas);
					if (err == VE_OK)
					{
						// Build the proxy
						VFile *bodyFile = NULL, *templateFile = NULL;
						VFilePath path;

						VRIAServerApplication::Get()->GetWAFrameworkFolderPath( path);
						path.ToSubFolder( L"Core").ToSubFolder( L"Runtime").ToSubFolder( L"rpcService");
						path.SetFileName( L"proxy-body.js", true);

						bodyFile = new VFile( path);
						if (bodyFile == NULL)
							err = vThrowError( VE_MEMORY_FULL);
						
						if (err == VE_OK)
						{
							path.SetFileName( L"proxy-template.js", true);
							templateFile = new VFile( path);
							if (templateFile == NULL)
								err = vThrowError( VE_MEMORY_FULL);
						}
						
						if (err == VE_OK && bodyFile->Exists() && templateFile->Exists())
						{
							VString templateString;
							VFileStream bodyStream( bodyFile);
							VFileStream templateStream( templateFile);
							
							err = bodyStream.OpenReading();
							if (err == VE_OK)
								templateStream.OpenReading();
							if (err == VE_OK)
								err = bodyStream.GetText( outProxy);
							if (err == VE_OK)
							{
								VValueBag bag;
								bag.SetString( L"rpc-pattern", fPatternForMethods);
								bag.SetString( L"publishInGlobalNamespace", (fPublishInClientGlobalNamespace) ? L"true" : L"false");
								outProxy.Format( &bag);
							}
							if (err == VE_OK)
								err = templateStream.GetText( templateString);
							if (err == VE_OK)
							{
								if (templateString.BeginsWith( L"/*"))
								{
									// sc 28/08/2014, remove the copyright
									VIndex end = templateString.Find( L"*/");
									if (end > 0)
									{
										templateString.Remove( 1, end + 1);
									}
								}

								for (MapOfRPCSchema::const_iterator iter = schemas.begin() ; iter != schemas.end() ; ++iter)
								{
									VValueBag bag;
									bag.SetString( L"function-name", iter->first.GetMethodName());
									bag.SetString( L"namespace", inNamespace);
									bag.SetString( L"modulePath", inModulePath);
									VString proxy( templateString);
									proxy.Format( &bag);
									outProxy.AppendString( proxy);
								}
							}

							bodyStream.CloseReading();
							templateStream.CloseReading();
						}
						else
						{
							err = vThrowError( VE_FILE_NOT_FOUND);
						}

						QuickReleaseRefCountable( bodyFile);
						QuickReleaseRefCountable( templateFile);
					}
				}
				else
				{
					err = vThrowError( VE_RIA_RPC_CATALOG_NOT_FOUND);
//.........这里部分代码省略.........
开发者ID:StephaneH,项目名称:core-Wakanda,代码行数:101,代码来源:VRPCService.cpp

示例7: GenerateSpanText


//.........这里部分代码省略.........
				outTaggedText += ":"+ value;
				addcoma = true;
			}
		}

		if(addforecolortag)
		{
			VString value;
			if(addcoma)
				outTaggedText+=";";
			ColorToValue(vforecolor,value);
			outTaggedText += MS_COLOR;
			outTaggedText += ":"+ value;
			addcoma = true;
		}

		if(addbackcolortag)
		{
			VString value;
			if(addcoma)
				outTaggedText+=";";
			ColorToValue(vbackcolor,value);
			outTaggedText += MS_BACKGROUND;
			outTaggedText += ":"+ value;
			addcoma = true;
		}

		outTaggedText +="\">";				

	}

	
	VString text;
	VString tmp;

	sLONG count = inStyles.GetChildCount();

	//prevent assert in GetSubString
	if (end > inPlainText.GetLength())
		end = inPlainText.GetLength();
	if (begin > inPlainText.GetLength())
		begin = inPlainText.GetLength();

	if(count == 0)
	{
		if(end>begin)
		{
			inPlainText.GetSubString(begin+1, end-begin, text);
			ToXMLCompatibleText(text, tmp);
			outTaggedText += tmp;
		}
	}
	else
	{
		sLONG start = begin;
		for(sLONG i = 1; i <= count; i++)
		{
			VTreeTextStyle* child = inStyles.GetNthChild(i);
			sLONG b,e;
			child->GetData()->GetRange(b,e);

			//prevent assert in GetSubString
			if (e > inPlainText.GetLength())
				e = inPlainText.GetLength();
			if (b > inPlainText.GetLength())
				b = inPlainText.GetLength();

			//if(start < b-1)
			if(start < b)
			{
				inPlainText.GetSubString(start+1, b-start, text);
				ToXMLCompatibleText(text, tmp);
				outTaggedText += tmp;
			}
			
			GenerateSpanText(*child, inPlainText, outTaggedText, defaultStyleInherit);
			start = e;
		}
		
		if(start < end)
		{
			inPlainText.GetSubString(start+1, end-start, text);
			ToXMLCompatibleText(text, tmp);
			outTaggedText += tmp;
		}

	}

	if (addtag)
		outTaggedText +="</SPAN>";
	//JQ 24/12/2012: ensure tagged text is bracketed with SPAN tag
	else if (isInitialEmpty)
	{
		if (!outTaggedText.BeginsWith(CVSTR("<SPAN"), true))
			outTaggedText = CVSTR("<SPAN>")+outTaggedText+CVSTR("</SPAN>");
	}

	if (defaultStyleInherit)
		delete defaultStyleInherit;
}
开发者ID:sanyaade-mobiledev,项目名称:core-XToolbox,代码行数:101,代码来源:VSpanText.cpp

示例8: IsComment

bool VHTMLSyntax::IsComment( ICodeEditorDocument* inDocument, const VString& inString )
{
	return inString.BeginsWith( CVSTR( "<!--" ) ) && inString.EndsWith( CVSTR( "-->" ) );
}
开发者ID:sanyaade-webdev,项目名称:core-Components,代码行数:4,代码来源:HTMLSyntax.cpp


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