本文整理汇总了C++中RString函数的典型用法代码示例。如果您正苦于以下问题:C++ RString函数的具体用法?C++ RString怎么用?C++ RString使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RString函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Init
RString MovieDecoder_FFMpeg::OpenCodec()
{
Init();
ASSERT( m_pStream != NULL );
if( m_pStream->codec->codec )
avcodec::avcodec_close( m_pStream->codec );
avcodec::AVCodec *pCodec = avcodec::avcodec_find_decoder( m_pStream->codec->codec_id );
if( pCodec == NULL )
return ssprintf( "Couldn't find decoder %i", m_pStream->codec->codec_id );
m_pStream->codec->workaround_bugs = 1;
m_pStream->codec->idct_algo = FF_IDCT_AUTO;
m_pStream->codec->error_concealment = 3;
if( pCodec->capabilities & CODEC_CAP_DR1 )
m_pStream->codec->flags |= CODEC_FLAG_EMU_EDGE;
LOG->Trace("Opening codec %s", pCodec->name );
int ret = avcodec::avcodec_open2( m_pStream->codec, pCodec, NULL );
if( ret < 0 )
return RString( averr_ssprintf(ret, "Couldn't open codec \"%s\"", pCodec->name) );
ASSERT( m_pStream->codec->codec != NULL );
return RString();
}
示例2: RString
RString MovieDecoder_FFMpeg::Open( RString sFile )
{
MovieTexture_FFMpeg::RegisterProtocols();
int ret = avcodec::av_open_input_file( &m_fctx, "rage://" + sFile, NULL, 0, NULL );
if( ret < 0 )
return RString( averr_ssprintf(ret, "AVCodec: Couldn't open \"%s\"", sFile.c_str()) );
ret = avcodec::av_find_stream_info( m_fctx );
if( ret < 0 )
return RString( averr_ssprintf(ret, "AVCodec (%s): Couldn't find codec parameters", sFile.c_str()) );
avcodec::AVStream *pStream = FindVideoStream( m_fctx );
if( pStream == NULL )
return "Couldn't find any video streams";
m_pStream = pStream;
if( m_pStream->codec->codec_id == avcodec::CODEC_ID_NONE )
return ssprintf( "Unsupported codec %08x", m_pStream->codec->codec_tag );
RString sError = OpenCodec();
if( !sError.empty() )
return ssprintf( "AVCodec (%s): %s", sFile.c_str(), sError.c_str() );
LOG->Trace( "Bitrate: %i", m_pStream->codec->bit_rate );
LOG->Trace( "Codec pixel format: %s", avcodec::avcodec_get_pix_fmt_name(m_pStream->codec->pix_fmt) );
return RString();
}
示例3: RS_XML
void
RS_XML(entityDeclaration)(void *ctx,
const xmlChar *name, int type, const xmlChar *publicId,
const xmlChar *systemId, xmlChar *content)
{
USER_OBJECT_ fun, opArgs, tmp;
RS_XMLParserData *parserData = (RS_XMLParserData*) ctx;
DECL_ENCODING_FROM_EVENT_PARSER(parserData)
/* check if there is a function to call before making the list of 5 elements. */
fun = RS_XML(findFunction)(HANDLER_FUN_NAME(parserData, "entityDeclaration"), parserData->methods);
if(fun == NULL || fun == NULL_USER_OBJECT)
return;
PROTECT(fun);
PROTECT(opArgs = NEW_LIST(5));
SET_VECTOR_ELT(opArgs, 0, RString(name));
PROTECT(tmp = ScalarInteger(type));
SET_NAMES(tmp, mkString(EntityTypeNames[type-1]));
SET_VECTOR_ELT(opArgs, 1, tmp);
UNPROTECT(1);
SET_VECTOR_ELT(opArgs, 2, RString(content));
SET_VECTOR_ELT(opArgs, 3, RString(systemId));
SET_VECTOR_ELT(opArgs, 4, RString(publicId));
(void) RS_XML(invokeFunction)(fun, opArgs, parserData->stateObject, parserData->ctx);
UNPROTECT(2);
}
示例4: Init
RString MovieDecoder_FFMpeg::OpenCodec()
{
Init();
ASSERT( m_pStream );
if( m_pStream->codec->codec )
avcodec::avcodec_close( m_pStream->codec );
avcodec::AVCodec *pCodec = avcodec::avcodec_find_decoder( m_pStream->codec->codec_id );
if( pCodec == NULL )
return ssprintf( "Couldn't find decoder %i", m_pStream->codec->codec_id );
LOG->Trace("Opening codec %s", pCodec->name );
if( !m_bHadBframes )
{
LOG->Trace("Setting CODEC_FLAG_LOW_DELAY" );
m_pStream->codec->flags |= CODEC_FLAG_LOW_DELAY;
}
int ret = avcodec::avcodec_open( m_pStream->codec, pCodec );
if( ret < 0 )
return RString( averr_ssprintf(ret, "Couldn't open codec \"%s\"", pCodec->name) );
ASSERT( m_pStream->codec->codec );
/* This is set to true when we find a B-frame, to use on the next loop. */
m_bHadBframes = false;
return RString();
}
示例5: RString
/* Find an announcer directory with sounds in it. First search sFolderName,
* then all aliases above. Ignore directories that are empty, since we might
* have "select difficulty intro" with sounds and an empty "ScreenSelectDifficulty
* intro". */
RString AnnouncerManager::GetPathTo( RString sAnnouncerName, RString sFolderName )
{
if(sAnnouncerName == "")
return RString(); /* announcer disabled */
const RString AnnouncerPath = GetAnnouncerDirFromName(sAnnouncerName);
if( !DirectoryIsEmpty(AnnouncerPath+sFolderName+"/") )
return AnnouncerPath+sFolderName+"/";
/* Search for the announcer folder in the list of aliases. */
int i;
for(i = 0; aliases[i][0] != NULL; ++i)
{
if(!sFolderName.EqualsNoCase(aliases[i][0]))
continue; /* no match */
if( !DirectoryIsEmpty(AnnouncerPath+aliases[i][1]+"/") )
return AnnouncerPath+aliases[i][1]+"/";
}
/* No announcer directory matched. In debug, create the directory by
* its preferred name. */
#ifdef DEBUG
LOG->Trace( "The announcer in '%s' is missing the folder '%s'.",
AnnouncerPath.c_str(), sFolderName.c_str() );
// MessageBeep( MB_OK );
RageFile temp;
temp.Open( AnnouncerPath+sFolderName + "/announcer files go here.txt", RageFile::WRITE );
#endif
return RString();
}
示例6: rsa_make_key
void CryptManager::GenerateRSAKey( unsigned int keyLength, RString &sPrivKey, RString &sPubKey )
{
int iRet;
rsa_key key;
iRet = rsa_make_key( &g_pPRNG->m_PRNG, g_pPRNG->m_iPRNG, keyLength / 8, 65537, &key );
if( iRet != CRYPT_OK )
{
LOG->Warn( "GenerateRSAKey(%i) error: %s", keyLength, error_to_string(iRet) );
return;
}
unsigned char buf[1024];
unsigned long iSize = sizeof(buf);
iRet = rsa_export( buf, &iSize, PK_PUBLIC, &key );
if( iRet != CRYPT_OK )
{
LOG->Warn( "Export error: %s", error_to_string(iRet) );
return;
}
sPubKey = RString( (const char *) buf, iSize );
iSize = sizeof(buf);
iRet = rsa_export( buf, &iSize, PK_PRIVATE, &key );
if( iRet != CRYPT_OK )
{
LOG->Warn( "Export error: %s", error_to_string(iRet) );
return;
}
sPrivKey = RString( (const char *) buf, iSize );
}
示例7: EnableDlgItem
LRESULT MainDialog::OnFinishConvert(UINT, WPARAM wp, LPARAM)
{
EnableDlgItem(IDC_XML, true);
EnableDlgItem(IDC_XML_BROWSE, true);
EnableDlgItem(IDC_OUT_IMPORT, true);
EnableDlgItem(IDC_OUT_MYSQL, true);
EnableDlgItem(IDC_OUT_PSQL7, true);
EnableDlgItem(IDC_OUT_PSQL8, true);
EnableDlgItem(IDC_OPT_NOTEXT, true);
EnableDlgItem(IDC_OUTDIR, true);
EnableDlgItem(IDC_OUTDIR_BROWSE, true);
EnableDlgItem(IDC_START, true);
OnUpdateOption(0, 0, 0);
m_converting = false;
SetWindowText(RString(IDS_APP_TITLE));
if(!m_abort) {
m_csStderr.Lock();
if(wp == 0) {
if(m_errbuff.IsEmpty()) {
MessageBox(RString(IDS_COMPLETE), MB_ICONINFORMATION);
} else {
RString mesg(IDS_COMPLETE_WARNING);
MessageBox(mesg + m_errbuff, MB_ICONINFORMATION);
}
} else {
MessageBox(m_errbuff, MB_ICONEXCLAMATION);
}
m_csStderr.Unlock();
}
m_abort = false;
return 0;
}
示例8: GetCurrentString
static RString GetCurrentString( const CListBox &list )
{
// TODO: Add your control notification handler code here
int iSel = list.GetCurSel();
if( iSel == LB_ERR )
return RString();
CString s;
list.GetText( list.GetCurSel(), s );
return RString( s );
}
示例9: FOREACH_CONST
void TitleSubst::Subst( TitleFields &tf )
{
FOREACH_CONST( TitleTrans*, ttab, iter )
{
TitleTrans* tt = *iter;
TitleFields to;
if( !tt->Matches(tf,to) )
continue;
/* The song matches. Replace whichever strings aren't empty. */
if( !tt->Replacement.Title.empty() && tf.Title != tt->Replacement.Title )
{
if( tt->translit )
tf.TitleTranslit = tf.Title;
tf.Title = (tt->Replacement.Title != ERASE_MARKER)? to.Title : RString();
FontCharAliases::ReplaceMarkers( tf.Title );
}
if( !tt->Replacement.Subtitle.empty() && tf.Subtitle != tt->Replacement.Subtitle )
{
if( tt->translit )
tf.SubtitleTranslit = tf.Subtitle;
tf.Subtitle = (tt->Replacement.Subtitle != ERASE_MARKER)? to.Subtitle : RString();
FontCharAliases::ReplaceMarkers( tf.Subtitle );
}
if( !tt->Replacement.Artist.empty() && tf.Artist != tt->Replacement.Artist )
{
if( tt->translit )
tf.ArtistTranslit = tf.Artist;
tf.Artist = (tt->Replacement.Artist != ERASE_MARKER)? to.Artist : RString();
FontCharAliases::ReplaceMarkers( tf.Artist );
}
/* These are used when applying kanji to a field that doesn't have the
* correct data. Should be used sparingly. */
if( !tt->Replacement.TitleTranslit.empty() )
{
tf.TitleTranslit = (tt->Replacement.TitleTranslit != ERASE_MARKER)? tt->Replacement.TitleTranslit : RString();
FontCharAliases::ReplaceMarkers( tf.TitleTranslit );
}
if( !tt->Replacement.SubtitleTranslit.empty() )
{
tf.SubtitleTranslit = (tt->Replacement.SubtitleTranslit != ERASE_MARKER)? tt->Replacement.SubtitleTranslit : RString();
FontCharAliases::ReplaceMarkers( tf.SubtitleTranslit );
}
if( !tt->Replacement.ArtistTranslit.empty() )
{
tf.ArtistTranslit = (tt->Replacement.ArtistTranslit != ERASE_MARKER)? tt->Replacement.ArtistTranslit : RString();
FontCharAliases::ReplaceMarkers( tf.ArtistTranslit );
}
// Matched once. Keep processing to allow multiple matching entries. For example, allow
// one entry to translate a title, and another entry to translate the artist.
}
示例10: ASSERT
void Steps::SetNoteData( const NoteData& noteDataNew )
{
ASSERT( noteDataNew.GetNumTracks() == GAMEMAN->GetStepsTypeInfo(m_StepsType).iNumTracks );
DeAutogen( false );
*m_pNoteData = noteDataNew;
m_bNoteDataIsFilled = true;
m_sNoteDataCompressed = RString();
m_iHash = 0;
m_sFilename = RString(); // We can no longer read from the file because it has changed in memory.
}
示例11: allocTest
void StackAlloc_Test::perfTest()
{
StackAllocScope stk;
tick_t start = ::acdk::lang::sys::core_tick::now();
allocTest(ObjectHeap::allocator());
tick_t end1 = ::acdk::lang::sys::core_tick::now();
allocTest(stk);
tick_t end2 = ::acdk::lang::sys::core_tick::now();
System::out->println(RString("Allocator 0: ")
+ int(end1 - start)
+ RString("; Allocator stackalloc: ") + int(end2 - end1));
}
示例12: if
void ChangeGameSettings::OnOK()
{
// TODO: Add extra validation here
IniFile ini;
ini.ReadFile( SpecialFiles::PREFERENCES_INI_PATH );
if( BST_CHECKED == IsDlgButtonChecked(IDC_RADIO_OPENGL) )
ini.SetValue( "Options", "VideoRenderers", (RString)"opengl" );
else if( BST_CHECKED == IsDlgButtonChecked(IDC_RADIO_DIRECT3D) )
ini.SetValue( "Options", "VideoRenderers", (RString)"d3d" );
else
ini.SetValue( "Options", "VideoRenderers", RString() );
if( BST_CHECKED == IsDlgButtonChecked(IDC_RADIO_SOUND_DIRECTSOUND_HARDWARE) )
ini.SetValue( "Options", "SoundDrivers", (RString)"DirectSound" );
else if( BST_CHECKED == IsDlgButtonChecked(IDC_RADIO_SOUND_DIRECTSOUND_SOFTWARE) )
ini.SetValue( "Options", "SoundDrivers", (RString)"DirectSound-sw" );
else if( BST_CHECKED == IsDlgButtonChecked(IDC_RADIO_SOUND_WAVEOUT) )
ini.SetValue( "Options", "SoundDrivers", (RString)"WaveOut" );
else if( BST_CHECKED == IsDlgButtonChecked(IDC_RADIO_SOUND_NULL) )
ini.SetValue( "Options", "SoundDrivers", (RString)"null" );
else
ini.SetValue( "Options", "SoundDrivers", RString() );
if( BST_CHECKED == IsDlgButtonChecked(IDC_CHECK_FORCE_60HZ) )
{
ini.SetValue( "Options", "RefreshRate", 60 );
}
else
{
int iRefresh = 0;
ini.GetValue( "Options", "RefreshRate", iRefresh );
if( iRefresh == 60 )
ini.SetValue( "Options", "RefreshRate", 0 );
}
ini.SetValue( "Options", "LogToDisk", BST_CHECKED == IsDlgButtonChecked(IDC_CHECK_LOG_TO_DISK) );
ini.SetValue( "Options", "ShowLogOutput", BST_CHECKED == IsDlgButtonChecked(IDC_CHECK_SHOW_LOG_WINDOW) );
if( !ini.WriteFile(SpecialFiles::PREFERENCES_INI_PATH) )
{
RString sError = ssprintf( ERROR_WRITING_FILE.GetValue(), SpecialFiles::PREFERENCES_INI_PATH.c_str(), ini.GetError().c_str() );
Dialog::OK( sError );
}
CDialog::OnOK();
}
示例13: ssprintf
RString MovieDecoder_FFMpeg::Open( RString sFile )
{
MovieTexture_FFMpeg::RegisterProtocols();
m_fctx = avcodec::avformat_alloc_context();
if( !m_fctx )
return "AVCodec: Couldn't allocate context";
RageFile *f = new RageFile;
if( !f->Open(sFile, RageFile::READ) )
{
RString errorMessage = f->GetError();
RString error = ssprintf("MovieDecoder_FFMpeg: Error opening \"%s\": %s", sFile.c_str(), errorMessage.c_str() );
delete f;
return error;
}
m_buffer = (unsigned char *)avcodec::av_malloc(STEPMANIA_FFMPEG_BUFFER_SIZE);
m_avioContext = avcodec::avio_alloc_context(m_buffer, STEPMANIA_FFMPEG_BUFFER_SIZE, 0, f, AVIORageFile_ReadPacket, NULL, AVIORageFile_Seek);
m_fctx->pb = m_avioContext;
int ret = avcodec::avformat_open_input( &m_fctx, sFile.c_str(), NULL, NULL );
if( ret < 0 )
return RString( averr_ssprintf(ret, "AVCodec: Couldn't open \"%s\"", sFile.c_str()) );
ret = avcodec::avformat_find_stream_info( m_fctx, NULL );
if( ret < 0 )
return RString( averr_ssprintf(ret, "AVCodec (%s): Couldn't find codec parameters", sFile.c_str()) );
int stream_idx = avcodec::av_find_best_stream( m_fctx, avcodec::AVMEDIA_TYPE_VIDEO, -1, -1, NULL, 0 );
if ( stream_idx < 0 ||
static_cast<unsigned int>(stream_idx) >= m_fctx->nb_streams ||
m_fctx->streams[stream_idx] == NULL )
return "Couldn't find any video streams";
m_pStream = m_fctx->streams[stream_idx];
if( m_pStream->codec->codec_id == avcodec::CODEC_ID_NONE )
return ssprintf( "Unsupported codec %08x", m_pStream->codec->codec_tag );
RString sError = OpenCodec();
if( !sError.empty() )
return ssprintf( "AVCodec (%s): %s", sFile.c_str(), sError.c_str() );
LOG->Trace( "Bitrate: %i", m_pStream->codec->bit_rate );
LOG->Trace( "Codec pixel format: %s", avcodec::av_get_pix_fmt_name(m_pStream->codec->pix_fmt) );
return RString();
}
示例14: RString
RString Sprite::GetTexturePath() const
{
if( m_pTexture==NULL )
return RString();
return m_pTexture->GetID().filename;
}
示例15: InitEntities
static void InitEntities()
{
if( !g_mapEntitiesToChars.empty() )
return;
static struct Entity
{
char c;
const char *pEntity;
}
const EntityTable[] =
{
{ '&', "amp", },
{ '\"', "quot", },
{ '\'', "apos", },
{ '<', "lt", },
{ '>', "gt", }
};
for( unsigned i = 0; i < ARRAYLEN(EntityTable); ++i )
{
const Entity &ent = EntityTable[i];
g_mapEntitiesToChars[ent.pEntity] = RString(1, ent.c);
g_mapCharsToEntities[ent.c] = ent.pEntity;
}
}