로딩중...
검색중...
일치하는것 없음
tweak.inl
1#pragma once
2
3#include "memlite/binder/tbindable.inl"
6
7namespace by {
8
9#define TEMPL template <typename T, typename TACTIC>
10#define ME tweak<T, TACTIC>
11#define SUPER binder
12
13 TEMPL ME::tweak(): SUPER(ttype<T>::get(), TACTIC::singleton) {}
14
15 TEMPL ME::tweak(const type& subtype):
16 SUPER(subtype.isSub(ttype<T>::get()) ? subtype : ttype<T>::get(), TACTIC::singleton) {}
17
18 TEMPL ME::tweak(const T& it): SUPER(ttype<T>::get(), TACTIC::singleton) { this->bind(it); }
19
20 TEMPL ME::tweak(const T* it): SUPER(ttype<T>::get(), TACTIC::singleton) { this->bind(it); }
21
22 TEMPL ME::tweak(const tmedium<T>& it): SUPER(ttype<T>::get(), TACTIC::singleton) { this->bind(it.get()); }
23
24 TEMPL ME::tweak(const ME& rhs): SUPER(ttype<T>::get(), TACTIC::singleton) { this->_assign(rhs); }
25
26 TEMPL ME::tweak(const binder& rhs): SUPER(ttype<T>::get(), TACTIC::singleton) { this->bind(*rhs); }
27
28 TEMPL T* ME::operator->() { return this->get(); }
29
30 TEMPL T& ME::operator*() { return *get(); }
31
32 TEMPL ME& ME::operator=(const binder& rhs) {
33 if(this == &rhs) return *this;
34
35 SUPER::operator=(rhs);
36 return *this;
37 }
38
39 TEMPL ME& ME::operator=(const me& rhs) { return operator=((const binder&) rhs); }
40
41 TEMPL T* ME::get() {
42 instance& got = SUPER::get() OR.ret(nullptr);
43 return got.cast<T>();
44 }
45
46 TEMPL nbool ME::bind(const T& new1) { return SUPER::bind(new1); }
47
48#undef SUPER
49#undef ME
50#undef TEMPL
51
52} // namespace by