Changeset View
Changeset View
Standalone View
Standalone View
source/ps/CStr.h
/* Copyright (C) 2014 Wildfire Games. | /* Copyright (C) 2017 Wildfire Games. | ||||
* This file is part of 0 A.D. | * This file is part of 0 A.D. | ||||
* | * | ||||
* 0 A.D. is free software: you can redistribute it and/or modify | * 0 A.D. is free software: you can redistribute it and/or modify | ||||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | ||||
* the Free Software Foundation, either version 2 of the License, or | * the Free Software Foundation, either version 2 of the License, or | ||||
* (at your option) any later version. | * (at your option) any later version. | ||||
* | * | ||||
* 0 A.D. is distributed in the hope that it will be useful, | * 0 A.D. is distributed in the hope that it will be useful, | ||||
▲ Show 20 Lines • Show All 317 Lines • ▼ Show 20 Lines | public: | ||||
**/ | **/ | ||||
CStr Pad(PS_TRIM_MODE Mode, size_t Length) const; | CStr Pad(PS_TRIM_MODE Mode, size_t Length) const; | ||||
// Conversion to utf16string | // Conversion to utf16string | ||||
utf16string utf16() const { return utf16string(begin(), end()); } | utf16string utf16() const { return utf16string(begin(), end()); } | ||||
// Calculates a hash of the string's contents | // Calculates a hash of the string's contents | ||||
size_t GetHashCode() const; | size_t GetHashCode() const; | ||||
// Serialization functions | |||||
// (These are not virtual or inherited from ISerializable, to avoid | |||||
// adding a vtable and making the strings larger than std::string) | |||||
size_t GetSerializedLength() const; | |||||
u8* Serialize(u8* buffer) const; | |||||
const u8* Deserialize(const u8* buffer, const u8* bufferend); | |||||
}; | }; | ||||
static inline size_t hash_value(const CStr& s) | static inline size_t hash_value(const CStr& s) | ||||
{ | { | ||||
return s.GetHashCode(); | return s.GetHashCode(); | ||||
} | } | ||||
#endif | #endif |
Wildfire Games · Phabricator