Skip to content

Commit dd4cea4

Browse files
[format] Format code with clang
1 parent f85d2f3 commit dd4cea4

File tree

212 files changed

+5334
-5204
lines changed

Some content is hidden

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

212 files changed

+5334
-5204
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
uses: GsActions/commit-message-checker@v1
2020
with:
2121
# A regex pattern to check if a commit message is valid.
22-
pattern: "((\\[(builder|changelog|ci|cmake|codegen|core|doc|docs|git|sc-kpm|sc-memory|sc-network|sc-server|scripts|scs|test|tests|thirdparty|web)\\])+(.)+)|(Review fixes)$"
22+
pattern: "((\\[(builder|changelog|ci|cmake|codegen|core|doc|docs|format|git|sc-kpm|sc-memory|sc-network|sc-server|scripts|scs|test|tests|thirdparty|web)\\])+(.)+)|(Review fixes)$"
2323
# Expression flags change how the expression is interpreted.
2424
flags: # optional, default is gm
2525
# A error message which will be returned in case of an error.

docs/dev/pr.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Possible tags:
1919
* `[codegen]` - changes in code generator
2020
* `[core]` - changes in `sc-storage` code
2121
* `[doc]` or `[docs]` - update documentation
22+
* `[format]` - changes in code formatting
2223
* `[git]` - changes in git configuration
2324
* `[sc-kpm]` - changes in `sc-kpm` code
2425
* `[sc-memory]` - changes in `sc-memory` code

sc-kpm/sc-ui/translators/uiSc2SCgJsonTranslator.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
* (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
55
*/
66

7-
#include "uiPrecompiled.h"
87
#include "uiSc2SCgJsonTranslator.h"
98

109
#include "uiKeynodes.h"
10+
#include "uiPrecompiled.h"
1111
#include "uiTranslators.h"
1212
#include "uiUtils.h"
1313

@@ -17,7 +17,6 @@ uiSc2SCgJsonTranslator::uiSc2SCgJsonTranslator()
1717

1818
uiSc2SCgJsonTranslator::~uiSc2SCgJsonTranslator()
1919
{
20-
2120
}
2221

2322
void uiSc2SCgJsonTranslator::runImpl()
@@ -29,7 +28,7 @@ void uiSc2SCgJsonTranslator::runImpl()
2928

3029
mOutputData = "[";
3130

32-
sc_iterator3 *it = sc_iterator3_f_a_a_new(s_default_ctx, mInputConstructionAddr, sc_type_arc_pos_const_perm, 0);
31+
sc_iterator3 * it = sc_iterator3_f_a_a_new(s_default_ctx, mInputConstructionAddr, sc_type_arc_pos_const_perm, 0);
3332
while (sc_iterator3_next(it) == SC_TRUE)
3433
{
3534
el_type = 0;
@@ -54,10 +53,10 @@ void uiSc2SCgJsonTranslator::runImpl()
5453

5554
sc_addr beg_addr;
5655
if (sc_memory_get_arc_begin(s_default_ctx, addr, &beg_addr) != SC_RESULT_OK)
57-
continue; //! TODO error logging
56+
continue; //! TODO error logging
5857
sc_addr end_addr;
5958
if (sc_memory_get_arc_end(s_default_ctx, addr, &end_addr) != SC_RESULT_OK)
60-
continue; //! TODO error logging
59+
continue; //! TODO error logging
6160

6261
attrs["begin"] = buildId(beg_addr);
6362
attrs["end"] = buildId(end_addr);
@@ -90,7 +89,7 @@ void uiSc2SCgJsonTranslator::runImpl()
9089
}
9190

9291
// ------------------------------------------------------------------------------
93-
sc_result uiSc2SCgJsonTranslator::ui_translate_sc2scg_json(const sc_event *event, sc_addr arg)
92+
sc_result uiSc2SCgJsonTranslator::ui_translate_sc2scg_json(const sc_event * event, sc_addr arg)
9493
{
9594
sc_addr cmd_addr, input_addr, format_addr;
9695

sc-kpm/sc-ui/translators/uiSc2SCnJsonTranslator.cpp

Lines changed: 37 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
* (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
55
*/
66

7-
#include "uiPrecompiled.h"
87
#include "uiSc2SCnJsonTranslator.h"
98

10-
#include "uiTranslators.h"
119
#include "uiKeynodes.h"
10+
#include "uiPrecompiled.h"
11+
#include "uiTranslators.h"
1212
#include "uiUtils.h"
1313

14-
uiSCnSentenceNode::uiSCnSentenceNode(sScElementInfo *keywordEl)
14+
uiSCnSentenceNode::uiSCnSentenceNode(sScElementInfo * keywordEl)
1515
: mParent(0)
1616
, mType(ST_KEYWORD)
1717
, mElementInfo(keywordEl)
@@ -28,7 +28,6 @@ uiSCnSentenceNode::uiSCnSentenceNode()
2828
, mType(ST_NODE)
2929
, mElementInfo(0)
3030
{
31-
3231
}
3332

3433
void uiSCnSentenceNode::buildTree()
@@ -54,10 +53,10 @@ void uiSCnSentenceNode::buildTree()
5453

5554
if (mType == ST_PREDICATE)
5655
{
57-
sScElementInfo *el = (mParent->mElementInfo == mElementInfo->target) ? mElementInfo->source : mElementInfo->target;
56+
sScElementInfo * el = (mParent->mElementInfo == mElementInfo->target) ? mElementInfo->source : mElementInfo->target;
5857
assert(el);
5958

60-
uiSCnSentenceNode *child = new uiSCnSentenceNode();
59+
uiSCnSentenceNode * child = new uiSCnSentenceNode();
6160
child->mType = ST_NODE;
6261
child->mElementInfo = el;
6362
_appendChildNode(child);
@@ -71,12 +70,10 @@ void uiSCnSentenceNode::buildTree()
7170

7271
void uiSCnSentenceNode::balance()
7372
{
74-
7573
}
7674

77-
const String& uiSCnSentenceNode::json()
75+
const String & uiSCnSentenceNode::json()
7876
{
79-
8077
StringStream ss;
8178

8279
ss << "{";
@@ -90,15 +87,16 @@ const String& uiSCnSentenceNode::json()
9087
{
9188
assert(mChildSentences.size() == 1);
9289
ss << ", \"SCNode\" : " << (*mChildSentences.begin())->json();
93-
} else
90+
}
91+
else
9492
{
9593
ss << ", \"SCArcs\": [";
9694

9795
// translate child nodes, they must be predicates
9896
tSentenceNodeList::iterator it, itEnd = mChildSentences.end();
9997
for (it = mChildSentences.begin(); it != itEnd; ++it)
10098
{
101-
uiSCnSentenceNode *sentence = *it;
99+
uiSCnSentenceNode * sentence = *it;
102100
assert(sentence->mType == ST_PREDICATE);
103101

104102
if (it != mChildSentences.begin())
@@ -115,9 +113,9 @@ const String& uiSCnSentenceNode::json()
115113
return mJSONData;
116114
}
117115

118-
uiSCnSentenceNode* uiSCnSentenceNode::createChildNode(uiSCnSentenceNode::eSentenceNodeType type)
116+
uiSCnSentenceNode * uiSCnSentenceNode::createChildNode(uiSCnSentenceNode::eSentenceNodeType type)
119117
{
120-
uiSCnSentenceNode *child = new uiSCnSentenceNode();
118+
uiSCnSentenceNode * child = new uiSCnSentenceNode();
121119
child->mType = type;
122120
_appendChildNode(child);
123121
return child;
@@ -132,7 +130,7 @@ void uiSCnSentenceNode::destroyChilds()
132130
delete *it;
133131
}
134132

135-
void uiSCnSentenceNode::_removeChildNode(uiSCnSentenceNode *child)
133+
void uiSCnSentenceNode::_removeChildNode(uiSCnSentenceNode * child)
136134
{
137135
assert(child->mParent == this);
138136
child->mParent = 0;
@@ -147,7 +145,7 @@ void uiSCnSentenceNode::_removeChildNode(uiSCnSentenceNode *child)
147145
}
148146
}
149147

150-
void uiSCnSentenceNode::_appendChildNode(uiSCnSentenceNode *child)
148+
void uiSCnSentenceNode::_appendChildNode(uiSCnSentenceNode * child)
151149
{
152150
assert(child->mParent != this);
153151

@@ -158,7 +156,7 @@ void uiSCnSentenceNode::_appendChildNode(uiSCnSentenceNode *child)
158156
mChildSentences.push_back(child);
159157
}
160158

161-
bool uiSCnSentenceNode::_hasChildNode(uiSCnSentenceNode *child) const
159+
bool uiSCnSentenceNode::_hasChildNode(uiSCnSentenceNode * child) const
162160
{
163161
tSentenceNodeList::const_iterator it, itEnd = mChildSentences.end();
164162
for (it = mChildSentences.begin(); it != itEnd; ++it)
@@ -170,17 +168,14 @@ bool uiSCnSentenceNode::_hasChildNode(uiSCnSentenceNode *child) const
170168
return false;
171169
}
172170

173-
void uiSCnSentenceNode::_createChildPredicate(sScElementInfo *arc)
171+
void uiSCnSentenceNode::_createChildPredicate(sScElementInfo * arc)
174172
{
175173
assert(arc->type & sc_type_arc_mask);
176174

177-
uiSCnSentenceNode *child = createChildNode(ST_PREDICATE);
175+
uiSCnSentenceNode * child = createChildNode(ST_PREDICATE);
178176
child->mElementInfo = arc;
179177
}
180178

181-
182-
183-
184179
// ---------------------------------------------------------------------------------------------------
185180
uiSc2SCnJsonTranslator::uiSc2SCnJsonTranslator()
186181
: mScElementsInfoPool(0)
@@ -190,24 +185,23 @@ uiSc2SCnJsonTranslator::uiSc2SCnJsonTranslator()
190185
uiSc2SCnJsonTranslator::~uiSc2SCnJsonTranslator()
191186
{
192187
if (mScElementsInfoPool)
193-
delete []mScElementsInfoPool;
188+
delete[] mScElementsInfoPool;
194189
}
195190

196191
void uiSc2SCnJsonTranslator::runImpl()
197192
{
198193
// get command arguments
199-
sc_iterator5 *it5 = sc_iterator5_a_a_f_a_f_new(s_default_ctx,
200-
sc_type_node | sc_type_const,
201-
sc_type_arc_common | sc_type_const,
202-
mInputConstructionAddr,
203-
sc_type_arc_pos_const_perm,
204-
keynode_question_nrel_answer);
194+
sc_iterator5 * it5 = sc_iterator5_a_a_f_a_f_new(
195+
s_default_ctx,
196+
sc_type_node | sc_type_const,
197+
sc_type_arc_common | sc_type_const,
198+
mInputConstructionAddr,
199+
sc_type_arc_pos_const_perm,
200+
keynode_question_nrel_answer);
205201
if (sc_iterator5_next(it5) == SC_TRUE)
206202
{
207-
sc_iterator3 *it3 = sc_iterator3_f_a_a_new(s_default_ctx,
208-
sc_iterator5_value(it5, 0),
209-
sc_type_arc_pos_const_perm,
210-
0);
203+
sc_iterator3 * it3 =
204+
sc_iterator3_f_a_a_new(s_default_ctx, sc_iterator5_value(it5, 0), sc_type_arc_pos_const_perm, 0);
211205
while (sc_iterator3_next(it3) == SC_TRUE)
212206
mKeywordsList.push_back(sc_iterator3_value(it3, 2));
213207
sc_iterator3_free(it3);
@@ -216,14 +210,12 @@ void uiSc2SCnJsonTranslator::runImpl()
216210

217211
collectScElementsInfo();
218212

219-
220-
221213
mOutputData = "[";
222214

223215
tScAddrList::iterator it, itEnd = mKeywordsList.end();
224216
for (it = mKeywordsList.begin(); it != itEnd; ++it)
225217
{
226-
uiSCnSentenceNode *sentence = new uiSCnSentenceNode(mScElementsInfo[*it]);
218+
uiSCnSentenceNode * sentence = new uiSCnSentenceNode(mScElementsInfo[*it]);
227219
mRootSentences.push_back(sentence);
228220
}
229221

@@ -251,31 +243,25 @@ void uiSc2SCnJsonTranslator::runImpl()
251243
mRootSentences.clear();
252244

253245
mOutputData += "]";
254-
//qDebug() << "Result: " << QString().fromStdString(mOutputData);
246+
// qDebug() << "Result: " << QString().fromStdString(mOutputData);
255247
}
256248

257249
String uiSc2SCnJsonTranslator::translateElement(sc_addr addr, bool isKeyword)
258250
{
259-
260251
return "";
261252
}
262253

263254
bool uiSc2SCnJsonTranslator::isInOutputConstruction(sc_addr addr) const
264255
{
265-
sc_iterator3 *it3 = sc_iterator3_f_a_f_new(s_default_ctx,
266-
mInputConstructionAddr,
267-
sc_type_arc_pos_const_perm,
268-
addr);
256+
sc_iterator3 * it3 = sc_iterator3_f_a_f_new(s_default_ctx, mInputConstructionAddr, sc_type_arc_pos_const_perm, addr);
269257
bool result = (sc_iterator3_next(it3) == SC_TRUE);
270258
sc_iterator3_free(it3);
271259
return result;
272260
}
273261

274-
275-
276262
void uiSc2SCnJsonTranslator::collectScElementsInfo()
277263
{
278-
sc_uint32 elementsCount =(sc_uint32) mObjects.size();
264+
sc_uint32 elementsCount = (sc_uint32)mObjects.size();
279265
mScElementsInfoPool = new sScElementInfo[elementsCount];
280266

281267
sc_uint32 poolUsed = 0;
@@ -300,7 +286,7 @@ void uiSc2SCnJsonTranslator::collectScElementsInfo()
300286
arcAddr = it->first;
301287
elType = it->second;
302288

303-
sScElementInfo *elInfo = mScElementsInfo[arcAddr];
289+
sScElementInfo * elInfo = mScElementsInfo[arcAddr];
304290
elInfo->isInSentenceTree = false;
305291
elInfo->visualType = sScElementInfo::VT_NODE;
306292

@@ -310,16 +296,15 @@ void uiSc2SCnJsonTranslator::collectScElementsInfo()
310296

311297
// get begin/end addrs
312298
if (sc_memory_get_arc_begin(s_default_ctx, arcAddr, &begAddr) != SC_RESULT_OK)
313-
continue; // @todo process errors
299+
continue; // @todo process errors
314300
if (sc_memory_get_arc_end(s_default_ctx, arcAddr, &endAddr) != SC_RESULT_OK)
315-
continue; // @todo process errors
316-
301+
continue; // @todo process errors
317302

318303
elInfo->srcAddr = begAddr;
319304
elInfo->trgAddr = endAddr;
320305

321-
sScElementInfo *begInfo = mScElementsInfo[begAddr];
322-
sScElementInfo *endInfo = mScElementsInfo[endAddr];
306+
sScElementInfo * begInfo = mScElementsInfo[begAddr];
307+
sScElementInfo * endInfo = mScElementsInfo[endAddr];
323308

324309
elInfo->source = begInfo;
325310
elInfo->target = endInfo;
@@ -335,7 +320,7 @@ void uiSc2SCnJsonTranslator::collectScElementsInfo()
335320
tScElemetsInfoMap::iterator itInfo, itInfoEnd = mScElementsInfo.begin();
336321
for (itInfo = mScElementsInfo.begin(); itInfo != itInfoEnd; ++itInfo)
337322
{
338-
sScElementInfo *el = itInfo->second;
323+
sScElementInfo * el = itInfo->second;
339324

340325
// possible sc-lement can be visualized as set
341326
if (el->type & sc_type_node_tuple)
@@ -346,17 +331,14 @@ void uiSc2SCnJsonTranslator::collectScElementsInfo()
346331
// possible sc-element can be visualized as contour
347332
if (el->type & sc_type_node_struct)
348333
{
349-
350334
}
351-
352335
}
353336

354337
// construct tree of sentences
355-
356338
}
357339

358340
// -------------------------------------
359-
sc_result uiSc2SCnJsonTranslator::ui_translate_sc2scn(const sc_event *event, sc_addr arg)
341+
sc_result uiSc2SCnJsonTranslator::ui_translate_sc2scn(const sc_event * event, sc_addr arg)
360342
{
361343
sc_addr cmd_addr, input_addr, format_addr;
362344

@@ -377,5 +359,3 @@ sc_result uiSc2SCnJsonTranslator::ui_translate_sc2scn(const sc_event *event, sc_
377359

378360
return SC_RESULT_OK;
379361
}
380-
381-

0 commit comments

Comments
 (0)