mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-08-14 08:04:14 +02:00
Update to v093 release.
byuu says: Changelog: - added Cocoa target: higan can now be compiled for OS X Lion [Cydrak, byuu] - SNES/accuracy profile hires color blending improvements - fixes Marvelous text [AWJ] - fixed a slight bug in SNES/SA-1 VBR support caused by a typo - added support for multi-pass shaders that can load external textures (requires OpenGL 3.2+) - added game library path (used by ananke->Import Game) to Settings->Advanced - system profiles, shaders and cheats database can be stored in "all users" shared folders now (eg /usr/share on Linux) - all configuration files are in BML format now, instead of XML (much easier to read and edit this way) - main window supports drag-and-drop of game folders (but not game files / ZIP archives) - audio buffer clears when entering a modal loop on Windows (prevents audio repetition with DirectSound driver) - a substantial amount of code clean-up (probably the biggest refactoring to date) One highly desired target for this release was to default to the optimal drivers instead of the safest drivers, but because AMD drivers don't seem to like my OpenGL 3.2 driver, I've decided to postpone that. AMD has too big a market share. Hopefully with v093 officially released, we can get some public input on what AMD doesn't like.
This commit is contained in:
87
nall/string/core.hpp
Normal file
87
nall/string/core.hpp
Normal file
@@ -0,0 +1,87 @@
|
||||
#ifdef NALL_STRING_INTERNAL_HPP
|
||||
|
||||
//only allocators may access _data or modify _size and _capacity
|
||||
//all other functions must use data(), size(), capacity()
|
||||
|
||||
#if defined(NALL_STRING_ALLOCATOR_COPY_ON_WRITE)
|
||||
#include <nall/string/allocator/copy-on-write.hpp>
|
||||
#elif defined(NALL_STRING_ALLOCATOR_SMALL_STRING_OPTIMIZATION)
|
||||
#include <nall/string/allocator/small-string-optimization.hpp>
|
||||
#elif defined(NALL_STRING_ALLOCATOR_VECTOR)
|
||||
#include <nall/string/allocator/vector.hpp>
|
||||
#endif
|
||||
|
||||
namespace nall {
|
||||
|
||||
unsigned string::length() const { return strlen(data()); }
|
||||
unsigned string::size() const { return _size; }
|
||||
unsigned string::capacity() const { return _capacity; }
|
||||
bool string::empty() const { return _size == 0; }
|
||||
|
||||
void string::clear(char c) {
|
||||
for(unsigned n = 0; n < size(); n++) data()[n] = c;
|
||||
}
|
||||
|
||||
unsigned string::hash() const {
|
||||
const char* p = data();
|
||||
unsigned result = 5381;
|
||||
while(*p) result = (result << 5) + result + *p++;
|
||||
return result;
|
||||
}
|
||||
|
||||
template<typename... Args> string& string::assign(Args&&... args) {
|
||||
resize(0);
|
||||
sprint(*this, std::forward<Args>(args)...);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename... Args> string& string::append(Args&&... args) {
|
||||
sprint(*this, std::forward<Args>(args)...);
|
||||
return *this;
|
||||
}
|
||||
|
||||
string& string::_append(const char* s) {
|
||||
if(s == nullptr) return *this;
|
||||
unsigned basesize = size(), length = strlen(s);
|
||||
reserve(basesize + length);
|
||||
memcpy(data() + basesize, s, length);
|
||||
resize(basesize + length);
|
||||
return *this;
|
||||
}
|
||||
|
||||
string::operator bool() const {
|
||||
return !empty();
|
||||
}
|
||||
|
||||
string::operator const char*() const {
|
||||
return data();
|
||||
}
|
||||
|
||||
char& string::operator[](signed position) {
|
||||
if(position > size() + 1) throw exception_out_of_bounds{};
|
||||
return data()[position];
|
||||
}
|
||||
|
||||
const char& string::operator[](signed position) const {
|
||||
if(position > size() + 1) throw exception_out_of_bounds{};
|
||||
return data()[position];
|
||||
}
|
||||
|
||||
bool string::operator==(const char* str) const { return strcmp(data(), str) == 0; }
|
||||
bool string::operator!=(const char* str) const { return strcmp(data(), str) != 0; }
|
||||
bool string::operator< (const char* str) const { return strcmp(data(), str) < 0; }
|
||||
bool string::operator<=(const char* str) const { return strcmp(data(), str) <= 0; }
|
||||
bool string::operator> (const char* str) const { return strcmp(data(), str) > 0; }
|
||||
bool string::operator>=(const char* str) const { return strcmp(data(), str) >= 0; }
|
||||
|
||||
string::string(const string& source) {
|
||||
operator=(source);
|
||||
}
|
||||
|
||||
string::string(string&& source) {
|
||||
operator=(std::move(source));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user