本文整理汇总了C++中OutStream::OutputNumber方法的典型用法代码示例。如果您正苦于以下问题:C++ OutStream::OutputNumber方法的具体用法?C++ OutStream::OutputNumber怎么用?C++ OutStream::OutputNumber使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OutStream
的用法示例。
在下文中一共展示了OutStream::OutputNumber方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OutStream
Bool BonkEnc::CueSheet::Save(const String &fileName)
{
if (fileNames.Length() == 0) return False;
OutStream *file = new OutStream(STREAM_FILE, fileName, OS_OVERWRITE);
/* Write UTF-8 BOM and set output format.
*/
file->OutputNumber(0xEF, 1);
file->OutputNumber(0xBB, 1);
file->OutputNumber(0xBF, 1);
String format = String::SetOutputFormat("UTF-8");
/* Check if all tracks belong to the same album and
* if we need to create a single or multi file cue sheet.
*/
Bool album = True;
Bool oneFile= True;
for (Int c = 0; c < fileNames.Length() - 1; c++)
{
if (trackArtists.GetNth(c) != trackArtists.GetNth(c + 1) || trackAlbums.GetNth(c) != trackAlbums.GetNth(c + 1))
{
album = False;
}
if (fileNames.GetNth(c) != fileNames.GetNth(c + 1))
{
oneFile = False;
}
}
/* Metadata.
*/
if (album)
{
file->OutputLine(String("PERFORMER \"").Append(trackArtists.GetFirst()).Append("\""));
file->OutputLine(String("TITLE \"").Append(trackAlbums.GetFirst()).Append("\""));
}
/* Write actual track data.
*/
if (oneFile)
{
file->OutputLine(String("FILE \"").Append(fileNames.GetNth(0)).Append("\" WAVE"));
}
for (Int i = 0; i < fileNames.Length(); i++)
{
Int minutes = trackOffsets.GetNth(i) / (75 * 60);
Int seconds = (trackOffsets.GetNth(i) - (minutes * 60 * 75)) / 75 ;
Int frames = trackOffsets.GetNth(i) - (seconds * 75) - (minutes * 60 * 75) ;
if (!oneFile) file->OutputLine(String("FILE \"").Append(fileNames.GetNth(i)).Append("\" WAVE"));
file->OutputLine(String(" TRACK ").Append(i < 9 ? "0" : "").Append(String::FromInt(i + 1)).Append(" AUDIO"));
file->OutputLine(String(" TITLE \"").Append(trackTitles.GetNth(i)).Append("\""));
file->OutputLine(String(" PERFORMER \"").Append(trackArtists.GetNth(i)).Append("\""));
file->OutputLine(String(" INDEX 01 ").Append(minutes < 10 ? "0" : "").Append(String::FromInt(minutes)).Append(":")
.Append(seconds < 10 ? "0" : "").Append(String::FromInt(seconds)).Append(":")
.Append(frames < 10 ? "0" : "").Append(String::FromInt(frames )));
}
file->Close();
delete file;
/* Restore previous output format.
*/
String::SetOutputFormat(format);
return True;
}