<< What's a vector here? I only know vectors from maths, where they are used
to describe a line in 3D space etc... ?>>

In C++, a "vector" is best described as a glorified array. It's an ill-chosen 
name, IMO. A "valarray" is actually more like a math vector...

How about something like this for XBlockFile:

tyepdef map<unsigned long, entryType> entryMap;
// EntryMap holds a variable number of blocks of one type

typedef hashmap<char*, entryMap> blockTypeMap;
// blockTypeMap holds one entryMap for each block type

//in a MacOS resource manager style, you could say things like:

blockTypeMap topLevel;
entryMap menuMap;
entryType someEntry;
...
menuMap = topLevel["MENU"];
menuMap[128] = someEntry;

I chose a map instead of a hashmap for the "entryMap" type, because you can 
iterate over maps (but not hashmaps).
You would need something like this to iterate through all of the entries of 
one type:

unsigned long entryID;
entryType someEntry;

typedef entryMap::const_iterator CI;
for(CI iterator = menuMap.begin(); iterator != menuMap.end(); ++iterator) {
  entryID = iterator->first;
  someEntry = iterator->second;
}

I'm don't have the XBlockFile sources on hand, so I hope this is fairly 
relevant and helpful.
Let me know how else I can help.

Oh, and I'm by no means a C++ stdlib expert, so input from others is welcome.


Brian






Reply via email to