本文整理汇总了C++中Log::Success方法的典型用法代码示例。如果您正苦于以下问题:C++ Log::Success方法的具体用法?C++ Log::Success怎么用?C++ Log::Success使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Log
的用法示例。
在下文中一共展示了Log::Success方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Execute
void CompileCommand::Execute(StreamParser& input, Log& output)
{
/* --- Compilation --- */
/* Parse input stream */
ReadArgs(input);
if (outputFilename_.empty())
{
output.Error("missing output filename for code generation");
return;
}
/* Setup I/O stream for assembly */
std::unique_ptr<std::iostream> assembly;
if (options_.showAsm)
{
assembly = MakeUnique<std::fstream>(
OutputFilename(outputFilename_, "xasm", output),
(std::fstream::in | std::fstream::out | std::fstream::trunc)
);
}
else
assembly = MakeUnique<std::stringstream>();
/* Setup compilation falgs */
auto flags = GetCompilationFlags();
if (output.verbose)
flags << CompileFlags::Verbose;
/* Setup compilation configuration */
CompileConfig config;
for (const auto& source : sources_)
{
auto file = std::make_shared<std::ifstream>(source);
if (!file->good())
{
output.Error("reading source file \"" + source + "\" failed");
return;
}
else
config.sources.push_back({ source, file });
}
config.assembly = assembly.get();
config.cfgDumpPath = options_.cfgDumpPath;
config.flags = flags;
/* Compile code */
if (Compile(config, &output.stream))
{
/* Assemble code */
config.assembly->seekg(0);
auto byteCode = Assemble(*config.assembly, &output.stream);
if (byteCode)
{
/* Write byte code to file */
if (byteCode->WriteToFile(OutputFilename(outputFilename_, "xbc", output)))
{
/* Print success message */
if (output.verbose)
output.Success("compilation successful");
}
}
}
}