mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-08-23 17:23:44 +08:00
replay: replace Qt data types with standard C++ data types (#33823)
replace Qt data types with c++ data types
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
#include <map>
|
||||
#include <mutex>
|
||||
#include <numeric>
|
||||
#include <sstream>
|
||||
#include <utility>
|
||||
#include <zstd.h>
|
||||
|
||||
@@ -390,6 +391,35 @@ std::string sha256(const std::string &str) {
|
||||
return util::hexdump(hash, SHA256_DIGEST_LENGTH);
|
||||
}
|
||||
|
||||
std::vector<std::string> split(std::string_view source, char delimiter) {
|
||||
std::vector<std::string> fields;
|
||||
size_t last = 0;
|
||||
for (size_t i = 0; i < source.length(); ++i) {
|
||||
if (source[i] == delimiter) {
|
||||
fields.emplace_back(source.substr(last, i - last));
|
||||
last = i + 1;
|
||||
}
|
||||
}
|
||||
fields.emplace_back(source.substr(last));
|
||||
return fields;
|
||||
}
|
||||
|
||||
std::string join(const std::vector<std::string> &elements, char separator) {
|
||||
std::ostringstream oss;
|
||||
for (size_t i = 0; i < elements.size(); ++i) {
|
||||
if (i != 0) oss << separator;
|
||||
oss << elements[i];
|
||||
}
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
std::string extractFileName(const std::string &file) {
|
||||
size_t queryPos = file.find_first_of("?");
|
||||
std::string path = (queryPos != std::string::npos) ? file.substr(0, queryPos) : file;
|
||||
size_t lastSlash = path.find_last_of("/\\");
|
||||
return (lastSlash != std::string::npos) ? path.substr(lastSlash + 1) : path;
|
||||
}
|
||||
|
||||
// MonotonicBuffer
|
||||
|
||||
void *MonotonicBuffer::allocate(size_t bytes, size_t alignment) {
|
||||
|
||||
Reference in New Issue
Block a user