本文整理汇总了C++中KString::Find方法的典型用法代码示例。如果您正苦于以下问题:C++ KString::Find方法的具体用法?C++ KString::Find怎么用?C++ KString::Find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KString
的用法示例。
在下文中一共展示了KString::Find方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SaveScene
bool SaveScene(KFbxSdkManager* pSdkManager, KFbxDocument* pScene, const char* pFilename, int pFileFormat, bool pEmbedMedia)
{
int lMajor, lMinor, lRevision;
bool lStatus = true;
// Create an exporter.
KFbxExporter* lExporter = KFbxExporter::Create(pSdkManager, "");
if( pFileFormat < 0 || pFileFormat >= pSdkManager->GetIOPluginRegistry()->GetWriterFormatCount() )
{
// Write in fall back format in less no ASCII format found
pFileFormat = pSdkManager->GetIOPluginRegistry()->GetNativeWriterFormat();
//Try to export in ASCII if possible
int lFormatIndex, lFormatCount = pSdkManager->GetIOPluginRegistry()->GetWriterFormatCount();
for (lFormatIndex=0; lFormatIndex<lFormatCount; lFormatIndex++)
{
if (pSdkManager->GetIOPluginRegistry()->WriterIsFBX(lFormatIndex))
{
KString lDesc =pSdkManager->GetIOPluginRegistry()->GetWriterFormatDescription(lFormatIndex);
char *lASCII = "ascii";
if (lDesc.Find(lASCII)>=0)
{
pFileFormat = lFormatIndex;
break;
}
}
}
}
// Set the export states. By default, the export states are always set to
// true except for the option eEXPORT_TEXTURE_AS_EMBEDDED. The code below
// shows how to change these states.
IOS_REF.SetBoolProp(EXP_FBX_MATERIAL, true);
IOS_REF.SetBoolProp(EXP_FBX_TEXTURE, true);
IOS_REF.SetBoolProp(EXP_FBX_EMBEDDED, pEmbedMedia);
IOS_REF.SetBoolProp(EXP_FBX_SHAPE, true);
IOS_REF.SetBoolProp(EXP_FBX_GOBO, true);
IOS_REF.SetBoolProp(EXP_FBX_ANIMATION, true);
IOS_REF.SetBoolProp(EXP_FBX_GLOBAL_SETTINGS, true);
// Initialize the exporter by providing a filename.
if(lExporter->Initialize(pFilename, pFileFormat, pSdkManager->GetIOSettings()) == false)
{
common->Warning("Call to KFbxExporter::Initialize() failed. Error returned: %s\n\n\n", lExporter->GetLastErrorString());
return false;
}
KFbxSdkManager::GetFileFormatVersion(lMajor, lMinor, lRevision);
common->Printf("FBX version number for this version of the FBX SDK is %d.%d.%d\n\n", lMajor, lMinor, lRevision);
// Export the scene.
lStatus = lExporter->Export(pScene);
// Destroy the exporter.
lExporter->Destroy();
return lStatus;
}
示例2: SplitString
// --------
// Strings
// --------
void KStrings::SplitString( const KString& String,
LPCTSTR pSplitter,
bool bAddEmpty,
bool bClearFirst)
{
if(bClearFirst)
Clear();
const size_t szSplitterLength = _tcslen(pSplitter);
size_t szPos = 0;
for(;;)
{
size_t szOldPos = szPos;
szPos = String.Find(pSplitter, szPos);
if(szPos == UINT_MAX)
{
if(bAddEmpty || szOldPos < String.GetLength())
*AddLast() = String.Mid(szOldPos);
break;
}
if(bAddEmpty || szPos > szOldPos)
*AddLast() = String.Mid(szOldPos, szPos - szOldPos), szPos += szSplitterLength;
}
}
示例3: ParseHTTPHeaderCommand
void ParseHTTPHeaderCommand(const KString& s,
THTTPHeaderCommand& RCommand)
{
int i = 0;
i = s.Find(TEXT(":"));
if(i == -1)
RCommand.m_Command = s, RCommand.m_Content = TEXT("");
else
RCommand.m_Command = s.Left(i), RCommand.m_Content = s.Mid(i + 1);
RCommand.m_Command = RCommand.m_Command.Trim();
RCommand.m_Content = RCommand.m_Content.Trim();
}
示例4: Process
// -------
// Tokens
// -------
KString TTokens::Process(const KString& String) const
{
KString DstString;
for(size_t szStart = 0 ; szStart < String.GetLength() ; )
{
// Scanning for the closest token starting at 'szStart'
const TToken* pClosestToken = NULL;
size_t szClosestTokenPos;
for(size_t i = 0 ; i < GetN() ; i++)
{
const TToken& CurToken = GetDataRef(i);
size_t szPos = String.Find(CurToken.m_SrcString, szStart);
if(szPos == UINT_MAX)
continue;
if( pClosestToken == NULL ||
szPos < szClosestTokenPos ||
szPos == szClosestTokenPos &&
CurToken.m_SrcString.GetLength() >
pClosestToken->m_SrcString.GetLength())
{
pClosestToken = &CurToken, szClosestTokenPos = szPos;
}
}
if(pClosestToken == NULL) // no more tokens found
{
DstString += String.Mid(szStart); // adding leftovers
break;
}
DstString += String.Mid(szStart, szClosestTokenPos - szStart); // adding pre-token part
DstString += pClosestToken->m_DstString; // adding token replacement
// Forwarding 'szStart' to the end of just substed token
szStart = szClosestTokenPos + pClosestToken->m_SrcString.GetLength();
}
return DstString;
}