Skip to content
This repository was archived by the owner on Aug 16, 2026. It is now read-only.

Commit aa5145f

Browse files
committed
Applied .clang-format and updated yesr in copyright
1 parent d2ac6aa commit aa5145f

4 files changed

Lines changed: 122 additions & 181 deletions

File tree

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-2025 wsjcpp
3+
Copyright (c) 2020-2026 wsjcpp
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

src/main.cpp

Lines changed: 51 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -22,70 +22,64 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2222
SOFTWARE.
2323
*/
2424

25-
#include <string.h>
26-
#include <iostream>
2725
#include <algorithm>
26+
#include <iostream>
27+
#include <string.h>
2828
#include <wsjcpp_core.h>
2929
#include <wsjcpp_validators.h>
3030

31-
int main(int argc, char* argv[]) {
32-
std::string TAG = "MAIN";
31+
int main(int argc, char *argv[]) {
32+
std::string TAG = "MAIN";
3333

34-
if (!wsjcpp::dir_exists(".wsjcpp")) {
35-
WsjcppCore::makeDir(".wsjcpp");
36-
}
37-
std::string appLogPath = ".wsjcpp/logs";
38-
if (!wsjcpp::dir_exists(appLogPath)) {
39-
WsjcppCore::makeDir(appLogPath);
40-
}
41-
WsjcppLog::setPrefixLogFile("wsjcpp_validators");
42-
WsjcppLog::setLogDirectory(".wsjcpp/logs");
34+
if (!wsjcpp::dir_exists(".wsjcpp")) {
35+
WsjcppCore::makeDir(".wsjcpp");
36+
}
37+
std::string appLogPath = ".wsjcpp/logs";
38+
if (!wsjcpp::dir_exists(appLogPath)) {
39+
WsjcppCore::makeDir(appLogPath);
40+
}
41+
WsjcppLog::setPrefixLogFile("wsjcpp_validators");
42+
WsjcppLog::setLogDirectory(".wsjcpp/logs");
4343

44-
// WsjcppLog::info(TAG, "Hello");
45-
WsjcppCore::init(
46-
argc, argv,
47-
std::string(WSJCPP_APP_NAME),
48-
std::string(WSJCPP_APP_VERSION),
49-
"Evgenii Sopov",
50-
""
51-
);
52-
if (argc != 2) {
53-
std::cout << "Usage " << argv[0] << " something" << std::endl;
54-
return -1;
55-
}
56-
std::string sArg1(argv[1]);
44+
// WsjcppLog::info(TAG, "Hello");
45+
WsjcppCore::init(argc, argv, std::string(WSJCPP_APP_NAME), std::string(WSJCPP_APP_VERSION), "Evgenii Sopov", "");
46+
if (argc != 2) {
47+
std::cout << "Usage " << argv[0] << " something" << std::endl;
48+
return -1;
49+
}
50+
std::string sArg1(argv[1]);
5751

58-
std::vector<WsjcppValidatorStringBase *> vValidators;
59-
// vValidators.push_back(new WsjcppValidatorStringLength(5, 100));
60-
// vValidators.push_back(new WsjcppValidatorStringLength(1, 5));
61-
vValidators.push_back(new WsjcppValidatorEmail());
62-
vValidators.push_back(new WsjcppValidatorUUID());
63-
vValidators.push_back(new WsjcppValidatorStringListBase("lang", {"en", "de", "ru"}));
64-
vValidators.push_back(new WsjcppValidatorStringRegexpBase("testre", "^[a-zA-Z]+$"));
65-
vValidators.push_back(new WsjcppValidatorJWT());
66-
vValidators.push_back(new WsjcppValidatorDate());
67-
vValidators.push_back(new WsjcppValidatorTimeH24());
68-
vValidators.push_back(new WsjcppValidatorDateTime());
69-
// vValidators.push_back(new WsjcppValidatorURL());
70-
vValidators.push_back(new WsjcppValidatorBase64());
71-
vValidators.push_back(new WsjcppValidatorNumber());
72-
vValidators.push_back(new WsjcppValidatorHex());
52+
std::vector<WsjcppValidatorStringBase *> vValidators;
53+
// vValidators.push_back(new WsjcppValidatorStringLength(5, 100));
54+
// vValidators.push_back(new WsjcppValidatorStringLength(1, 5));
55+
vValidators.push_back(new WsjcppValidatorEmail());
56+
vValidators.push_back(new WsjcppValidatorUUID());
57+
vValidators.push_back(new WsjcppValidatorStringListBase("lang", {"en", "de", "ru"}));
58+
vValidators.push_back(new WsjcppValidatorStringRegexpBase("testre", "^[a-zA-Z]+$"));
59+
vValidators.push_back(new WsjcppValidatorJWT());
60+
vValidators.push_back(new WsjcppValidatorDate());
61+
vValidators.push_back(new WsjcppValidatorTimeH24());
62+
vValidators.push_back(new WsjcppValidatorDateTime());
63+
// vValidators.push_back(new WsjcppValidatorURL());
64+
vValidators.push_back(new WsjcppValidatorBase64());
65+
vValidators.push_back(new WsjcppValidatorNumber());
66+
vValidators.push_back(new WsjcppValidatorHex());
7367

74-
std::string sResult = "";
75-
for (int i = 0; i < vValidators.size(); i++) {
76-
WsjcppValidatorStringBase *pValidator = vValidators[i];
77-
std::string sError;
78-
if (sResult.size() > 0) {
79-
sResult += ",";
80-
}
81-
if (pValidator->isValid(sArg1, sError)) {
82-
sResult += " +" + pValidator->getTypeName();
83-
// WsjcppLog::ok(TAG, "ok -> [" + pValidator->getTypeName() + "]: '" + sArg1 + "'");
84-
} else {
85-
sResult += " -" + pValidator->getTypeName();
86-
// WsjcppLog::err(TAG, "fail -> [" + pValidator->getTypeName() + "]: '" + sArg1 + "' - " + sError);
87-
}
68+
std::string sResult = "";
69+
for (int i = 0; i < vValidators.size(); i++) {
70+
WsjcppValidatorStringBase *pValidator = vValidators[i];
71+
std::string sError;
72+
if (sResult.size() > 0) {
73+
sResult += ",";
74+
}
75+
if (pValidator->isValid(sArg1, sError)) {
76+
sResult += " +" + pValidator->getTypeName();
77+
// WsjcppLog::ok(TAG, "ok -> [" + pValidator->getTypeName() + "]: '" + sArg1 + "'");
78+
} else {
79+
sResult += " -" + pValidator->getTypeName();
80+
// WsjcppLog::err(TAG, "fail -> [" + pValidator->getTypeName() + "]: '" + sArg1 + "' - " + sError);
8881
}
89-
std::cout << sResult << std::endl;
90-
return 0;
82+
}
83+
std::cout << sResult << std::endl;
84+
return 0;
9185
}

0 commit comments

Comments
 (0)