mirror of
https://github.com/scp-fs2open/fs2open.github.com.git
synced 2026-11-10 17:46:53 -10:00
* initial version of default_settings.tbl * Add a way to change player detail level defaults and implement a couple more options to detail_settings.tbl * support the rest of 2d.cpp options * Allow enforcing options to a specific value * modernize detail defaults, levels, and values * Fix parsing issue and remove lambda capture by reference * fix print * clang * More efficient +Enforce parsing * cleanup * typo * don't negate this * error_display * clarify language between presets, levels, and values * add default case * small fix * use a map to minimize string lookups
39 lines
786 B
C++
39 lines
786 B
C++
#pragma once
|
|
|
|
#include "globalincs/pstypes.h"
|
|
|
|
namespace util {
|
|
|
|
template <typename Out>
|
|
void split_string(const SCP_string& s, char delim, Out result)
|
|
{
|
|
SCP_stringstream ss(s);
|
|
SCP_string item;
|
|
while (std::getline(ss, item, delim)) {
|
|
if (!item.empty()) {
|
|
*(result++) = item;
|
|
}
|
|
}
|
|
}
|
|
|
|
std::vector<std::string> split_string(const std::string& s, char delim);
|
|
|
|
bool isStringOneOf(const std::string& value, const std::vector<std::string>& candidates);
|
|
|
|
// get a filename minus any leading path
|
|
template <typename T>
|
|
T *get_file_part(T *path)
|
|
{
|
|
T *p = path + strlen(path)-1;
|
|
|
|
// Move p to point to first character of filename (check both types of dir separator)
|
|
while( (p >= path) && (*p != '\\') && (*p != '/') && (*p != ':') )
|
|
p--;
|
|
|
|
p++;
|
|
|
|
return p;
|
|
}
|
|
|
|
} // namespace util
|