mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-08-19 17:51:47 +02:00
Update to v094r44 release.
byuu says: Changelog: - return open bus instead of mirroring addresses on the bus (fixes Mario&Luigi, Minish Cap, etc) [Jonas Quinn] - add boolean flag to load requests for slotted game carts (fixes slot load prompts) - rename BS-X Town cart from psram to ram - icarus: add support for game database Note: I didn't rename "bsx" to "mcc" in the database for icarus before uploading that. But I just fixed it locally, so it'll be in the next WIP. For now, make it create the manifest for you and then rename it yourself. I did fix the PSRAM size to 256kbit.
This commit is contained in:
90
nall/string/view.hpp
Normal file
90
nall/string/view.hpp
Normal file
@@ -0,0 +1,90 @@
|
||||
#ifdef NALL_STRING_INTERNAL_HPP
|
||||
|
||||
namespace nall {
|
||||
|
||||
struct string_view {
|
||||
string_view() {
|
||||
_string = nullptr;
|
||||
_data = "";
|
||||
_size = 0;
|
||||
}
|
||||
|
||||
string_view(const char* data) {
|
||||
_string = nullptr;
|
||||
_data = data;
|
||||
_size = -1; //defer length calculation, as it is often unnecessary
|
||||
}
|
||||
|
||||
string_view(const char* data, unsigned size) {
|
||||
_string = nullptr;
|
||||
_data = data;
|
||||
_size = size;
|
||||
}
|
||||
|
||||
string_view(const string& source) {
|
||||
_string = nullptr;
|
||||
_data = source.data();
|
||||
_size = source.size();
|
||||
}
|
||||
|
||||
template<typename... P>
|
||||
string_view(P&&... p) {
|
||||
_string = new string{forward<P>(p)...};
|
||||
_data = _string->data();
|
||||
_size = _string->size();
|
||||
}
|
||||
|
||||
~string_view() {
|
||||
if(_string) delete _string;
|
||||
}
|
||||
|
||||
string_view(const string_view& source) {
|
||||
_string = nullptr;
|
||||
_data = source._data;
|
||||
_size = source._size;
|
||||
}
|
||||
|
||||
string_view(string_view&& source) {
|
||||
_string = source._string;
|
||||
_data = source._data;
|
||||
_size = source._size;
|
||||
source._string = nullptr;
|
||||
}
|
||||
|
||||
auto operator=(const string_view& source) -> string_view& {
|
||||
_string = nullptr;
|
||||
_data = source._data;
|
||||
_size = source._size;
|
||||
return *this;
|
||||
};
|
||||
|
||||
auto operator=(string_view&& source) -> string_view& {
|
||||
_string = source._string;
|
||||
_data = source._data;
|
||||
_size = source._size;
|
||||
source._string = nullptr;
|
||||
return *this;
|
||||
};
|
||||
|
||||
operator const char*() const {
|
||||
return _data;
|
||||
}
|
||||
|
||||
auto data() const -> const char* {
|
||||
return _data;
|
||||
}
|
||||
|
||||
auto size() const -> unsigned {
|
||||
if(_size < 0) _size = strlen(_data);
|
||||
return _size;
|
||||
}
|
||||
|
||||
protected:
|
||||
string* _string;
|
||||
const char* _data;
|
||||
mutable signed _size;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user