AeAssetBin.c++
1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#include <string.h>
#include <assert.h>
#include "GList.h"
#include "AeAssetBin.h"
#include "AeAsset.h"
AeAssetBin::AeAssetBin (TAssetType type, AeAssetBin * childBin)
{
fType = type;
fAssetList = new GList<AeAsset *>;
fChildBin = childBin;
}
AeAssetBin::~AeAssetBin (void)
{
if (fAssetList)
delete fAssetList;
}
//
// If the asset is not already in the bin,
// append the asset and return true.
// Else return false to indicate that the
// asset already exists.
//
Boolean
AeAssetBin::AppendAsset (AeAsset * asset)
{
assert (fAssetList);
assert (asset);
int i;
Boolean found;
if (!(found = fAssetList->Find (asset, i)))
fAssetList->Append (asset);
return !found;
}
void
AeAssetBin::DeleteAsset (AeAsset * asset)
{
assert (fAssetList);
assert (asset);
if (asset)
{
fAssetList->Remove (asset);
delete asset;
}
}
Boolean
AeAssetBin::FindNamedAsset (const char * name, AeAsset* & asset)
{
int i;
assert (fAssetList);
fAssetList->Start (i);
while (fAssetList->Next (i, asset))
{
if (strcmp (name, asset->GetName()) == 0)
return True;
}
return False;
}
Boolean
AeAssetBin::IsBankType (void)
{
switch (fType)
{
case kBankFileType:
case kBankType:
case kInstType:
case kSoundType:
case kEnvType:
case kKeymapType:
case kWaveType:
case kLoopType:
case kADPCMLoopType:
case kADPCMBookType:
return True;
}
return False;
}
int
AeAssetBin::GetNumAssets (void)
{
return fAssetList->GetNum ();
}