本文整理汇总了C++中VString::Find方法的典型用法代码示例。如果您正苦于以下问题:C++ VString::Find方法的具体用法?C++ VString::Find怎么用?C++ VString::Find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VString
的用法示例。
在下文中一共展示了VString::Find方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
//.........这里部分代码省略.........
示例2: ProceedCatalog
VError VArchiveUnStream::ProceedCatalog()
{
VError result = VE_OK;
VStr8 dotSlash("./");
VStr8 slash("/");
VStr8 extra("::");
VStr8 folderSep(XBOX::FOLDER_SEPARATOR);
if ( fStream->GetLong() == 'FPBK' )
{
VString filePath;
VString fileExtra;
VString storedPath;
uLONG kind = 0;
uLONG creator = 0;
sLONG8 dataFileSize = 0;
sLONG8 resFileSize = 0;
uBYTE version = fStream->GetByte();
uLONG8 fileCount = fStream->GetLong8();
fTotalByteCount = 0;
if ( fStream->GetLong() == 'LIST' )
{
for ( uLONG i = 0; i < fileCount && result == VE_OK; i++ )
{
if ( fStream->GetLong() == 'file' )
{
result = filePath.ReadFromStream(fStream);
if ( result == VE_OK )
{
VIndex index = filePath.Find(extra);
fileExtra = filePath;
fileExtra.Remove(1,index+1);
filePath.Remove(index,filePath.GetLength()-index+1);
storedPath = filePath;
if ( filePath.Find( dotSlash ) > 0 )
{
// some archives have bogous file paths such as ./Z:/folder
filePath.Exchange( (UniChar) ':', (UniChar) '_');
filePath.Replace(fDestinationFolder.GetPath(),1,2);
}
filePath.Exchange(slash ,folderSep, 1, 255);
dataFileSize = fStream->GetLong8();
fTotalByteCount += dataFileSize;
resFileSize = fStream->GetLong8();
fTotalByteCount += resFileSize;
kind = fStream->GetLong();
creator = fStream->GetLong();
VFile *file = new VFile(filePath);
fFileCatalog.push_back(new VArchiveCatalog(file,dataFileSize,resFileSize,storedPath,fileExtra,kind,creator));
ReleaseRefCountable( &file);
}
}
else
result = VE_STREAM_BAD_SIGNATURE;
}
}
else
result = VE_STREAM_BAD_SIGNATURE;
}
return result;
}
示例3: ParseSpanText
/** parse span text element or XHTML fragment
@param inTaggedText
tagged text to parse (span element text only if inParseSpanOnly == true, XHTML fragment otherwise)
@param outStyles
parsed styles
@param outPlainText
parsed plain text
@param inParseSpanOnly
true (default): only <span> element(s) with CSS styles are parsed
false: all XHTML text fragment is parsed (parse also mandatory HTML text styles)
*/
void VSpanTextParser::ParseSpanText( const VString& inTaggedText, VTreeTextStyle*& outStyles, VString& outPlainText, bool inParseSpanOnly)
{
outPlainText = "";
if(outStyles)
outStyles->Release();
outStyles = NULL;
if (inTaggedText.IsEmpty())
return;
//fixed ACI0076343: for compatibility with older bases which do not have support for multistyle var or field
// we need to convert to xml text the text which is not bracketed with SPAN
// otherwise parser would fail
VString vtext;
sLONG posStartSPAN = 1; //pos of first SPAN tag
sLONG posEndSPAN = inTaggedText.GetLength()+1; //pos of character following ending SPAN tag
if (inParseSpanOnly)
{
//search for opening SPAN tag
posStartSPAN = inTaggedText.Find("<SPAN", 1, false);
if (!posStartSPAN)
{
//convert full text to xml
inTaggedText.GetXMLString( vtext, XSO_Default);
vtext = VString("<SPAN>")+vtext+"</SPAN>";
}
else
{
VString before, after;
if (posStartSPAN > 1)
{
//convert to XML text preceeding first SPAN
VString temp;
inTaggedText.GetSubString( 1, posStartSPAN-1, temp);
temp.GetXMLString( before, XSO_Default);
}
//search for ending SPAN tag
const UniChar *c = inTaggedText.GetCPointer()+inTaggedText.GetLength()-1;
sLONG pos = inTaggedText.GetLength()-1;
VString spanEndTag = "</SPAN>";
VString spanEndTag2 = "</span>";
do
{
while (pos >= 0 && *c != '>')
{
pos--;
if (pos >= 0)
c--;
}
if (pos >= 0)
{
if (memcmp( (void*)(c+1-spanEndTag.GetLength()), spanEndTag.GetCPointer(), spanEndTag.GetLength()*sizeof(UniChar)) == 0
||
memcmp( (void*)(c+1-spanEndTag2.GetLength()), spanEndTag2.GetCPointer(), spanEndTag2.GetLength()*sizeof(UniChar)) == 0)
{
posEndSPAN = pos+2;
break;
}
else
{
pos--;
if (pos >= 0)
c--;
}
}
} while (pos >= 0);
if (posEndSPAN <= inTaggedText.GetLength())
{
//convert to XML text following ending SPAN tag
VString temp;
inTaggedText.GetSubString( posEndSPAN, inTaggedText.GetLength()-posEndSPAN+1, temp);
temp.GetXMLString( after, XSO_Default);
}
if (!before.IsEmpty() || !after.IsEmpty())
{
inTaggedText.GetSubString( posStartSPAN, posEndSPAN-posStartSPAN, vtext);
vtext = VString("<SPAN>")+before+vtext+after+"</SPAN>";
}
else
vtext = VString("<SPAN>")+inTaggedText+"</SPAN>";
}
}
else
vtext = inTaggedText;
vtext.ExchangeAll(0x0B,0x0D);//[MI] le 28/12/2010 ACI0069253
#if VERSIONWIN
vtext.ConvertCarriageReturns(eCRM_CR); //important here on Windows before parsing because styles are assumed to use one character size for line ending on any platform
//and so pair of 0x0D 0x0A should be treated as a single 0x0D character
#endif
VTaggedTextSAXHandler vsaxhandler(outStyles, &outPlainText, inParseSpanOnly);
//.........这里部分代码省略.........