+ /*
+ * Okay. The rules for generating a UID go like this...
+ * -- > ABCDEFGHIJKLMNOPQRSTUVWXYZ --> 012345679 --> WRAP
+ * That is, we start at A. When we reach Z, we go to 0. At 9, we go to
+ * A again, in an iterative fashion.. so..
+ * AAA9 -> AABA, and so on. -- w00t
+ */
+ if (pos == 3)
+ {
+ // At pos 3, if we hit '9', we've run out of available UIDs, and need to reset to AAA..AAA.
+ if (current_uid[pos] == '9')
+ {
+ for (int i = 3; i < (UUID_LENGTH - 1); i++)
+ {
+ current_uid[i] = 'A';
+ pos = UUID_LENGTH - 1;
+ }
+ }
+ else
+ {
+ // Buf if we haven't, just keep incrementing merrily.
+ current_uid[pos]++;
+ }
+ }
+ else
+ {
+ // If we hit Z, wrap around to 0.
+ if (current_uid[pos] == 'Z')
+ {
+ current_uid[pos] = '0';
+ }
+ else if (current_uid[pos] == '9')
+ {
+ /*
+ * Or, if we hit 9, wrap around to pos = 'A' and (pos - 1)++,
+ * e.g. A9 -> BA -> BB ..
+ */
+ current_uid[pos] = 'A';
+ this->IncrementUID(pos - 1);
+ }
+ else
+ {
+ // Anything else, nobody gives a shit. Just increment.
+ current_uid[pos]++;
+ }
+ }