Loading [MathJax]/extensions/MathMenu.js
Twilight Princess
Decompilation of The Legend of Zelda: Twilight Princess
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
vector.h
Go to the documentation of this file.
1#ifndef VECTOR_H
2#define VECTOR_H
3
5#include "types.h"
6
7namespace JGadget {
8
9namespace vector {
10
11u32 extend_default(u32 arg1, u32 arg2, u32 arg3);
12
13typedef u32 (*ExtendFunc)(u32, u32, u32);
14
15} // namespace vector
16
17template <typename T, template <class> class Allocator>
18struct TVector {
19 TVector(Allocator<T> alloc) {
20 _0 = NULL;
21 pBegin_ = _0;
22 _c = NULL;
24 }
25
26 inline u32 size() const {
27 if (pBegin_ == NULL) {
28 return 0;
29 }
30
31 return ((int)pEnd_ - (int)pBegin_) / 4;
32 }
33
34 void **const begin() const { return pBegin_; }
35 void **const end() const { return pEnd_; }
36 void** begin() { return pBegin_; }
37 void** end() { return pEnd_; }
38 // void erase(void** arg1, void** arg2) {}
39
40 void** _0;
41 void** pBegin_;
42 void** pEnd_;
45};
46
47struct TVector_pointer_void : TVector<void*, TAllocator> {
49 /* 802DCCFC */ ~TVector_pointer_void();
50 /* 802DCDC4 */ void erase(void**, void**);
51 void insert(void**, void* const&);
52
53 void clear() { erase(begin(), end()); }
54 void push_back(const void*& ref) { insert(end(), (void* const&)ref); }
55};
56
57template <typename T>
59 TVector_pointer(const TAllocator<void*>& allocator) : TVector_pointer_void(allocator) {}
61
62 const T* begin() const { return (const T*)TVector_pointer_void::begin(); }
63 T* begin() { return (T*)TVector_pointer_void::begin(); }
64
65 const T* end() const { return (const T*)TVector_pointer_void::end(); }
66 T* end() { return (T*)TVector_pointer_void::end(); }
67
68 void push_back(const T& ref) {
69 static_cast<TVector_pointer_void*>(this)->push_back((const void*&)ref);
70 }
71};
72
73} // namespace JGadget
74
75#endif /* VECTOR_H */
u32 extend_default(u32, u32, u32)
Definition std-vector.cpp:9
u32(* ExtendFunc)(u32, u32, u32)
Definition vector.h:13
Definition binary.h:6
Definition std-memory.h:8
Definition vector.h:47
void erase(void **, void **)
void insert(void **, void *const &)
void ** erase(void **, void **)
Definition std-vector.cpp:34
void clear()
Definition vector.h:53
void push_back(const void *&ref)
Definition vector.h:54
TVector_pointer_void(JGadget::TAllocator< void * > const &)
Definition vector.h:58
T * begin()
Definition vector.h:63
const T * begin() const
Definition vector.h:62
T * end()
Definition vector.h:66
~TVector_pointer()
Definition vector.h:60
const T * end() const
Definition vector.h:65
void push_back(const T &ref)
Definition vector.h:68
TVector_pointer(const TAllocator< void * > &allocator)
Definition vector.h:59
Definition vector.h:18
void ** _0
Definition vector.h:40
void ** end()
Definition vector.h:37
u32 _c
Definition vector.h:43
TVector(Allocator< T > alloc)
Definition vector.h:19
void **const begin() const
Definition vector.h:34
void ** pBegin_
Definition vector.h:41
T * pEnd_
Definition std-vector.h:156
u32 size() const
Definition vector.h:26
void ** begin() const
Definition std-vector.h:113
void ** pEnd_
Definition vector.h:42
vector::ExtendFunc extend
Definition vector.h:44
void ** end() const
Definition std-vector.h:115
T * pBegin_
Definition std-vector.h:155
void **const end() const
Definition vector.h:35
void ** begin()
Definition vector.h:36
unsigned long u32
Definition types.h:9