1+ /*
2+ * MIT License
3+ *
4+ * Copyright (c) 2019-2026 Evgenii Sopov
5+ *
6+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7+ * of this software and associated documentation files (the "Software"), to deal
8+ * in the Software without restriction, including without limitation the rights
9+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+ * copies of the Software, and to permit persons to whom the Software is
11+ * furnished to do so, subject to the following conditions:
12+ *
13+ * The above copyright notice and this permission notice shall be included in all
14+ * copies or substantial portions of the Software.
15+ *
16+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+ * SOFTWARE.
23+ */
24+
25+ // original source-code: https://github.com/wsjcpp/wsjcpp-core
26+
127#include " wsjcpp_core.h"
228
329#ifndef _MSC_VER
430 #include < dirent.h>
531 #include < sys/time.h>
632 #include < unistd.h>
733 #include < arpa/inet.h>
8- #else
34+ #else
935 #include < direct.h>
1036 #define PATH_MAX 256
1137#endif
@@ -1297,3 +1323,36 @@ bool WsjcppResourcesManager::extractFiles(const std::string &sWorkspace) {
12971323}
12981324*/
12991325
1326+ namespace wsjcpp {
1327+
1328+ const std::string &Core::englishAlphabetLowerCase () {
1329+ static const std::string ret = " abcdefghijklmnopqrstuvwxyz" ;
1330+ return ret;
1331+ }
1332+
1333+ const std::string &Core::englishAlphabetUpperCase () {
1334+ static const std::string ret = " ABCDEFGHIJKLMNOPQRSTUVWXYZ" ;
1335+ return ret;
1336+ }
1337+
1338+ const std::string &Core::englishAlphabetBothCase () {
1339+ static const std::string ret = " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" ;
1340+ return ret;
1341+ }
1342+
1343+ const std::string &Core::englishAlphabetBothCaseAndNumbers () {
1344+ static const std::string ret = " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" ;
1345+ return ret;
1346+ }
1347+
1348+ std::string Core::randomString (const std::string &alphabet, int length) {
1349+ std::string ret = " " ;
1350+ ret.resize (length, alphabet[0 ]);
1351+ int alphabet_len = alphabet.length ();
1352+ for (int i = 0 ; i < length; i++) {
1353+ ret[i] = alphabet[rand () % alphabet_len];
1354+ }
1355+ return ret;
1356+ }
1357+
1358+ } // namespace wsjcpp
0 commit comments