本文整理汇总了C++中gd::Project::InsertNewSourceFile方法的典型用法代码示例。如果您正苦于以下问题:C++ Project::InsertNewSourceFile方法的具体用法?C++ Project::InsertNewSourceFile怎么用?C++ Project::InsertNewSourceFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gd::Project
的用法示例。
在下文中一共展示了Project::InsertNewSourceFile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: EnsureAssociatedSourceFileIsUpToDate
void CppCodeEvent::EnsureAssociatedSourceFileIsUpToDate(
gd::Project& project) const {
#if !defined(GD_NO_WX_GUI)
gd::String outputFile(CodeCompiler::Get()->GetOutputDirectory() + "GD" +
gd::String::From(this) + "SourceFile.cpp");
gd::SourceFile* sourceFile;
// First check if the associated source file exists in the GD project.
if (project.HasSourceFile(associatedGDManagedSourceFile, "C++"))
sourceFile = &project.GetSourceFile(associatedGDManagedSourceFile);
else {
// If there is no associated source file existing, then create a new one
sourceFile = &project.InsertNewSourceFile(outputFile, "C++");
sourceFile->SetGDManaged(true);
}
// Then check if the associated source file is up to date
associatedGDManagedSourceFile = outputFile;
if (sourceFile->GetFileName() != outputFile) {
sourceFile->SetFileName(outputFile);
} else if (wxFileExists(outputFile)) {
wxFileName sourceFileInfo(outputFile);
if (sourceFileInfo.GetModificationTime().GetTicks() >= lastChangeTimeStamp)
return;
}
// The associated source file is non existing or not up to date: Regenerate
// it. It will be compiled ( see CodeCompilationHelpers ) as it will be
// detected ( by DependenciesAnalyzer ) as a SourceFile dependency which is
// not up to date.
gd::FileStream file;
file.open(outputFile, std::ios_base::out);
file << GenerateAssociatedFileCode();
file.close();
#else
gd::LogError(
"BAD USE: C++ Code event not supported when wxWidgets support is "
"disabled");
#endif
}