本文整理汇总了C++中rString::find方法的典型用法代码示例。如果您正苦于以下问题:C++ rString::find方法的具体用法?C++ rString::find怎么用?C++ rString::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rString
的用法示例。
在下文中一共展示了rString::find方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Initialize
//+----------------------------------------------------------------------------+
//|bool Initialize(AudioEngine* engine, const rString &path, SoundType type)
//\----------------------------------------------------------------------------+
bool SoundSDL::Initialize(AudioEngine* engine, const rString &path, SoundType type)
{
AudioEngineSDL* audioEngine = reinterpret_cast<AudioEngineSDL*>(engine);
const SDL_AudioSpec* sysSpec = audioEngine->GetSystemSpec();
m_AudioEngine = audioEngine;
m_Type = type;
m_Name = path;
m_ChunkSize = sysSpec->size;
m_AudioCVT = pNew(SDL_AudioCVT);
m_BufferData = tNew(AudioBuffer);
m_AudioFile = nullptr;
///Check which file format the requested audiofile are
///Only wav and ogg are supported
///Is wave file
if(path.find(".wav", 0) != std::string::npos)
{
m_AudioFile = pNew(WavFileReader);
}
///Is ogg file
else if(path.find(".ogg", 0) != std::string::npos)
{
m_AudioFile = pNew(OggFileReader);
}
///Not supported format
else
{
fprintf(stderr, "SoundSDL. Trying to load unsupported file format %s \n", path.c_str());
return false;
}
m_AudioFile->Initialize();
///Read as sample, read everything into buffer
if(type == SoundType::SAMPLE)
{
CreateSample(path, m_BufferData, sysSpec);
}
///Read as stream, prepare for buffer streaming
else if(type == SoundType::STREAM)
{
CreateStream(path, m_BufferData, sysSpec);
}
else
{
///This should not happend..
fprintf(stderr, "SoundSDL. Unexpected error loading %s while setting sound type \n", path.c_str());
return false;
}
return true;
}
示例2: GetIPAndPortFromString
NETWORK_API void NetworkUtility::GetIPAndPortFromString( const rString& input, rString& outIP, unsigned short& outPort )
{
if ( input == "" )
return;
outIP = "";
outPort = INVALID_PORT;
size_t colonCount = std::count( input.begin(), input.end(), ':' );
if ( colonCount == 1 )
{
outIP = GetIPFromString( input );
size_t colonPosition = input.find( ':' );
rString portString = input.substr( colonPosition + 1 );
if ( StringUtility::IsDigitsOnly( portString ) )
{
outPort = GetPortFromString( portString );
}
}
else if ( StringUtility::IsDigitsOnly( input ) )
{
outPort = GetPortFromString( input );
}
else
{
outIP = GetIPFromString( input );
}
}