mirror of
https://github.com/zeldaret/mm.git
synced 2026-06-04 10:48:25 -04:00
01a6dea813
* git subrepo pull tools/ZAPD --force subrepo: subdir: "tools/ZAPD" merged: "e02e151c" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "e02e151c" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull tools/decomp-permuter --force subrepo: subdir: "tools/decomp-permuter" merged: "86b1975e" upstream: origin: "https://github.com/simonlindholm/decomp-permuter.git" branch: "main" commit: "86b1975e" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull tools/graphovl --force subrepo: subdir: "tools/graphovl" merged: "eb25be94" upstream: origin: "https://github.com/AngheloAlf/graphovl.git" branch: "master" commit: "eb25be94" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull (merge) tools/z64compress --force subrepo: subdir: "tools/z64compress" merged: "98ef0ac2" upstream: origin: "https://github.com/z64me/z64compress.git" branch: "main" commit: "98ef0ac2" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull tools/ZAPD --force subrepo: subdir: "tools/ZAPD" merged: "45cb0d6b" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "45cb0d6b" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull tools/asm-differ --force subrepo: subdir: "tools/asm-differ" merged: "48e675ff" upstream: origin: "https://github.com/simonlindholm/asm-differ.git" branch: "main" commit: "48e675ff" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull tools/ZAPD --force subrepo: subdir: "tools/ZAPD" merged: "3c00dcb3" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "3c00dcb3" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull tools/asm-differ --force subrepo: subdir: "tools/asm-differ" merged: "47c94c99" upstream: origin: "https://github.com/simonlindholm/asm-differ.git" branch: "main" commit: "47c94c99" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * Declare required textures * Name texture, add decomp.me permuter settings * git subrepo pull tools/ZAPD --force subrepo: subdir: "tools/ZAPD" merged: "913810fc" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "913810fc" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull tools/asm-differ --force subrepo: subdir: "tools/asm-differ" merged: "97197f2a" upstream: origin: "https://github.com/simonlindholm/asm-differ.git" branch: "main" commit: "97197f2a" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull tools/ZAPD --force subrepo: subdir: "tools/ZAPD" merged: "623d779f" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "623d779f" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull tools/asm-differ --force subrepo: subdir: "tools/asm-differ" merged: "55bba23a" upstream: origin: "https://github.com/simonlindholm/asm-differ.git" branch: "main" commit: "55bba23a" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull tools/decomp-permuter --force subrepo: subdir: "tools/decomp-permuter" merged: "a20bac94" upstream: origin: "https://github.com/simonlindholm/decomp-permuter.git" branch: "main" commit: "a20bac94" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596"
115 lines
2.4 KiB
C++
115 lines
2.4 KiB
C++
#pragma once
|
|
|
|
#include <algorithm>
|
|
#include <cstring>
|
|
#include <numeric>
|
|
#include <stdarg.h>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#ifdef _MSC_VER
|
|
#define __PRETTY_FUNCTION__ __FUNCSIG__
|
|
#elif not defined(__GNUC__)
|
|
#define __PRETTY_FUNCTION__ __func__
|
|
#endif
|
|
|
|
class StringHelper
|
|
{
|
|
public:
|
|
static std::vector<std::string> Split(std::string s, const std::string& delimiter)
|
|
{
|
|
std::vector<std::string> result;
|
|
|
|
size_t pos = 0;
|
|
std::string token;
|
|
|
|
while ((pos = s.find(delimiter)) != std::string::npos)
|
|
{
|
|
token = s.substr(0, pos);
|
|
result.push_back(token);
|
|
s.erase(0, pos + delimiter.length());
|
|
}
|
|
|
|
if (s.length() != 0)
|
|
result.push_back(s);
|
|
|
|
return result;
|
|
}
|
|
|
|
static std::string Strip(std::string s, const std::string& delimiter)
|
|
{
|
|
size_t pos = 0;
|
|
std::string token;
|
|
|
|
while ((pos = s.find(delimiter)) != std::string::npos)
|
|
{
|
|
token = s.substr(0, pos);
|
|
s.erase(pos, pos + delimiter.length());
|
|
}
|
|
|
|
return s;
|
|
}
|
|
|
|
static std::string Replace(std::string str, const std::string& from, const std::string& to)
|
|
{
|
|
size_t start_pos = str.find(from);
|
|
|
|
if (start_pos == std::string::npos)
|
|
return str;
|
|
|
|
str.replace(start_pos, from.length(), to);
|
|
return str;
|
|
}
|
|
|
|
static bool StartsWith(const std::string& s, const std::string& input)
|
|
{
|
|
return s.rfind(input, 0) == 0;
|
|
}
|
|
|
|
static bool Contains(const std::string& s, const std::string& input)
|
|
{
|
|
return s.find(input) != std::string::npos;
|
|
}
|
|
|
|
static bool EndsWith(const std::string& s, const std::string& input)
|
|
{
|
|
size_t inputLen = strlen(input.c_str());
|
|
return s.rfind(input) == (s.size() - inputLen);
|
|
}
|
|
|
|
static std::string Sprintf(const char* format, ...)
|
|
{
|
|
char buffer[32768];
|
|
// char buffer[2048];
|
|
std::string output = "";
|
|
va_list va;
|
|
|
|
va_start(va, format);
|
|
vsprintf(buffer, format, va);
|
|
va_end(va);
|
|
|
|
output = buffer;
|
|
return output;
|
|
}
|
|
|
|
static std::string Implode(std::vector<std::string>& elements, const char* const separator)
|
|
{
|
|
return std::accumulate(std::begin(elements), std::end(elements), std::string(),
|
|
[separator](std::string& ss, std::string& s) {
|
|
return ss.empty() ? s : ss + separator + s;
|
|
});
|
|
}
|
|
|
|
static int64_t StrToL(const std::string& str, int32_t base = 10)
|
|
{
|
|
return std::strtoull(str.c_str(), nullptr, base);
|
|
}
|
|
|
|
static std::string BoolStr(bool b) { return b ? "true" : "false"; }
|
|
|
|
static bool HasOnlyDigits(const std::string& str)
|
|
{
|
|
return std::all_of(str.begin(), str.end(), ::isdigit);
|
|
}
|
|
};
|