Skip to content

Commit dd69b60

Browse files
committed
Fixed scripts.wsjcpp/generate.WsjcppEmploy.wsjcpp-script
1 parent 0e76f9d commit dd69b60

File tree

7 files changed

+87
-68
lines changed

7 files changed

+87
-68
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2020 wsjcpp
3+
Copyright (c) 2020-2025 Evgenii Sopov <mrseakg@gmail.com>
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

scripts.wsjcpp/generate.WsjcppEmploy.wsjcpp-script

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,8 @@ concat filename_cpp "./src/" base_filename ".cpp"
3232
# INTERFACE FILE
3333
#
3434

35-
var ifndef_inreface
36-
concat ifndef_inreface employ_name_snake "_H"
37-
to_upper_case ifndef_inreface
38-
3935
var content_interface
40-
concat content_interface "#ifndef " ifndef_inreface "
41-
#define " ifndef_inreface "
36+
concat content_interface "#pragma once
4237

4338
#include <string>
4439

@@ -47,41 +42,31 @@ class I" employ_name " {
4742
static std::string name() { return \"I" employ_name "\"; }
4843
virtual void doSomething() = 0;
4944
};
50-
51-
#endif // " ifndef_inreface
45+
"
5246

5347
#
5448
# HEADER FILE
5549
#
5650

57-
var ifndef_header
58-
set_value ifndef_header base_filename
59-
concat ifndef_header "_H"
60-
61-
to_upper_case ifndef_header
62-
6351
var content_header
64-
concat content_header "#ifndef " ifndef_header "
65-
#define " ifndef_header "
52+
concat content_header "#pragma once
6653

6754
#include <wsjcpp_employees.h>
6855
#include \"" employ_name_snake ".h\"
6956

7057
class " class_name " : public WsjcppEmployBase, public I" employ_name " {
7158
public:
7259
" class_name "();
73-
virtual bool init() override;
74-
virtual bool deinit() override;
60+
virtual bool init(const std::string &sName, bool bSilent) override;
61+
virtual bool deinit(const std::string &sName, bool bSilent) override;
7562

7663
// I" employ_name "
7764
virtual void doSomething() override;
7865

7966
private:
8067
std::string TAG;
8168
};
82-
83-
#endif // " ifndef_header
84-
69+
"
8570

8671
#
8772
# SOURCE FILE
@@ -102,13 +87,17 @@ REGISTRY_WJSCPP_SERVICE_LOCATOR(" class_name ")
10287
TAG = \"" class_name "\";
10388
}
10489

105-
bool " class_name "::init() {
106-
WsjcppLog::info(TAG, \"init\");
90+
bool " class_name "::init(const std::string &sName, bool bSilent) {
91+
if (!bSilent) {
92+
WsjcppLog::info(TAG, \"init \" + sName);
93+
}
10794
return true;
10895
}
10996

110-
bool " class_name "::deinit() {
111-
WsjcppLog::info(TAG, \"deinit\");
97+
bool " class_name "::deinit(const std::string &sName, bool bSilent) {
98+
if (!bSilent) {
99+
WsjcppLog::info(TAG, \"deinit \" + sName);
100+
}
112101
return true;
113102
}
114103

src/employ_my_impl.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#ifndef EMPLOY_MY_IMPL_H
2-
#define EMPLOY_MY_IMPL_H
1+
#pragma once
32

43
#include "my_impl.h"
54
#include <wsjcpp_employees.h>
@@ -19,5 +18,3 @@ class EmployMyImpl : public WsjcppEmployBase, public IMyImpl, public IMyImpl2 {
1918
private:
2019
std::string TAG;
2120
};
22-
23-
#endif // EMPLOY_MY_IMPL_H

src/main.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,26 @@
1+
/**********************************************************************************
2+
* Copyright (c) 2020-2025 Evgenii Sopov <mrseakg@gmail.com>
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy
5+
* of this software and associated documentation files (the "Software"), to deal
6+
* in the Software without restriction, including without limitation the rights
7+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
* copies of the Software, and to permit persons to whom the Software is
9+
* furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in all
12+
* copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
* SOFTWARE.
21+
*
22+
***********************************************************************************/
23+
124
#include "my_impl.h"
225
#include <wsjcpp_core.h>
326
#include <wsjcpp_employees.h>

src/my_impl.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#ifndef MY_IMPL_H
2-
#define MY_IMPL_H
1+
#pragma once
32

43
#include <string>
54

@@ -14,5 +13,3 @@ class IMyImpl2 {
1413
static std::string name() { return "IMyImpl2"; }
1514
virtual void doSomething2() = 0;
1615
};
17-
18-
#endif // MY_IMPL_H

src/wsjcpp_employees.cpp

Lines changed: 23 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,35 @@
1+
/**********************************************************************************
2+
* Copyright (c) 2020-2025 Evgenii Sopov <mrseakg@gmail.com>
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy
5+
* of this software and associated documentation files (the "Software"), to deal
6+
* in the Software without restriction, including without limitation the rights
7+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
* copies of the Software, and to permit persons to whom the Software is
9+
* furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in all
12+
* copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
* SOFTWARE.
21+
*
22+
***********************************************************************************/
23+
124
#include "wsjcpp_employees.h"
225
#include <algorithm>
326
#include <iostream>
427
#include <wsjcpp_core.h>
528

6-
// ---------------------------------------------------------------------
7-
829
std::map<std::string, WsjcppEmployBase *> *g_pWsjcppEmployees = nullptr;
930
std::vector<std::string> *g_pWsjcppInitEmployees = nullptr;
1031
std::vector<std::string> *g_pWsjcppInitWith = nullptr;
1132

12-
// ---------------------------------------------------------------------
13-
1433
void WsjcppEmployees::initGlobalVariables() {
1534
if (g_pWsjcppEmployees == nullptr) {
1635
// WsjcppLog::info(std::string(), "Create employees map");
@@ -26,8 +45,6 @@ void WsjcppEmployees::initGlobalVariables() {
2645
}
2746
}
2847

29-
// ---------------------------------------------------------------------
30-
3148
void WsjcppEmployees::deinitGlobalVariables() {
3249
const std::string TAG = "WsjcppEmployees::deinit";
3350
if (g_pWsjcppEmployees != nullptr) {
@@ -56,8 +73,6 @@ void WsjcppEmployees::deinitGlobalVariables() {
5673
}
5774
}
5875

59-
// ---------------------------------------------------------------------
60-
6176
void WsjcppEmployees::addEmploy(const std::string &sName, WsjcppEmployBase *pEmploy) {
6277
WsjcppEmployees::initGlobalVariables();
6378
if (g_pWsjcppEmployees->find(sName) != g_pWsjcppEmployees->end()) {
@@ -68,8 +83,6 @@ void WsjcppEmployees::addEmploy(const std::string &sName, WsjcppEmployBase *pEmp
6883
}
6984
}
7085

71-
// ---------------------------------------------------------------------
72-
7386
bool WsjcppEmployees::init(const std::vector<std::string> &vStart, bool bSilent) {
7487
WsjcppEmployees::initGlobalVariables();
7588
std::string TAG = "WsjcppEmployees::init";
@@ -161,8 +174,6 @@ bool WsjcppEmployees::deinit(bool bSilent) {
161174
return true;
162175
}
163176

164-
// ---------------------------------------------------------------------
165-
166177
void WsjcppEmployees::recoursiveTestDependencies(const std::vector<std::string> &vNames) {
167178
std::vector<std::string> v = vNames;
168179
std::string sEmployName = v[v.size() - 1];
@@ -208,31 +219,23 @@ WsjcppEmployBase::WsjcppEmployBase(const std::vector<std::string> &vNames, const
208219
WsjcppEmployees::recoursiveTestDependencies(m_vNames);
209220
}
210221

211-
// ---------------------------------------------------------------------
212-
213222
WsjcppEmployBase::~WsjcppEmployBase() {
214223
// nothing
215224
}
216225

217-
// ---------------------------------------------------------------------
218-
219226
const std::vector<std::string> &WsjcppEmployBase::loadAfter() { return m_vLoadAfter; }
220227

221228
// ---------------------------------------------------------------------
222229
// WsjcppEmployRuntimeGlobalCache
223230

224231
REGISTRY_WJSCPP_SERVICE_LOCATOR(WsjcppEmployRuntimeGlobalCache)
225232

226-
// ---------------------------------------------------------------------
227-
228233
WsjcppEmployRuntimeGlobalCache::WsjcppEmployRuntimeGlobalCache()
229234
: WsjcppEmployBase({WsjcppEmployRuntimeGlobalCache::name()}, {}) {
230235

231236
TAG = WsjcppEmployRuntimeGlobalCache::name();
232237
}
233238

234-
// ---------------------------------------------------------------------
235-
236239
bool WsjcppEmployRuntimeGlobalCache::init(const std::string &sName, bool bSilent) {
237240
// checking settings
238241
if (!bSilent) {
@@ -241,8 +244,6 @@ bool WsjcppEmployRuntimeGlobalCache::init(const std::string &sName, bool bSilent
241244
return true;
242245
}
243246

244-
// ---------------------------------------------------------------------
245-
246247
bool WsjcppEmployRuntimeGlobalCache::deinit(const std::string &sName, bool bSilent) {
247248
// checking settings
248249
if (!bSilent) {
@@ -252,25 +253,17 @@ bool WsjcppEmployRuntimeGlobalCache::deinit(const std::string &sName, bool bSile
252253
return true;
253254
}
254255

255-
// ---------------------------------------------------------------------
256-
257256
void WsjcppEmployRuntimeGlobalCache::set(const std::string &sName, const std::string &sValue) {
258257
m_sStringMap[sName] = sValue;
259258
}
260259

261-
// ---------------------------------------------------------------------
262-
263260
bool WsjcppEmployRuntimeGlobalCache::has(const std::string &sName) {
264261
return m_sStringMap.find(sName) != m_sStringMap.end();
265262
}
266263

267-
// ---------------------------------------------------------------------
268-
269264
std::string WsjcppEmployRuntimeGlobalCache::get(const std::string &sName) {
270265
if (m_sStringMap.find(sName) != m_sStringMap.end()) {
271266
return m_sStringMap[sName];
272267
}
273268
return "";
274269
}
275-
276-
// ---------------------------------------------------------------------

src/wsjcpp_employees.h

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,27 @@
1-
#ifndef WSJCPP_EMPLOYEES_H
2-
#define WSJCPP_EMPLOYEES_H
1+
/**********************************************************************************
2+
* Copyright (c) 2020-2025 Evgenii Sopov <mrseakg@gmail.com>
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy
5+
* of this software and associated documentation files (the "Software"), to deal
6+
* in the Software without restriction, including without limitation the rights
7+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
* copies of the Software, and to permit persons to whom the Software is
9+
* furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in all
12+
* copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
* SOFTWARE.
21+
*
22+
***********************************************************************************/
23+
24+
#pragma once
325

426
#include <map>
527
#include <mutex>
@@ -105,5 +127,3 @@ class WsjcppEmployRuntimeGlobalCache : public WsjcppEmployBase {
105127
std::string TAG;
106128
std::map<std::string, std::string> m_sStringMap;
107129
};
108-
109-
#endif // WSJCPP_EMPLOYEES_H

0 commit comments

Comments
 (0)