本文整理汇总了C++中Locale::Save方法的典型用法代码示例。如果您正苦于以下问题:C++ Locale::Save方法的具体用法?C++ Locale::Save怎么用?C++ Locale::Save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Locale
的用法示例。
在下文中一共展示了Locale::Save方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
status = parser.Parse( argv[1] );
if ( status == 0 ) {
// validate what we have parsed
if ( info.images.size() == 0 ) {
cerr << "Error: No images defined" << endl;
status = -1;
} else {
if ( argc == 4 ) {
string gfxdir( argv[3] );
append_path_delim( gfxdir );
info.images.insert( 0, gfxdir );
}
if ( !File::Exists( info.images ) ) {
cerr << "Error: Could not find file " << info.images << endl;
status = -1;
}
}
if ( units.size() == 0 ) {
cerr << "Error: No units defined" << endl;
status = -1;
}
for ( map<string, Language>::iterator it = names.begin();
it != names.end(); ++it ) {
locale.AddLanguage( it->second );
}
if ( !locale.SetDefaultLanguage( CF_LANG_DEFAULT ) ) {
cerr << "Error: Could not find info for default language (" << CF_LANG_DEFAULT << ")" << endl;
status = -1;
}
}
if ( status == 0 ) {
File out( argv[2] );
if ( !out.Open( "wb" ) ) {
cerr << "Couldn't open output file " << argv[2] << endl;
status = -1;
} else {
// write data file header
out.Write32( FID_UNITSET );
out.Write16( units.size() );
// write sound file names
out.Write8( info.sfx.size() );
for ( i = 0; i < info.sfx.size(); ++i ) {
out.Write8( info.sfx[i].size() );
out.WriteS( info.sfx[i] );
}
// write unit data
for ( i = 0; i < units.size(); ++i ) {
out.Write16( units[i].Terrain() );
out.Write16( units[i].Image() );
out.Write16( units[i].Flags() );
out.Write8( units[i].Speed() );
out.Write8( units[i].Weight() );
out.Write8( units[i].Armour() );
out.Write8( units[i].Firepower( U_GROUND) );
out.Write8( units[i].Firepower( U_SHIP ) );
out.Write8( units[i].Firepower( U_AIR ) );
out.Write8( units[i].MinFOF( U_GROUND ) );
out.Write8( units[i].MaxFOF( U_GROUND ) );
out.Write8( units[i].MinFOF( U_SHIP ) );
out.Write8( units[i].MaxFOF( U_SHIP ) );
out.Write8( units[i].MinFOF( U_AIR ) );
out.Write8( units[i].MaxFOF( U_AIR) );
out.Write8( units[i].Cost() );
out.Write8( UT_NO_SOUND ); // move sound
out.Write8( UT_NO_SOUND ); // fire sound
out.Write8( units[i].Slots() );
out.Write8( units[i].MinWeight() );
out.Write8( units[i].MaxWeight() );
out.Write8( i );
out.Write8( units[i].Portrait() );
}
locale.Save( out );
// load graphics
MkSurface img;
status = img.SaveImageData( info.images, out, true );
// load optional unit portraits
out.Write8( info.portraits.size() );
for ( i = 0; (i <info.portraits.size()) && (status == 0); ++i ) {
if ( argc == 4 ) {
string gfxdir( argv[3] );
append_path_delim( gfxdir );
info.portraits[i].insert( 0, gfxdir );
}
status = img.SaveImageData( info.portraits[i], out, false );
}
out.Close();
}
}
return status;
}