本文整理汇总了C++中project::Item::addFileRetainingSortOrder方法的典型用法代码示例。如果您正苦于以下问题:C++ Item::addFileRetainingSortOrder方法的具体用法?C++ Item::addFileRetainingSortOrder怎么用?C++ Item::addFileRetainingSortOrder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类project::Item
的用法示例。
在下文中一共展示了Item::addFileRetainingSortOrder方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: create
static bool create (Project::Item parent, const File& newFile, const char* templateName)
{
if (fillInNewCppFileTemplate (newFile, parent, templateName))
{
parent.addFileRetainingSortOrder (newFile, true);
return true;
}
showFailedToWriteMessage (newFile);
return false;
}
示例2: createNewFile
void createNewFile (Project::Item parent) override
{
const File newFile (askUserToChooseNewFile (String (defaultClassName) + ".h", "*.h;*.cpp", parent));
if (newFile != File::nonexistent)
{
const File headerFile (newFile.withFileExtension (".h"));
const File cppFile (newFile.withFileExtension (".cpp"));
headerFile.replaceWithText (String::empty);
cppFile.replaceWithText (String::empty);
OpenDocumentManager& odm = IntrojucerApp::getApp().openDocumentManager;
if (SourceCodeDocument* cpp = dynamic_cast<SourceCodeDocument*> (odm.openFile (nullptr, cppFile)))
{
if (SourceCodeDocument* header = dynamic_cast<SourceCodeDocument*> (odm.openFile (nullptr, headerFile)))
{
ScopedPointer<JucerDocument> jucerDoc (new ComponentDocument (cpp));
if (jucerDoc != nullptr)
{
jucerDoc->setClassName (newFile.getFileNameWithoutExtension());
jucerDoc->flushChangesToDocuments();
jucerDoc = nullptr;
cpp->save();
header->save();
odm.closeDocument (cpp, true);
odm.closeDocument (header, true);
parent.addFileRetainingSortOrder (headerFile, true);
parent.addFileRetainingSortOrder (cppFile, true);
}
}
}
}
}
示例3: createNewFile
void createNewFile (Project& project, Project::Item parent) override
{
auto newFile = askUserToChooseNewFile (String (defaultClassName) + ".h", "*.h;*.cpp", parent);
if (newFile != File())
{
auto headerFile = newFile.withFileExtension (".h");
auto cppFile = newFile.withFileExtension (".cpp");
headerFile.replaceWithText (String());
cppFile.replaceWithText (String());
auto& odm = ProjucerApplication::getApp().openDocumentManager;
if (auto* cpp = dynamic_cast<SourceCodeDocument*> (odm.openFile (nullptr, cppFile)))
{
if (auto* header = dynamic_cast<SourceCodeDocument*> (odm.openFile (nullptr, headerFile)))
{
std::unique_ptr<JucerDocument> jucerDoc (new ComponentDocument (cpp));
if (jucerDoc != nullptr)
{
jucerDoc->setClassName (newFile.getFileNameWithoutExtension());
jucerDoc->flushChangesToDocuments (&project);
jucerDoc.reset();
cpp->save();
header->save();
odm.closeDocument (cpp, true);
odm.closeDocument (header, true);
parent.addFileRetainingSortOrder (headerFile, true);
parent.addFileRetainingSortOrder (cppFile, true);
}
}
}
}
}