MCPcopy Create free account
hub / github.com/188080501/JQTools / make

Method make

components/QtGroup/CppFileMaker/cpp/cppfilemaker.cpp:23–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21using namespace CppFileMaker;
22
23QString Manage::make(
24 const QString &macroProtectsPrefix,
25 const QString &className,
26 const bool qmlExpand
27 )
28{
29 const auto desktopPath = QStandardPaths::writableLocation( QStandardPaths::DesktopLocation );
30
31 QString sourceFilePath1;
32 QString sourceFilePath2;
33 QString sourceFilePath3;
34 QString sourceFilePath4;
35 QString targetFilePath1;
36 QString targetFilePath2;
37 QString targetFilePath3;
38 QString targetFilePath4;
39
40 if ( qmlExpand )
41 {
42 sourceFilePath1 = ":/CppFileMakerFiles/template/QmlTemplate";
43 sourceFilePath2 = ":/CppFileMakerFiles/template/qmltemplate.h";
44 sourceFilePath3 = ":/CppFileMakerFiles/template/qmltemplate.inc";
45 sourceFilePath4 = ":/CppFileMakerFiles/template/qmltemplate.cpp";
46 }
47 else
48 {
49 sourceFilePath1 = ":/CppFileMakerFiles/template/CppTemplate";
50 sourceFilePath2 = ":/CppFileMakerFiles/template/cpptemplate.h";
51 sourceFilePath3 = ":/CppFileMakerFiles/template/cpptemplate.inc";
52 sourceFilePath4 = ":/CppFileMakerFiles/template/cpptemplate.cpp";
53 }
54
55 targetFilePath1 = QString( "%1/%2" ).arg( desktopPath, className );
56 targetFilePath2 = QString( "%1/%2.h" ).arg( desktopPath, className.toLower() );
57 targetFilePath3 = QString( "%1/%2.inc" ).arg( desktopPath, className.toLower() );
58 targetFilePath4 = QString( "%1/%2.cpp" ).arg( desktopPath, className.toLower() );
59
60 AbstractTool::writeFile( QFileInfo( targetFilePath1 ), QByteArray::fromHex( "efbbbf" ) + this->getTemplateData( sourceFilePath1, macroProtectsPrefix, className ).toUtf8() );
61 AbstractTool::writeFile( QFileInfo( targetFilePath2 ), QByteArray::fromHex( "efbbbf" ) + this->getTemplateData( sourceFilePath2, macroProtectsPrefix, className ).toUtf8() );
62 AbstractTool::writeFile( QFileInfo( targetFilePath3 ), QByteArray::fromHex( "efbbbf" ) + this->getTemplateData( sourceFilePath3, macroProtectsPrefix, className ).toUtf8() );
63 AbstractTool::writeFile( QFileInfo( targetFilePath4 ), QByteArray::fromHex( "efbbbf" ) + this->getTemplateData( sourceFilePath4, macroProtectsPrefix, className ).toUtf8() );
64
65 return "OK";
66}
67
68QString Manage::getTemplateData(
69 const QString &templateFilePath,

Callers

nothing calls this directly

Calls 2

getTemplateDataMethod · 0.95
QFileInfoClass · 0.85

Tested by

no test coverage detected