本文整理汇总了C++中Format::Override方法的典型用法代码示例。如果您正苦于以下问题:C++ Format::Override方法的具体用法?C++ Format::Override怎么用?C++ Format::Override使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Format
的用法示例。
在下文中一共展示了Format::Override方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateImage
bool CreateImage (const std::string &path, Range range)
{
auto disk = std::make_shared<Disk>();
// Start with legacy default formats, with automatic gap 3
Format fmt = IsFileExt(path, "cpm") ? RegularFormat::ProDos : RegularFormat::MGT;
fmt.gap3 = 0;
// Allow everything about the format to be overridden, but check it
fmt.Override(true);
fmt.Validate();
ValidateRange(range, MAX_TRACKS, MAX_SIDES);
// Set the disk label, if supplied
if (!opt.label.empty())
disk->metadata["label"] = opt.label;
// Extend or format the disk
if (opt.noformat)
disk->write_track(CylHead(range.cyl_end - 1, range.head_end - 1), Track());
else
disk->format(fmt);
// Write to the output disk image
WriteImage(path, disk);
// Report the new disk parameters, unless it's already been displayed (raw)
if (!IsFileExt(path, "raw"))
{
auto cyls = disk->cyls();
auto heads = disk->heads();
if (opt.noformat)
util::cout << util::fmt("Created %2u cyl%s, %u head%s, unformatted.\n", cyls, (cyls == 1) ? "" : "s", heads, (heads == 1) ? "" : "s");
else
{
util::cout << util::fmt("Created %2u cyl%s, %u head%s, %2u sector%s/track, %4u bytes/sector\n",
cyls, (cyls == 1) ? "" : "s", heads, (heads == 1) ? "" : "s",
fmt.sectors, (fmt.sectors == 1) ? "" : "s", fmt.sector_size());
}
}
return true;
}