mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 21:39:52 +00:00
ConstString
This commit is contained in:
parent
b8cafe1561
commit
45949ac008
@ -34,3 +34,22 @@ inline void StringToHexString(const std::string &data, std::string *output) {
|
||||
|
||||
// highly unsafe and not recommended.
|
||||
unsigned int parseHex(const char* _szValue);
|
||||
|
||||
|
||||
// Suitable for inserting into maps, unlike char*, and cheaper than std::string.
|
||||
// Strings must be constant and preferably be stored in the read-only part
|
||||
// of the binary.
|
||||
class ConstString {
|
||||
public:
|
||||
ConstString(const char *ptr) {
|
||||
ptr_ = ptr;
|
||||
}
|
||||
bool operator <(const ConstString &other) const {
|
||||
return strcmp(ptr_, other.ptr_) < 0;
|
||||
}
|
||||
bool operator ==(const ConstString &other) const {
|
||||
return ptr_ == other.ptr_ || !strcmp(ptr_, other.ptr_);
|
||||
}
|
||||
private:
|
||||
const char *ptr_;
|
||||
};
|
||||
|
@ -16,6 +16,7 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <map>
|
||||
#include <time.h>
|
||||
|
||||
#include "gfx/gl_lost_manager.h"
|
||||
@ -54,6 +55,9 @@ struct GLSLProgram : public GfxResourceHolder {
|
||||
void GLLost();
|
||||
};
|
||||
|
||||
|
||||
// C API, old skool
|
||||
|
||||
GLSLProgram *glsl_create(const char *vshader_file, const char *fshader_file);
|
||||
void glsl_destroy(GLSLProgram *program);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user