mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-06-16 07:07:13 +02:00
Initial preparations for CURL and Discord integration.
This commit is contained in:
20
module/Library/CURL.cpp
Normal file
20
module/Library/CURL.cpp
Normal file
@ -0,0 +1,20 @@
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include "Library/CURL.hpp"
|
||||
#include "Base/Shared.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
||||
// ================================================================================================
|
||||
void Register_CURL(HSQUIRRELVM vm)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
} // Namespace:: SqMod
|
14
module/Library/CURL.hpp
Normal file
14
module/Library/CURL.hpp
Normal file
@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include "SqBase.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include <cpr/cpr.h>
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
|
||||
|
||||
} // Namespace:: SqMod
|
@ -98,7 +98,7 @@ String AES256::Encrypt(CSStr data)
|
||||
aes256_encrypt_ecb(&m_Context, reinterpret_cast< Uint8 * >(&str[n]));
|
||||
}
|
||||
// Return ownership of the encrypted string
|
||||
return std::move(str);
|
||||
return str;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
@ -127,7 +127,7 @@ String AES256::Decrypt(CSStr data)
|
||||
str.pop_back();
|
||||
}
|
||||
// Return ownership of the encrypted string
|
||||
return std::move(str);
|
||||
return str;
|
||||
}
|
||||
|
||||
// ================================================================================================
|
||||
|
20
module/Library/Discord.cpp
Normal file
20
module/Library/Discord.cpp
Normal file
@ -0,0 +1,20 @@
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include "Library/Discord.hpp"
|
||||
#include "Base/Shared.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
||||
// ================================================================================================
|
||||
void Register_Discord(HSQUIRRELVM vm)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
} // Namespace:: SqMod
|
11
module/Library/Discord.hpp
Normal file
11
module/Library/Discord.hpp
Normal file
@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include "SqBase.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
|
||||
|
||||
} // Namespace:: SqMod
|
@ -193,7 +193,7 @@ static SQInteger SqNanL(HSQUIRRELVM vm)
|
||||
{
|
||||
return sq_throwerror(vm, e.what());
|
||||
}
|
||||
catch (const std::exception e)
|
||||
catch (const std::exception & e)
|
||||
{
|
||||
return sq_throwerror(vm, e.what());
|
||||
}
|
||||
@ -698,7 +698,7 @@ static SQInteger SqRoundL(HSQUIRRELVM vm)
|
||||
{
|
||||
return sq_throwerror(vm, e.what());
|
||||
}
|
||||
catch (const std::exception e)
|
||||
catch (const std::exception & e)
|
||||
{
|
||||
return sq_throwerror(vm, e.what());
|
||||
}
|
||||
|
@ -363,7 +363,7 @@ static String RandomString(Int32 len)
|
||||
// Request the random fill
|
||||
GetRandomString(str, len);
|
||||
// Return ownership of the string
|
||||
return std::move(str);
|
||||
return str;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
@ -377,7 +377,7 @@ static String RandomString(Int32 len, SQChar n)
|
||||
// Request the random fill
|
||||
GetRandomString(str, len, n);
|
||||
// Return ownership of the string
|
||||
return std::move(str);
|
||||
return str;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
@ -391,7 +391,7 @@ static String RandomString(Int32 len, SQChar m, SQChar n)
|
||||
// Request the random fill
|
||||
GetRandomString(str, len, m, n);
|
||||
// Return ownership of the string
|
||||
return std::move(str);
|
||||
return str;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
@ -21,10 +21,6 @@ SQMODE_DECL_TYPENAME(SQLiteColumnTypename, _SC("SQLiteColumn"))
|
||||
SQMODE_DECL_TYPENAME(SQLiteStatementTypename, _SC("SQLiteStatement"))
|
||||
SQMODE_DECL_TYPENAME(SQLiteTransactionTypename, _SC("SQLiteTransaction"))
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#pragma clang diagnostic push
|
||||
#pragma ide diagnostic ignored "hicpp-signed-bitwise"
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Helper class that represents an integral enumeration value. Used to reduce compilation times.
|
||||
*/
|
||||
@ -371,7 +367,6 @@ static const SEnumElement g_MainEnum[] = {
|
||||
{_SC("WARNING"), SQLITE_WARNING},
|
||||
{_SC("WARNING_AUTOINDEX"), SQLITE_WARNING_AUTOINDEX}
|
||||
};
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
static inline bool IsDigitsOnly(CSStr str)
|
||||
@ -874,7 +869,7 @@ void SQLiteConnection::TraceOutput(void * /*ptr*/, CCStr sql)
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void SQLiteConnection::ProfileOutput(void * /*ptr*/, CCStr sql, sqlite3_uint64 time)
|
||||
{
|
||||
LogInf("SQLite profile (time: %llu): %s", time, sql);
|
||||
LogInf("SQLite profile (time: %" PRINT_UINT_FMT "): %s", time, sql);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
@ -233,7 +233,7 @@ static Buffer StrJustAlphaNumImpl(CSStr str, Uint32 len)
|
||||
// Move the cursor to the end
|
||||
b.Move(n);
|
||||
// Return ownership of the buffer
|
||||
return std::move(b);
|
||||
return b;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
@ -295,7 +295,7 @@ static Buffer StrToLowercaseImpl(CSStr str, Uint32 len)
|
||||
// Move the cursor to the end
|
||||
b.Move(n);
|
||||
// Return ownership of the buffer
|
||||
return std::move(b);
|
||||
return b;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
@ -357,7 +357,7 @@ static Buffer StrToUppercaseImpl(CSStr str, Uint32 len)
|
||||
// Move the cursor to the end
|
||||
b.Move(n);
|
||||
// Return ownership of the buffer
|
||||
return std::move(b);
|
||||
return b;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
@ -113,7 +113,7 @@ Buffer SysEnv::Get(CCStr name, CCStr fallback)
|
||||
// Forward the call to the shared function
|
||||
Get(b, name, fallback);
|
||||
// Return ownership of the buffer
|
||||
return std::move(b);
|
||||
return b;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
@ -544,7 +544,7 @@ Buffer SysEnv::ExpandVars(CCStr str)
|
||||
// Forward the call to the internal function
|
||||
ExpandVars(b, str, str + len);
|
||||
// Return ownership of the buffer
|
||||
return std::move(b);
|
||||
return b;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
@ -560,7 +560,7 @@ Buffer SysEnv::ExpandVars(const String & str)
|
||||
// Forward the call to the internal function
|
||||
ExpandVars(b, str.c_str(), str.c_str() + str.size());
|
||||
// Return ownership of the buffer
|
||||
return std::move(b);
|
||||
return b;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
@ -616,7 +616,7 @@ Buffer SysEnv::ExpandPath(CCStr path)
|
||||
// Forward the call to the internal function
|
||||
ExpandPath(b, path, path + len);
|
||||
// Return ownership of the buffer
|
||||
return std::move(b);
|
||||
return b;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
@ -632,7 +632,7 @@ Buffer SysEnv::ExpandPath(const String & path)
|
||||
// Forward the call to the internal function
|
||||
ExpandPath(b, path.c_str(), path.c_str() + path.size());
|
||||
// Return ownership of the buffer
|
||||
return std::move(b);
|
||||
return b;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
@ -683,7 +683,7 @@ Buffer SysEnv::WorkingDir()
|
||||
// Forward the call to the regular function
|
||||
WorkingDir(b);
|
||||
// Return ownership of the buffer
|
||||
return std::move(b);
|
||||
return b;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
@ -696,7 +696,7 @@ void SysEnv::HomeDir(Buffer & b)
|
||||
b.Grow(SQMOD_MAX_PATH - b.Remaining() + 2);
|
||||
}
|
||||
// Try the primary method of retrieving the home directory
|
||||
if (SUCCEEDED(SHGetFolderPathA(NULL, CSIDL_PROFILE, nullptr, 0, &b.Cursor())))
|
||||
if (SUCCEEDED(SHGetFolderPathA(nullptr, CSIDL_PROFILE, nullptr, 0, &b.Cursor())))
|
||||
{
|
||||
// Move the edit cursor to the end of the appended data
|
||||
b.Advance(strlen(&b.Cursor()));
|
||||
@ -753,7 +753,7 @@ Buffer SysEnv::HomeDir()
|
||||
// Forward the call to the regular function
|
||||
HomeDir(b);
|
||||
// Return ownership of the buffer
|
||||
return std::move(b);
|
||||
return b;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
@ -795,7 +795,7 @@ Buffer SysEnv::ConfigHomeDir()
|
||||
// Forward the call to the regular function
|
||||
ConfigHomeDir(b);
|
||||
// Return ownership of the buffer
|
||||
return std::move(b);
|
||||
return b;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
@ -834,7 +834,7 @@ Buffer SysEnv::DataHomeDir()
|
||||
// Forward the call to the regular function
|
||||
DataHomeDir(b);
|
||||
// Return ownership of the buffer
|
||||
return std::move(b);
|
||||
return b;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
@ -861,7 +861,7 @@ Buffer SysEnv::TempHomeDir()
|
||||
// Forward the call to the regular function
|
||||
TempHomeDir(b);
|
||||
// Return ownership of the buffer
|
||||
return std::move(b);
|
||||
return b;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
@ -888,7 +888,7 @@ Buffer SysEnv::CacheHomeDir()
|
||||
// Forward the call to the regular function
|
||||
CacheHomeDir(b);
|
||||
// Return ownership of the buffer
|
||||
return std::move(b);
|
||||
return b;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
@ -962,7 +962,7 @@ Buffer SysEnv::TempDir()
|
||||
// Forward the call to the regular function
|
||||
TempDir(b);
|
||||
// Return ownership of the buffer
|
||||
return std::move(b);
|
||||
return b;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
@ -1004,7 +1004,7 @@ Buffer SysEnv::ConfigDir()
|
||||
// Forward the call to the regular function
|
||||
ConfigDir(b);
|
||||
// Return ownership of the buffer
|
||||
return std::move(b);
|
||||
return b;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
@ -1051,7 +1051,7 @@ Buffer SysEnv::SystemDir()
|
||||
// Forward the call to the regular function
|
||||
SystemDir(b);
|
||||
// Return ownership of the buffer
|
||||
return std::move(b);
|
||||
return b;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
@ -1080,7 +1080,7 @@ Buffer SysEnv::NullDir()
|
||||
// Make sure that whatever string is in the buffer, if any, is null terminated
|
||||
b.Cursor() = '\0';
|
||||
// Return ownership of the buffer
|
||||
return std::move(b);
|
||||
return b;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
@ -76,7 +76,7 @@ Buffer GetRealFilePath(CSStr path)
|
||||
#endif // SQMOD_OS_WINDOWS
|
||||
|
||||
// Return ownership of the buffer
|
||||
return std::move(b);
|
||||
return b;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
@ -1207,7 +1207,7 @@ SysPath SysPath::Parent() const
|
||||
// Force the copy to be parent
|
||||
p.MakeParent();
|
||||
// Return ownership of copy
|
||||
return std::move(p);
|
||||
return p;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
@ -1530,7 +1530,7 @@ Buffer SysPath::BuildUnix() const
|
||||
// Make sure the string is null terminated
|
||||
b.Cursor() = '\0';
|
||||
// Return ownership of buffer
|
||||
return std::move(b);
|
||||
return b;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
@ -1570,7 +1570,7 @@ Buffer SysPath::BuildWindows() const
|
||||
// Make sure the string is null terminated
|
||||
b.Cursor() = '\0';
|
||||
// Return ownership of buffer
|
||||
return std::move(b);
|
||||
return b;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user