1
0
mirror of https://github.com/ScrelliCopter/tmx2gba.git synced 2025-02-21 03:29:25 +11:00

collect string handling utility functions into strtools

This commit is contained in:
2024-04-11 05:16:11 +10:00
parent 2638bf2667
commit fcb9eceec3
6 changed files with 159 additions and 128 deletions

View File

@@ -10,6 +10,7 @@ constexpr std::string_view copyrightStr("(c) 2015-2024 a dinosaur");
#include "convert.hpp"
#include "headerwriter.hpp"
#include "swriter.hpp"
#include "strtools.hpp"
#include "config.h"
#include <iostream>
#include <map>
@@ -115,26 +116,6 @@ static bool ParseArgs(int argc, char** argv, Arguments& params)
return true;
}
static std::string SanitiseLabel(const std::string_view ident)
{
std::string out;
out.reserve(ident.length());
int last = '_';
for (int i : ident)
{
if (out.empty() && std::isdigit(i))
continue;
if (!std::isalnum(i))
i = '_';
if (i != '_' || last != '_')
out.push_back(i);
last = i;
}
return out;
}
int main(int argc, char** argv)
{
Arguments p;