本文整理汇总了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;
}
示例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;
}
示例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 );
}
}
示例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;
}
示例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;
}
示例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);
//.........这里部分代码省略.........
示例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;
}
示例8: IsComment
bool VHTMLSyntax::IsComment( ICodeEditorDocument* inDocument, const VString& inString )
{
return inString.BeginsWith( CVSTR( "<!--" ) ) && inString.EndsWith( CVSTR( "-->" ) );
}