Global: Cut down on file/string includes.

This commit is contained in:
Unknown W. Brackets committed 2020-08-10 08:03:44 +00:00
1 parent 1af3009e80
commit 667a8522cc
11 files changed
+17 -45

No files matched your search

-24
View File
@@ -1,11 +1,7 @@
#pragma once
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <string>
#include <sstream>
#include <stdarg.h>
#include <vector>
#include "base/basictypes.h"
@@ -67,26 +63,6 @@ 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_);
}
const char *get() const { return ptr_; }
private:
const char *ptr_;
};
std::string StringFromFormat(const char* format, ...);
std::string StringFromInt(int value);
std::string StringFromBool(bool value);