Skip to content

Commit dbc4f8d

Browse files
author
Alexander Bychuk
committed
add : formatting
fix : demangling
1 parent 87a3fc7 commit dbc4f8d

File tree

8 files changed

+265
-110
lines changed

8 files changed

+265
-110
lines changed

.clang-format

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
Language: Cpp
2+
# BasedOnStyle: Google
3+
AccessModifierOffset: -1
4+
AlignAfterOpenBracket: Align
5+
AlignConsecutiveAssignments: false
6+
AlignConsecutiveDeclarations: false
7+
AlignEscapedNewlinesLeft: true
8+
AlignOperands: true
9+
AlignTrailingComments: true
10+
AllowAllParametersOfDeclarationOnNextLine: true
11+
AllowShortBlocksOnASingleLine: false
12+
AllowShortCaseLabelsOnASingleLine: false
13+
AllowShortFunctionsOnASingleLine: All
14+
AllowShortIfStatementsOnASingleLine: true
15+
AllowShortLoopsOnASingleLine: true
16+
AlwaysBreakAfterDefinitionReturnType: None
17+
AlwaysBreakAfterReturnType: None
18+
AlwaysBreakBeforeMultilineStrings: true
19+
AlwaysBreakTemplateDeclarations: true
20+
BinPackArguments: false
21+
BinPackParameters: false
22+
BraceWrapping:
23+
AfterClass: false
24+
AfterControlStatement: false
25+
AfterEnum: false
26+
AfterFunction: false
27+
AfterNamespace: false
28+
AfterObjCDeclaration: false
29+
AfterStruct: false
30+
AfterUnion: false
31+
BeforeCatch: false
32+
BeforeElse: false
33+
IndentBraces: false
34+
BreakBeforeBinaryOperators: None
35+
BreakBeforeBraces: Attach
36+
BreakBeforeTernaryOperators: true
37+
BreakConstructorInitializersBeforeComma: false
38+
BreakAfterJavaFieldAnnotations: false
39+
BreakStringLiterals: true
40+
ColumnLimit: 150
41+
CommentPragmas: '^ IWYU pragma:'
42+
ConstructorInitializerAllOnOneLineOrOnePerLine: true
43+
ConstructorInitializerIndentWidth: 4
44+
ContinuationIndentWidth: 4
45+
Cpp11BracedListStyle: true
46+
DerivePointerAlignment: true
47+
DisableFormat: false
48+
ExperimentalAutoDetectBinPacking: false
49+
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
50+
IncludeCategories:
51+
- Regex: '^<.*\.h>'
52+
Priority: 1
53+
- Regex: '^<.*'
54+
Priority: 2
55+
- Regex: '.*'
56+
Priority: 3
57+
IncludeIsMainRegex: '([-_](test|unittest))?$'
58+
IndentCaseLabels: true
59+
IndentWidth: 2
60+
IndentWrappedFunctionNames: false
61+
JavaScriptQuotes: Leave
62+
JavaScriptWrapImports: true
63+
KeepEmptyLinesAtTheStartOfBlocks: false
64+
MacroBlockBegin: ''
65+
MacroBlockEnd: ''
66+
MaxEmptyLinesToKeep: 1
67+
NamespaceIndentation: None
68+
ObjCBlockIndentWidth: 2
69+
ObjCSpaceAfterProperty: false
70+
ObjCSpaceBeforeProtocolList: false
71+
PenaltyBreakBeforeFirstCallParameter: 1
72+
PenaltyBreakComment: 300
73+
PenaltyBreakFirstLessLess: 120
74+
PenaltyBreakString: 1000
75+
PenaltyExcessCharacter: 1000000
76+
PenaltyReturnTypeOnItsOwnLine: 200
77+
PointerAlignment: Left
78+
ReflowComments: true
79+
SortIncludes: false
80+
SpaceAfterCStyleCast: false
81+
SpaceAfterTemplateKeyword: true
82+
SpaceBeforeAssignmentOperators: true
83+
SpaceBeforeParens: ControlStatements
84+
SpaceInEmptyParentheses: false
85+
SpacesBeforeTrailingComments: 2
86+
SpacesInAngles: false
87+
SpacesInContainerLiterals: true
88+
SpacesInCStyleCastParentheses: false
89+
SpacesInParentheses: false
90+
SpacesInSquareBrackets: false
91+
Standard: Auto
92+
TabWidth: 8
93+
UseTab: Never

.clang-tidy

+108
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
Checks: 'clang-diagnostic-*,clang-analyzer-*,hicpp-*,-hicpp-no-malloc,-hicpp-avoid-c-arrays,-hicpp-no-array-decay,readability-identifier-naming,google-readability-*,modernize-*'
2+
CheckOptions:
3+
- key: google-readability-braces-around-statements.ShortStatementLines
4+
value: '1'
5+
- key: google-readability-function-size.StatementThreshold
6+
value: '800'
7+
- key: google-readability-namespace-comments.ShortNamespaceLines
8+
value: '10'
9+
- key: google-readability-namespace-comments.SpacesBeforeComments
10+
value: '2'
11+
- key: modernize-loop-convert.MaxCopySize
12+
value: '16'
13+
- key: modernize-loop-convert.MinConfidence
14+
value: reasonable
15+
- key: modernize-loop-convert.NamingStyle
16+
value: camelBack
17+
- key: modernize-pass-by-value.IncludeStyle
18+
value: llvm
19+
- key: modernize-replace-auto-ptr.IncludeStyle
20+
value: llvm
21+
- key: modernize-use-nullptr.NullMacros
22+
value: 'NULL'
23+
- key: readability-identifier-naming.AbstractClassCase
24+
value: CamelCase
25+
- key: readability-identifier-naming.ClassCase
26+
value: CamelCase
27+
- key: readability-identifier-naming.ClassConstantCase
28+
value: UPPER_CASE
29+
- key: readability-identifier-naming.ClassMemberCase
30+
value: camelBack
31+
- key: readability-identifier-naming.ClassMemberPrefix
32+
value: '_'
33+
- key: readability-identifier-naming.ClassMethodCase
34+
value: camelBack
35+
- key: readability-identifier-naming.ConstantCase
36+
value: UPPER_CASE
37+
- key: readability-identifier-naming.ConstexprFunctionCase
38+
value: camelBack
39+
- key: readability-identifier-naming.ConstexprMethodCase
40+
value: camelBack
41+
- key: readability-identifier-naming.EnumCase
42+
value: CamelCase
43+
- key: readability-identifier-naming.EnumConstantCase
44+
value: UPPER_CASE
45+
- key: readability-identifier-naming.FunctionCase
46+
value: camelBack
47+
- key: readability-identifier-naming.GlobalConstantCase
48+
value: UPPER_CASE
49+
- key: readability-identifier-naming.GlobalFunctionCase
50+
value: camelBack
51+
- key: readability-identifier-naming.GlobalVariableCase
52+
value: camelBack
53+
- key: readability-identifier-naming.InlineNamespaceCase
54+
value: lower_case
55+
- key: readability-identifier-naming.LocalConstantCase
56+
value: camelBack
57+
- key: readability-identifier-naming.LocalVariableCase
58+
value: camelBack
59+
- key: readability-identifier-naming.MemberCase
60+
value: camelBack
61+
- key: readability-identifier-naming.MemberPrefix
62+
value: '_'
63+
- key: readability-identifier-naming.ConstantMemberCase
64+
value: camelBack
65+
- key: readability-identifier-naming.PrivateMemberPrefix
66+
value: '_'
67+
- key: readability-identifier-naming.ProtectedMemberCase
68+
value: camelBack
69+
- key: readability-identifier-naming.PublicMemberCase
70+
value: camelBack
71+
- key: readability-identifier-naming.MethodCase
72+
value: camelBack
73+
- key: readability-identifier-naming.NamespaceCase
74+
value: lower_case
75+
- key: readability-identifier-naming.ParameterCase
76+
value: camelBack
77+
- key: readability-identifier-naming.ConstantParameterCase
78+
value: camelBack
79+
- key: readability-identifier-naming.ParameterPackCase
80+
value: camelBack
81+
- key: readability-identifier-naming.PureFunctionCase
82+
value: camelBack
83+
- key: readability-identifier-naming.PureMethodCase
84+
value: camelBack
85+
- key: readability-identifier-naming.StaticConstantCase
86+
value: camelBack
87+
- key: readability-identifier-naming.StaticVariableCase
88+
value: camelBack
89+
- key: readability-identifier-naming.StructCase
90+
value: CamelCase
91+
- key: readability-identifier-naming.TemplateParameterCase
92+
value: CamelCase
93+
- key: readability-identifier-naming.TemplateTemplateParameterCase
94+
value: CamelCase
95+
- key: readability-identifier-naming.TypeTemplateParameterCase
96+
value: camelBack
97+
- key: readability-identifier-naming.TypedefCase
98+
value: CamelCase
99+
- key: readability-identifier-naming.UnionCase
100+
value: CamelCase
101+
- key: readability-identifier-naming.UsingCase
102+
value: CamelCase
103+
- key: readability-identifier-naming.ValueTemplateParameterCase
104+
value: camelBack
105+
- key: readability-identifier-naming.VariableCase
106+
value: camelBack
107+
- key: readability-identifier-naming.VirtualMethodCase
108+
value: camelBase

main.cpp

+1-12
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,17 @@ int main(int argc, char *argv[]) {
1515
parser.addVersionOption();
1616
parser.addPositionalArgument("filename", QCoreApplication::translate("main", "file analyse."));
1717

18-
// A boolean option with multiple names (-f, --force)
19-
// QCommandLineOption archOption(QStringList() << "a" << "arch",
20-
// QCoreApplication::translate("main", "Show architecture."));
21-
// parser.addOption(archOption);
22-
23-
// Process the actual command line arguments given by the user
2418
parser.process(app);
2519

2620
const QStringList args = parser.positionalArguments();
27-
// source is args.at(0), destination is args.at(1)
21+
2822
QString fName;
2923
if (args.size() > 0) {
3024
fName = args.at(0);
3125
}
3226

33-
3427
MainWindow w(fName);
3528

36-
// if (parser.isSet(archOption)) {
37-
// QLdd qldd(fName, app.applicationDirPath());
38-
// size_t fsz = qldd.getFileSize();
39-
// }
4029
#ifdef __APPLE__
4130
w.setWindowTitle("UnixDependency");
4231
#else

mainwindow.cpp

+13-15
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@
77
#include <QShortcut>
88
#include <QMessageBox>
99

10-
MainWindow::MainWindow(const QString &fileName, QWidget *parent) :
11-
QMainWindow(parent),
12-
ui(new Ui::MainWindow),
13-
qldd(NULL),
14-
shortcutClose(NULL),
15-
fileMenu(NULL),
16-
helpMenu(NULL),
17-
openAct(NULL),
18-
aboutAct(NULL),
19-
aboutQtAct(NULL),
20-
exitAct(NULL) {
10+
MainWindow::MainWindow(const QString &fileName, QWidget *parent)
11+
: QMainWindow(parent),
12+
ui(new Ui::MainWindow),
13+
qldd(NULL),
14+
shortcutClose(NULL),
15+
fileMenu(NULL),
16+
helpMenu(NULL),
17+
openAct(NULL),
18+
aboutAct(NULL),
19+
aboutQtAct(NULL),
20+
exitAct(NULL) {
2121
ui->setupUi(this);
2222

2323
shortcutClose = new QShortcut(QKeySequence(Qt::Key_Escape), this);
@@ -113,7 +113,6 @@ void MainWindow::reset(const QString &fileName) {
113113
ui->lineEditGroup->setFont(sansFont);
114114
#endif
115115

116-
117116
ui->textEditInformation->setText(qldd->getInfo());
118117
#ifdef __APPLE__
119118
ui->textEditInformation->setFont(sansFont);
@@ -137,16 +136,15 @@ void MainWindow::reset(const QString &fileName) {
137136
}
138137

139138
void MainWindow::open() {
140-
141139
QString fileName = QFileDialog::getOpenFileName(this);
142140
if (!fileName.isEmpty()) {
143141
reset(fileName);
144142
}
145-
146143
}
147144

148145
void MainWindow::about() {
149-
QMessageBox::about(this, tr("About Application"),
146+
QMessageBox::about(this,
147+
tr("About Application"),
150148
#ifdef __APPLE__
151149
tr("UnixDependency shows all dependent libraries of a "
152150
#else

mainwindow.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ class MainWindow;
1212
class MainWindow : public QMainWindow {
1313
Q_OBJECT
1414

15-
public:
15+
public:
1616
explicit MainWindow(const QString &fileName, QWidget *parent = 0);
1717
~MainWindow();
18-
private slots:
18+
private slots:
1919
void open();
2020
void about();
2121

22-
private:
22+
private:
2323
void createActions();
2424
void createMenus();
2525
void reset(const QString &fileName);
@@ -34,4 +34,4 @@ private slots:
3434
QAction *exitAct;
3535
};
3636

37-
#endif // MAINWINDOW_H
37+
#endif // MAINWINDOW_H

mainwindow.ui

+7-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
<iconset>
2323
<normaloff>Qldd.ico</normaloff>Qldd.ico</iconset>
2424
</property>
25+
<property name="styleSheet">
26+
<string notr="true"/>
27+
</property>
2528
<widget class="QWidget" name="centralWidget">
2629
<layout class="QGridLayout" name="gridLayout_6">
2730
<item row="0" column="0" rowspan="4" colspan="2">
@@ -691,6 +694,9 @@
691694
<family>Monospace</family>
692695
</font>
693696
</property>
697+
<property name="sortingEnabled">
698+
<bool>false</bool>
699+
</property>
694700
</widget>
695701
</item>
696702
</layout>
@@ -705,7 +711,7 @@
705711
<x>0</x>
706712
<y>0</y>
707713
<width>725</width>
708-
<height>24</height>
714+
<height>23</height>
709715
</rect>
710716
</property>
711717
</widget>

0 commit comments

Comments
 (0)