You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.7 KiB
C++
55 lines
1.7 KiB
C++
/******************************************************************************
|
|
* File - helpers.h
|
|
* Author - Joey Pollack
|
|
* Date - 2021/08/30 (y/m/d)
|
|
* Mod Date - 2021/08/30 (y/m/d)
|
|
* Description - Defines some helper methods for use through out the engine.
|
|
******************************************************************************/
|
|
|
|
#ifndef HELPERS_H_
|
|
#define HELPERS_H_
|
|
|
|
#include "types.h"
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
namespace lunarium
|
|
{
|
|
class System
|
|
{
|
|
public:
|
|
static Sizei GetScreenResolution();
|
|
static std::string GetGLSLVersionString();
|
|
};
|
|
|
|
class String
|
|
{
|
|
public:
|
|
|
|
// Splits the string based on the given delimiter,
|
|
// maxSplit = -1 for unlimited number of splits
|
|
static std::vector<std::string> Split(std::string str, char delim = ' ', int maxSplits = -1);
|
|
|
|
// Trim given delimiters from start and end of string
|
|
static std::string Trim(std::string str, std::string delims = " \r\n\t");
|
|
|
|
// Trim given delimiters from start of string
|
|
static std::string TrimStart(std::string str, std::string delims = " \r\n\t");
|
|
|
|
// Trim given delimiters from end of string
|
|
static std::string TrimEnd(std::string str, std::string delims);
|
|
|
|
static std::string AsString(int value);
|
|
static std::string AsString(bool value);
|
|
static std::string AsString(float value);
|
|
|
|
static std::string StringToUpper(std::string str);
|
|
static std::string StringToLower(std::string str);
|
|
|
|
static std::string GetFileNameFromPath(std::string path, bool includeExt);
|
|
static std::string TrimFileNameFromPath(std::string path);
|
|
static std::string GetFileExtension(std::string filename);
|
|
};
|
|
}
|
|
|
|
#endif // HELPERS_H_
|