Skip to content

Commit 0c09633

Browse files
authored
Merge pull request #26 from urboob21/dev_branch
id 1764288755
2 parents 1c7f57a + 86798f9 commit 0c09633

46 files changed

Lines changed: 5203 additions & 5884 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.clang-format

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# Google C/C++ Code Style settings
2+
# https://clang.llvm.org/docs/ClangFormatStyleOptions.html
3+
# Author: Kehan Xue, kehan.xue (at) gmail.com
4+
5+
Language: Cpp
6+
BasedOnStyle: Google
7+
AccessModifierOffset: -1
8+
AlignAfterOpenBracket: Align
9+
AlignConsecutiveAssignments: None
10+
AlignOperands: Align
11+
AllowAllArgumentsOnNextLine: true
12+
AllowAllConstructorInitializersOnNextLine: true
13+
AllowAllParametersOfDeclarationOnNextLine: false
14+
AllowShortBlocksOnASingleLine: Empty
15+
AllowShortCaseLabelsOnASingleLine: false
16+
AllowShortFunctionsOnASingleLine: Inline
17+
AllowShortIfStatementsOnASingleLine: Never # To avoid conflict, set this "Never" and each "if statement" should include brace when coding
18+
AllowShortLambdasOnASingleLine: Inline
19+
AllowShortLoopsOnASingleLine: false
20+
AlwaysBreakAfterReturnType: None
21+
AlwaysBreakTemplateDeclarations: Yes
22+
BinPackArguments: true
23+
BreakBeforeBraces: Custom
24+
BraceWrapping:
25+
AfterCaseLabel: false
26+
AfterClass: false
27+
AfterStruct: false
28+
AfterControlStatement: Never
29+
AfterEnum: false
30+
AfterFunction: false
31+
AfterNamespace: false
32+
AfterUnion: false
33+
AfterExternBlock: false
34+
BeforeCatch: false
35+
BeforeElse: false
36+
BeforeLambdaBody: false
37+
IndentBraces: false
38+
SplitEmptyFunction: false
39+
SplitEmptyRecord: false
40+
SplitEmptyNamespace: false
41+
BreakBeforeBinaryOperators: None
42+
BreakBeforeTernaryOperators: true
43+
BreakConstructorInitializers: BeforeColon
44+
BreakInheritanceList: BeforeColon
45+
ColumnLimit: 80
46+
CompactNamespaces: false
47+
ContinuationIndentWidth: 4
48+
Cpp11BracedListStyle: true
49+
DerivePointerAlignment: false # Make sure the * or & align on the left
50+
EmptyLineBeforeAccessModifier: LogicalBlock
51+
FixNamespaceComments: true
52+
IncludeBlocks: Preserve
53+
IndentCaseLabels: true
54+
IndentPPDirectives: None
55+
IndentWidth: 2
56+
KeepEmptyLinesAtTheStartOfBlocks: true
57+
MaxEmptyLinesToKeep: 1
58+
NamespaceIndentation: None
59+
ObjCSpaceAfterProperty: false
60+
ObjCSpaceBeforeProtocolList: true
61+
PointerAlignment: Left
62+
ReflowComments: false
63+
# SeparateDefinitionBlocks: Always # Only support since clang-format 14
64+
SpaceAfterCStyleCast: false
65+
SpaceAfterLogicalNot: false
66+
SpaceAfterTemplateKeyword: true
67+
SpaceBeforeAssignmentOperators: true
68+
SpaceBeforeCpp11BracedList: false
69+
SpaceBeforeCtorInitializerColon: true
70+
SpaceBeforeInheritanceColon: true
71+
SpaceBeforeParens: ControlStatements
72+
SpaceBeforeRangeBasedForLoopColon: true
73+
SpaceBeforeSquareBrackets: false
74+
SpaceInEmptyParentheses: false
75+
SpacesBeforeTrailingComments: 2
76+
SpacesInAngles: false
77+
SpacesInCStyleCastParentheses: false
78+
SpacesInContainerLiterals: false
79+
SpacesInParentheses: false
80+
SpacesInSquareBrackets: false
81+
Standard: c++11
82+
TabWidth: 4
83+
UseTab: Never

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ set(APP_SOURCES
7878
"src/DeleteMe.cpp"
7979
"src/core/basics/InitializeVariable.cpp"
8080
"src/core/basics/Operations.cpp"
81+
"src/core/basics/TypeQualifier.cpp"
8182
"src/core/basics/ControlFlow.cpp"
8283
"src/core/datatypes/Fundamental.cpp"
8384
"src/core/datatypes/CArray.cpp"

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,21 @@ Make sure the following tools are installed before building the project:
1212
- **Git**
1313
- **lcov** (for code coverage)
1414
- **cppcheck** (for static analysis)
15+
- **Optional:** Install `clang-format` to format C++ code.
1516

17+
Linux
18+
```bash
19+
sudo apt install clang-format
20+
find . -regex '.*\.\(cpp\|h\|hpp\)' -exec clang-format -i {} \;
21+
```
22+
Windows
23+
```bash
24+
# Install clang-format via Chocolatey
25+
choco install clang-format
26+
27+
# Apply clang-format recursively to .cpp, .h, .hpp files
28+
Get-ChildItem -Recurse -Include *.cpp, *.h, *.hpp | ForEach-Object { clang-format -i $_.FullName }
29+
```
1630
## 3. SETUP
1731
* Setup the Local Test Environment
1832
* 1.Using your own Ubuntu system

include/DeleteMe.h

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
#pragma once
2-
class DeleteMe
3-
{
4-
private:
5-
int m_lastResult;
2+
class DeleteMe {
3+
private:
4+
int m_lastResult;
65

7-
public:
8-
DeleteMe();
9-
~DeleteMe();
10-
bool add(int addend1, int addend2);
11-
bool mul(int factor1, int factor2);
12-
bool div(int dividend, int divisor);
13-
int get_last_result();
6+
public:
7+
DeleteMe();
8+
~DeleteMe();
9+
bool add(int addend1, int addend2);
10+
bool mul(int factor1, int factor2);
11+
bool div(int dividend, int divisor);
12+
int get_last_result();
1413
};

src/DeleteMe.cpp

Lines changed: 18 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,32 @@
11
#include "DeleteMe.h"
22

3-
DeleteMe::DeleteMe()
4-
{
5-
m_lastResult = 0;
3+
DeleteMe::DeleteMe() {
4+
m_lastResult = 0;
65
}
76

8-
DeleteMe::~DeleteMe()
9-
{
10-
11-
}
7+
DeleteMe::~DeleteMe() {}
128

13-
bool DeleteMe::add(int addend1, int addend2)
14-
{
15-
m_lastResult = addend1 + addend2;
16-
return true;
9+
bool DeleteMe::add(int addend1, int addend2) {
10+
m_lastResult = addend1 + addend2;
11+
return true;
1712
}
1813

1914
// This is for checking that code coverage will not be <100%
20-
bool DeleteMe::mul(int factor1, int factor2)
21-
{
22-
m_lastResult = factor1 * factor2;
23-
return true;
15+
bool DeleteMe::mul(int factor1, int factor2) {
16+
m_lastResult = factor1 * factor2;
17+
return true;
2418
}
2519

26-
bool DeleteMe::div(int dividend, int divisor)
27-
{
28-
if (divisor == 0)
29-
{
30-
m_lastResult = 0;
31-
return false;
32-
}
20+
bool DeleteMe::div(int dividend, int divisor) {
21+
if (divisor == 0) {
22+
m_lastResult = 0;
23+
return false;
24+
}
3325

34-
m_lastResult = dividend / divisor;
35-
return true;
26+
m_lastResult = dividend / divisor;
27+
return true;
3628
}
3729

38-
int DeleteMe::get_last_result()
39-
{
40-
return m_lastResult;
30+
int DeleteMe::get_last_result() {
31+
return m_lastResult;
4132
}

0 commit comments

Comments
 (0)