libultraship
Reimplementations of libultra (N64 SDK) functions for modern hardware
Loading...
Searching...
No Matches
Utils.h
Go to the documentation of this file.
1#pragma once
2
3#include <string>
4#include <vector>
5#include <sstream>
6
7namespace Ship {
8
12namespace Math {
13
21float clamp(float d, float min, float max);
22
33size_t HashCombine(size_t lhs, size_t rhs);
34
44template <typename Numeric> bool IsNumber(const std::string& s) {
45 Numeric n;
46 return ((std::istringstream(s) >> n >> std::ws).eof());
47}
48} // namespace Math
49
58std::vector<std::string> splitText(const std::string& text, char separator, bool keepQuotes);
59
65std::string toLowerCase(std::string in);
66} // namespace Ship
size_t HashCombine(size_t lhs, size_t rhs)
Combines two size_t hash values into a single hash.
float clamp(float d, float min, float max)
Clamps d to the inclusive range [min, max].
bool IsNumber(const std::string &s)
Returns true if s represents a valid number of type Numeric.
Definition Utils.h:44
Core namespace for the libultraship engine framework.
Definition gfx_direct3d_common.h:14
std::vector< std::string > splitText(const std::string &text, char separator, bool keepQuotes)
Splits text at each separator character, optionally preserving quoted spans.
std::string toLowerCase(std::string in)
Returns a copy of in with all ASCII letters converted to lower case.