2016-01-07 08:14:33 +00:00
|
|
|
#pragma once
|
2010-08-09 13:28:56 +00:00
|
|
|
|
|
|
|
namespace nall {
|
|
|
|
|
2013-05-02 11:25:45 +00:00
|
|
|
template<typename C> struct property {
|
|
|
|
template<typename T> struct readonly {
|
2015-07-14 09:32:43 +00:00
|
|
|
auto operator->() const -> const T* { return &value; }
|
|
|
|
auto operator()() const -> const T& { return value; }
|
2013-05-02 11:25:45 +00:00
|
|
|
operator const T&() const { return value; }
|
|
|
|
private:
|
2015-07-14 09:32:43 +00:00
|
|
|
auto operator->() -> T* { return &value; }
|
2013-05-02 11:25:45 +00:00
|
|
|
operator T&() { return value; }
|
2015-07-14 09:32:43 +00:00
|
|
|
auto operator=(const T& value_) -> const T& { return value = value_; }
|
2013-05-02 11:25:45 +00:00
|
|
|
T value;
|
|
|
|
friend C;
|
|
|
|
};
|
2010-08-09 13:28:56 +00:00
|
|
|
|
2013-05-02 11:25:45 +00:00
|
|
|
template<typename T> struct writeonly {
|
2015-07-14 09:32:43 +00:00
|
|
|
auto operator=(const T& value_) -> void { value = value_; }
|
2013-05-02 11:25:45 +00:00
|
|
|
private:
|
2015-07-14 09:32:43 +00:00
|
|
|
auto operator->() const -> const T* { return &value; }
|
|
|
|
auto operator()() const -> const T& { return value; }
|
2013-05-02 11:25:45 +00:00
|
|
|
operator const T&() const { return value; }
|
2015-07-14 09:32:43 +00:00
|
|
|
auto operator->() -> T* { return &value; }
|
2013-05-02 11:25:45 +00:00
|
|
|
operator T&() { return value; }
|
|
|
|
T value;
|
|
|
|
friend C;
|
2010-08-09 13:28:56 +00:00
|
|
|
};
|
2013-05-02 11:25:45 +00:00
|
|
|
|
|
|
|
template<typename T> struct readwrite {
|
2015-07-14 09:32:43 +00:00
|
|
|
auto operator->() const -> const T* { return &value; }
|
|
|
|
auto operator()() const -> const T& { return value; }
|
2013-05-02 11:25:45 +00:00
|
|
|
operator const T&() const { return value; }
|
2015-07-14 09:32:43 +00:00
|
|
|
auto operator->() -> T* { return &value; }
|
2013-05-02 11:25:45 +00:00
|
|
|
operator T&() { return value; }
|
2015-07-14 09:32:43 +00:00
|
|
|
auto operator=(const T& value_) -> const T& { return value = value_; }
|
2013-05-02 11:25:45 +00:00
|
|
|
T value;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2010-08-09 13:28:56 +00:00
|
|
|
}
|