aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid <david@xagasoft.com>2007-06-18 19:41:34 +0000
committerDavid <david@xagasoft.com>2007-06-18 19:41:34 +0000
commit5292e5831934dc719d1ac06332bd252abe4ac3bc (patch)
tree1acbd783f6c155bcd376bcb4460ae47868e8285a /src
parent2b90449c30e4a420af4fff7e58588611d71f61fc (diff)
downloadlibbu++-5292e5831934dc719d1ac06332bd252abe4ac3bc.tar.gz
libbu++-5292e5831934dc719d1ac06332bd252abe4ac3bc.tar.bz2
libbu++-5292e5831934dc719d1ac06332bd252abe4ac3bc.tar.xz
libbu++-5292e5831934dc719d1ac06332bd252abe4ac3bc.zip
david - writing code documentation...
Diffstat (limited to '')
-rw-r--r--src/fstring.h154
-rw-r--r--src/hash.h137
-rw-r--r--src/list.h15
3 files changed, 306 insertions, 0 deletions
diff --git a/src/fstring.h b/src/fstring.h
index 93a0042..9d88bd4 100644
--- a/src/fstring.h
+++ b/src/fstring.h
@@ -29,6 +29,11 @@ namespace Bu
29 * almost no overhead in time or memory since a reference is created and no 29 * almost no overhead in time or memory since a reference is created and no
30 * data is actually copied. This also means that you never need to put any 30 * data is actually copied. This also means that you never need to put any
31 * FBasicString into a ref-counting container class. 31 * FBasicString into a ref-counting container class.
32 *
33 *@param chr (typename) Type of character (i.e. char)
34 *@param nMinSize (int) Chunk size (default: 256)
35 *@param chralloc (typename) Memory Allocator for chr
36 *@param chunkalloc (typename) Memory Allocator for chr chunks
32 */ 37 */
33 template< typename chr, int nMinSize=256, typename chralloc=std::allocator<chr>, typename chunkalloc=std::allocator<struct FStringChunk<chr> > > 38 template< typename chr, int nMinSize=256, typename chralloc=std::allocator<chr>, typename chunkalloc=std::allocator<struct FStringChunk<chr> > >
34 class FBasicString : public Archival 39 class FBasicString : public Archival
@@ -113,6 +118,14 @@ namespace Bu
113 clear(); 118 clear();
114 } 119 }
115 120
121 /**
122 *@todo void append( const MyType & sData )
123 */
124
125 /**
126 * Append data to your string.
127 *@param pData (const chr *) The data to append.
128 */
116 void append( const chr *pData ) 129 void append( const chr *pData )
117 { 130 {
118 long nLen; 131 long nLen;
@@ -126,6 +139,11 @@ namespace Bu
126 appendChunk( pNew ); 139 appendChunk( pNew );
127 } 140 }
128 141
142 /**
143 * Append data to your string.
144 *@param pData (const chr *) The data to append.
145 *@param nLen (long) The length of the data to append.
146 */
129 void append( const chr *pData, long nLen ) 147 void append( const chr *pData, long nLen )
130 { 148 {
131 if( nLen == 0 ) 149 if( nLen == 0 )
@@ -138,16 +156,28 @@ namespace Bu
138 appendChunk( pNew ); 156 appendChunk( pNew );
139 } 157 }
140 158
159 /**
160 * Append a single chr to your string.
161 *@param cData (const chr &) The character to append.
162 */
141 void append( const chr &cData ) 163 void append( const chr &cData )
142 { 164 {
143 append( &cData, 1 ); 165 append( &cData, 1 );
144 } 166 }
145 167
168 /**
169 * Prepend another FString to this one.
170 *@param sData (MyType &) The FString to prepend.
171 */
146 void prepend( const MyType & sData ) 172 void prepend( const MyType & sData )
147 { 173 {
148 prepend( sData.getStr(), sData.getSize() ); 174 prepend( sData.getStr(), sData.getSize() );
149 } 175 }
150 176
177 /**
178 * Prepend data to your string.
179 *@param pData (const chr *) The data to prepend.
180 */
151 void prepend( const chr *pData ) 181 void prepend( const chr *pData )
152 { 182 {
153 long nLen; 183 long nLen;
@@ -159,6 +189,11 @@ namespace Bu
159 prependChunk( pNew ); 189 prependChunk( pNew );
160 } 190 }
161 191
192 /**
193 * Prepend data to your string.
194 *@param pData (const chr *) The data to prepend.
195 *@param nLen (long) The length of the data to prepend.
196 */
162 void prepend( const chr *pData, long nLen ) 197 void prepend( const chr *pData, long nLen )
163 { 198 {
164 Chunk *pNew = newChunk( nLen ); 199 Chunk *pNew = newChunk( nLen );
@@ -168,11 +203,22 @@ namespace Bu
168 prependChunk( pNew ); 203 prependChunk( pNew );
169 } 204 }
170 205
206 /**
207 *@todo void prepend( const chr &cData )
208 */
209
210 /**
211 * Clear all data from the string.
212 */
171 void clear() 213 void clear()
172 { 214 {
173 realClear(); 215 realClear();
174 } 216 }
175 217
218 /**
219 * Force the string to resize
220 *@param nNewSize (long) The new size of the string.
221 */
176 void resize( long nNewSize ) 222 void resize( long nNewSize )
177 { 223 {
178 if( nLength == nNewSize ) 224 if( nLength == nNewSize )
@@ -190,11 +236,19 @@ namespace Bu
190 nLength = nNewSize; 236 nLength = nNewSize;
191 } 237 }
192 238
239 /**
240 * Get the current size of the string.
241 *@returns (long) The current size of the string.
242 */
193 long getSize() const 243 long getSize() const
194 { 244 {
195 return nLength; 245 return nLength;
196 } 246 }
197 247
248 /**
249 * Get a pointer to the string array.
250 *@returns (chr *) The string data.
251 */
198 chr *getStr() 252 chr *getStr()
199 { 253 {
200 if( pFirst == NULL ) 254 if( pFirst == NULL )
@@ -204,6 +258,10 @@ namespace Bu
204 return pFirst->pData; 258 return pFirst->pData;
205 } 259 }
206 260
261 /**
262 * Get a const pointer to the string array.
263 *@returns (const chr *) The string data.
264 */
207 const chr *getStr() const 265 const chr *getStr() const
208 { 266 {
209 if( pFirst == NULL ) 267 if( pFirst == NULL )
@@ -213,6 +271,10 @@ namespace Bu
213 return pFirst->pData; 271 return pFirst->pData;
214 } 272 }
215 273
274 /**
275 * (std::string compatability) Get a pointer to the string array.
276 *@returns (chr *) The string data.
277 */
216 chr *c_str() 278 chr *c_str()
217 { 279 {
218 if( pFirst == NULL ) 280 if( pFirst == NULL )
@@ -222,6 +284,10 @@ namespace Bu
222 return pFirst->pData; 284 return pFirst->pData;
223 } 285 }
224 286
287 /**
288 * (std::string compatability) Get a const pointer to the string array.
289 *@returns (const chr *) The string data.
290 */
225 const chr *c_str() const 291 const chr *c_str() const
226 { 292 {
227 if( pFirst == NULL ) 293 if( pFirst == NULL )
@@ -231,6 +297,10 @@ namespace Bu
231 return pFirst->pData; 297 return pFirst->pData;
232 } 298 }
233 299
300 /**
301 * Plus equals operator for FString.
302 *@param pData (const chr *) The data to append to your FString.
303 */
234 MyType &operator +=( const chr *pData ) 304 MyType &operator +=( const chr *pData )
235 { 305 {
236 append( pData ); 306 append( pData );
@@ -238,6 +308,10 @@ namespace Bu
238 return (*this); 308 return (*this);
239 } 309 }
240 310
311 /**
312 * Plus equals operator for FString.
313 *@param pData (const MyType &) The FString to append to your FString.
314 */
241 MyType &operator +=( const MyType &rSrc ) 315 MyType &operator +=( const MyType &rSrc )
242 { 316 {
243 if( rSrc.nLength == 0 ) 317 if( rSrc.nLength == 0 )
@@ -248,6 +322,10 @@ namespace Bu
248 return (*this); 322 return (*this);
249 } 323 }
250 324
325 /**
326 * Plus equals operator for FString.
327 *@param pData (const chr) The character to append to your FString.
328 */
251 MyType &operator +=( const chr pData ) 329 MyType &operator +=( const chr pData )
252 { 330 {
253 append( &pData, 1 ); 331 append( &pData, 1 );
@@ -255,6 +333,11 @@ namespace Bu
255 return (*this); 333 return (*this);
256 } 334 }
257 335
336 /**
337 * Assignment operator.
338 *@param pData (const chr *) The character array to append to your
339 * FString.
340 */
258 MyType &operator =( const chr *pData ) 341 MyType &operator =( const chr *pData )
259 { 342 {
260 clear(); 343 clear();
@@ -263,18 +346,31 @@ namespace Bu
263 return (*this); 346 return (*this);
264 } 347 }
265 348
349 /**
350 * Reset your FString to this character array.
351 *@param pData (const chr *) The character array to set your FString to.
352 */
266 void set( const chr *pData ) 353 void set( const chr *pData )
267 { 354 {
268 clear(); 355 clear();
269 append( pData ); 356 append( pData );
270 } 357 }
271 358
359 /**
360 * Reset your FString to this character array.
361 *@param pData (const chr *) The character array to set your FString to.
362 *@param nSize (long) The length of the inputted character array.
363 */
272 void set( const chr *pData, long nSize ) 364 void set( const chr *pData, long nSize )
273 { 365 {
274 clear(); 366 clear();
275 append( pData, nSize ); 367 append( pData, nSize );
276 } 368 }
277 369
370 /**
371 * Assignment operator.
372 *@param rSrc (const MyType &) The FString to set your FString to.
373 */
278 MyType &operator =( const MyType &rSrc ) 374 MyType &operator =( const MyType &rSrc )
279 { 375 {
280 //if( rSrc.isFlat() ) 376 //if( rSrc.isFlat() )
@@ -290,6 +386,11 @@ namespace Bu
290 return (*this); 386 return (*this);
291 } 387 }
292 388
389 /**
390 * Equals comparison operator.
391 *@param pData (const chr *) The character array to compare your FString
392 * to.
393 */
293 bool operator ==( const chr *pData ) const 394 bool operator ==( const chr *pData ) const
294 { 395 {
295 if( pFirst == NULL ) { 396 if( pFirst == NULL ) {
@@ -310,6 +411,10 @@ namespace Bu
310 return true; 411 return true;
311 } 412 }
312 413
414 /**
415 * Equals comparison operator.
416 *@param pData (const MyType &) The FString to compare your FString to.
417 */
313 bool operator ==( const MyType &pData ) const 418 bool operator ==( const MyType &pData ) const
314 { 419 {
315 if( pFirst == pData.pFirst ) 420 if( pFirst == pData.pFirst )
@@ -330,16 +435,30 @@ namespace Bu
330 return true; 435 return true;
331 } 436 }
332 437
438 /**
439 * Not equals comparison operator.
440 *@param pData (const chr *) The character array to compare your FString
441 * to.
442 */
333 bool operator !=(const chr *pData ) const 443 bool operator !=(const chr *pData ) const
334 { 444 {
335 return !(*this == pData); 445 return !(*this == pData);
336 } 446 }
337 447
448 /**
449 * Not equals comparison operator.
450 *@param pData (const MyType &) The FString to compare your FString to.
451 */
338 bool operator !=(const MyType &pData ) const 452 bool operator !=(const MyType &pData ) const
339 { 453 {
340 return !(*this == pData); 454 return !(*this == pData);
341 } 455 }
342 456
457 /**
458 * Indexing operator
459 *@param nIndex (long) The index of the character you want.
460 *@returns (chr &) The character at position (nIndex).
461 */
343 chr &operator[]( long nIndex ) 462 chr &operator[]( long nIndex )
344 { 463 {
345 flatten(); 464 flatten();
@@ -347,6 +466,11 @@ namespace Bu
347 return pFirst->pData[nIndex]; 466 return pFirst->pData[nIndex];
348 } 467 }
349 468
469 /**
470 * Const indexing operator
471 *@param nIndex (long) The index of the character you want.
472 *@returns (const chr &) The character at position (nIndex).
473 */
350 const chr &operator[]( long nIndex ) const 474 const chr &operator[]( long nIndex ) const
351 { 475 {
352 flatten(); 476 flatten();
@@ -354,6 +478,11 @@ namespace Bu
354 return pFirst->pData[nIndex]; 478 return pFirst->pData[nIndex];
355 } 479 }
356 480
481 /**
482 * Is the character at index (nIndex) white space?
483 *@param nIndex (long) The index of the character you want to check.
484 *@returns (bool) Is it white space?
485 */
357 bool isWS( long nIndex ) const 486 bool isWS( long nIndex ) const
358 { 487 {
359 flatten(); 488 flatten();
@@ -362,6 +491,11 @@ namespace Bu
362 || pFirst->pData[nIndex]=='\r' || pFirst->pData[nIndex]=='\n'; 491 || pFirst->pData[nIndex]=='\r' || pFirst->pData[nIndex]=='\n';
363 } 492 }
364 493
494 /**
495 * Is the character at index (nIndex) a letter?
496 *@param nIndex (long) The index of the character you want to check.
497 *@returns (bool) Is it a letter?
498 */
365 bool isAlpha( long nIndex ) const 499 bool isAlpha( long nIndex ) const
366 { 500 {
367 flatten(); 501 flatten();
@@ -370,6 +504,9 @@ namespace Bu
370 || (pFirst->pData[nIndex] >= 'A' && pFirst->pData[nIndex] <= 'Z'); 504 || (pFirst->pData[nIndex] >= 'A' && pFirst->pData[nIndex] <= 'Z');
371 } 505 }
372 506
507 /**
508 * Convert your alpha characters to lower case.
509 */
373 void toLower() 510 void toLower()
374 { 511 {
375 flatten(); 512 flatten();
@@ -382,6 +519,9 @@ namespace Bu
382 } 519 }
383 } 520 }
384 521
522 /**
523 * Convert your alpha characters to upper case.
524 */
385 void toUpper() 525 void toUpper()
386 { 526 {
387 flatten(); 527 flatten();
@@ -394,6 +534,11 @@ namespace Bu
394 } 534 }
395 } 535 }
396 536
537 /**
538 * Find the index of the first occurrance of (sText)
539 *@param sText (const char *) The string to search for.
540 *@returns (long) The index of the first occurrance. -1 for not found.
541 */
397 long find( const char *sText ) 542 long find( const char *sText )
398 { 543 {
399 long nTLen = strlen( sText ); 544 long nTLen = strlen( sText );
@@ -406,6 +551,11 @@ namespace Bu
406 return -1; 551 return -1;
407 } 552 }
408 553
554 /**
555 * Do a reverse search for (sText)
556 *@param sText (const char *) The string to search for.
557 *@returns (long) The index of the last occurrance. -1 for not found.
558 */
409 long rfind( const char *sText ) 559 long rfind( const char *sText )
410 { 560 {
411 long nTLen = strlen( sText ); 561 long nTLen = strlen( sText );
@@ -418,6 +568,10 @@ namespace Bu
418 return -1; 568 return -1;
419 } 569 }
420 570
571 /**
572 * Function the archiver calls to archive your FString.
573 *@param ar (Archive) The archive which is archiving your FString.
574 */
421 void archive( class Archive &ar ) 575 void archive( class Archive &ar )
422 { 576 {
423 if( ar.isLoading() ) 577 if( ar.isLoading() )
diff --git a/src/hash.h b/src/hash.h
index 1bb25c9..6c4a443 100644
--- a/src/hash.h
+++ b/src/hash.h
@@ -71,6 +71,10 @@ namespace Bu
71 bool bFilled; 71 bool bFilled;
72 72
73 public: 73 public:
74 /**
75 * Cast operator for HashProxy.
76 *@returns (value_type &) The value the HashProxy is pointing to.
77 */
74 operator _value &() 78 operator _value &()
75 { 79 {
76 if( bFilled == false ) 80 if( bFilled == false )
@@ -81,6 +85,10 @@ namespace Bu
81 return *pValue; 85 return *pValue;
82 } 86 }
83 87
88 /**
89 * Direct function for retrieving a value out of the HashProxy.
90 *@returns (value_type &) The value pointed to by this HashProxy.
91 */
84 _value &value() 92 _value &value()
85 { 93 {
86 if( bFilled == false ) 94 if( bFilled == false )
@@ -91,11 +99,17 @@ namespace Bu
91 return *pValue; 99 return *pValue;
92 } 100 }
93 101
102 /**
103 * Whether this HashProxy points to something real or not.
104 */
94 bool isFilled() 105 bool isFilled()
95 { 106 {
96 return bFilled; 107 return bFilled;
97 } 108 }
98 109
110 /**
111 * Erase the data pointed to by this HashProxy.
112 */
99 void erase() 113 void erase()
100 { 114 {
101 if( bFilled ) 115 if( bFilled )
@@ -105,6 +119,10 @@ namespace Bu
105 } 119 }
106 } 120 }
107 121
122 /**
123 * Assign data to this point in the hash table.
124 *@param nval (value_type) the data to assign.
125 */
108 _value operator=( _value nval ) 126 _value operator=( _value nval )
109 { 127 {
110 if( bFilled ) 128 if( bFilled )
@@ -122,6 +140,11 @@ namespace Bu
122 return nval; 140 return nval;
123 } 141 }
124 142
143 /**
144 * Pointer extraction operator. Access to members of data pointed to
145 * by HashProxy.
146 *@returns (value_type *)
147 */
125 _value *operator->() 148 _value *operator->()
126 { 149 {
127 if( bFilled == false ) 150 if( bFilled == false )
@@ -133,6 +156,15 @@ namespace Bu
133 } 156 }
134 }; 157 };
135 158
159 /**
160 * Libbu Template Hash Table
161 *@param key (typename) The datatype of the hashtable keys
162 *@param value (typename) The datatype of the hashtable data
163 *@param sizecalc (typename) Functor to compute new table size on rehash
164 *@param keyalloc (typename) Memory allocator for hashtable keys
165 *@param valuealloc (typename) Memory allocator for hashtable values
166 *@param challoc (typename) Byte allocator for bitflags
167 */
136 template<typename key, typename value, typename sizecalc, typename keyalloc, typename valuealloc, typename challoc > 168 template<typename key, typename value, typename sizecalc, typename keyalloc, typename valuealloc, typename challoc >
137 class Hash 169 class Hash
138 { 170 {
@@ -186,6 +218,10 @@ namespace Bu
186 } 218 }
187 } 219 }
188 220
221 /**
222 * Hashtable assignment operator. Clears this hashtable and
223 * copies RH into it.
224 */
189 Hash &operator=( const Hash &src ) 225 Hash &operator=( const Hash &src )
190 { 226 {
191 for( uint32_t j = 0; j < nCapacity; j++ ) 227 for( uint32_t j = 0; j < nCapacity; j++ )
@@ -244,26 +280,49 @@ namespace Bu
244 ca.deallocate( aHashCodes, nCapacity ); 280 ca.deallocate( aHashCodes, nCapacity );
245 } 281 }
246 282
283 /**
284 * Get the current hash table capacity. (Changes at re-hash)
285 *@returns (uint32_t) The current capacity.
286 */
247 uint32_t getCapacity() 287 uint32_t getCapacity()
248 { 288 {
249 return nCapacity; 289 return nCapacity;
250 } 290 }
251 291
292 /**
293 * Get the number of hash locations spoken for. (Including
294 * not-yet-cleaned-up deleted items.)
295 *@returns (uint32_t) The current fill state.
296 */
252 uint32_t getFill() 297 uint32_t getFill()
253 { 298 {
254 return nFilled; 299 return nFilled;
255 } 300 }
256 301
302 /**
303 * Get the number of items stored in the hash table.
304 *@returns (uint32_t) The number of items stored in the hash table.
305 */
257 uint32_t size() 306 uint32_t size()
258 { 307 {
259 return nFilled-nDeleted; 308 return nFilled-nDeleted;
260 } 309 }
261 310
311 /**
312 * Get the number of items which have been deleted, but not yet
313 * cleaned up.
314 *@returns (uint32_t) The number of deleted items.
315 */
262 uint32_t getDeleted() 316 uint32_t getDeleted()
263 { 317 {
264 return nDeleted; 318 return nDeleted;
265 } 319 }
266 320
321 /**
322 * Hash table index operator
323 *@param k (key_type) Key of data to be retrieved.
324 *@returns (HashProxy) Proxy pointing to the data.
325 */
267 virtual HashProxy<key, value, sizecalc, keyalloc, valuealloc, challoc> operator[]( key k ) 326 virtual HashProxy<key, value, sizecalc, keyalloc, valuealloc, challoc> operator[]( key k )
268 { 327 {
269 uint32_t hash = __calcHashCode( k ); 328 uint32_t hash = __calcHashCode( k );
@@ -280,6 +339,11 @@ namespace Bu
280 } 339 }
281 } 340 }
282 341
342 /**
343 * Insert a value (v) under key (k) into the hash table
344 *@param k (key_type) Key to list the value under.
345 *@param v (value_type) Value to store in the hash table.
346 */
283 virtual void insert( key k, value v ) 347 virtual void insert( key k, value v )
284 { 348 {
285 uint32_t hash = __calcHashCode( k ); 349 uint32_t hash = __calcHashCode( k );
@@ -299,6 +363,10 @@ namespace Bu
299 } 363 }
300 } 364 }
301 365
366 /**
367 * Remove a value from the hash table.
368 *@param k (key_type) The data under this key will be erased.
369 */
302 virtual void erase( key k ) 370 virtual void erase( key k )
303 { 371 {
304 uint32_t hash = __calcHashCode( k ); 372 uint32_t hash = __calcHashCode( k );
@@ -313,6 +381,11 @@ namespace Bu
313 } 381 }
314 382
315 struct iterator; 383 struct iterator;
384
385 /**
386 * Remove a value from the hash pointed to from an iterator.
387 *@param i (iterator &) The data to be erased.
388 */
316 virtual void erase( struct iterator &i ) 389 virtual void erase( struct iterator &i )
317 { 390 {
318 if( this != &i.hsh ) 391 if( this != &i.hsh )
@@ -324,6 +397,9 @@ namespace Bu
324 } 397 }
325 } 398 }
326 399
400 /**
401 * Remove all data from the hash table.
402 */
327 virtual void clear() 403 virtual void clear()
328 { 404 {
329 for( uint32_t j = 0; j < nCapacity; j++ ) 405 for( uint32_t j = 0; j < nCapacity; j++ )
@@ -340,6 +416,11 @@ namespace Bu
340 clearBits(); 416 clearBits();
341 } 417 }
342 418
419 /**
420 * Get an item of data from the hash table.
421 *@param k (key_type) Key pointing to the data to be retrieved.
422 *@returns (value_type &) The data pointed to by (k).
423 */
343 virtual value &get( key k ) 424 virtual value &get( key k )
344 { 425 {
345 uint32_t hash = __calcHashCode( k ); 426 uint32_t hash = __calcHashCode( k );
@@ -359,6 +440,12 @@ namespace Bu
359 } 440 }
360 } 441 }
361 442
443 /**
444 * Get a const item of data from the hash table.
445 *@param k (key_type) Key pointing to the data to be retrieved.
446 *@returns (const value_type &) A const version of the data pointed
447 * to by (k).
448 */
362 virtual const value &get( key k ) const 449 virtual const value &get( key k ) const
363 { 450 {
364 uint32_t hash = __calcHashCode( k ); 451 uint32_t hash = __calcHashCode( k );
@@ -378,6 +465,11 @@ namespace Bu
378 } 465 }
379 } 466 }
380 467
468 /**
469 * Does the hash table contain an item under key (k).
470 *@param k (key_type) The key to check.
471 *@returns (bool) Whether there was an item in the hash under key (k).
472 */
381 virtual bool has( key k ) 473 virtual bool has( key k )
382 { 474 {
383 bool bFill; 475 bool bFill;
@@ -386,6 +478,9 @@ namespace Bu
386 return bFill; 478 return bFill;
387 } 479 }
388 480
481 /**
482 * Iteration structure for iterating through the hash.
483 */
389 typedef struct iterator 484 typedef struct iterator
390 { 485 {
391 friend class Hash<key, value, sizecalc, keyalloc, valuealloc, challoc>; 486 friend class Hash<key, value, sizecalc, keyalloc, valuealloc, challoc>;
@@ -410,6 +505,9 @@ namespace Bu
410 bool bFinished; 505 bool bFinished;
411 506
412 public: 507 public:
508 /**
509 * Iterator incrementation operator. Move the iterator forward.
510 */
413 iterator operator++( int ) 511 iterator operator++( int )
414 { 512 {
415 if( bFinished == false ) 513 if( bFinished == false )
@@ -418,6 +516,9 @@ namespace Bu
418 return *this; 516 return *this;
419 } 517 }
420 518
519 /**
520 * Iterator incrementation operator. Move the iterator forward.
521 */
421 iterator operator++() 522 iterator operator++()
422 { 523 {
423 if( bFinished == false ) 524 if( bFinished == false )
@@ -426,6 +527,9 @@ namespace Bu
426 return *this; 527 return *this;
427 } 528 }
428 529
530 /**
531 * Iterator equality comparison operator. Iterators the same?
532 */
429 bool operator==( const iterator &oth ) 533 bool operator==( const iterator &oth )
430 { 534 {
431 if( bFinished != oth.bFinished ) 535 if( bFinished != oth.bFinished )
@@ -442,11 +546,17 @@ namespace Bu
442 } 546 }
443 } 547 }
444 548
549 /**
550 * Iterator not equality comparison operator. Not the same?
551 */
445 bool operator!=( const iterator &oth ) 552 bool operator!=( const iterator &oth )
446 { 553 {
447 return !(*this == oth ); 554 return !(*this == oth );
448 } 555 }
449 556
557 /**
558 * Iterator assignment operator.
559 */
450 iterator operator=( const iterator &oth ) 560 iterator operator=( const iterator &oth )
451 { 561 {
452 if( &hsh != &oth.hsh ) 562 if( &hsh != &oth.hsh )
@@ -456,32 +566,59 @@ namespace Bu
456 bFinished = oth.bFinished; 566 bFinished = oth.bFinished;
457 } 567 }
458 568
569 /**
570 * Iterator dereference operator... err.. get the value
571 *@returns (value_type &) The value behind this iterator.
572 */
459 value &operator *() 573 value &operator *()
460 { 574 {
461 return hsh.getValueAtPos( nPos ); 575 return hsh.getValueAtPos( nPos );
462 } 576 }
463 577
578 /**
579 * Get the key behind this iterator.
580 *@returns (key_type &) The key behind this iterator.
581 */
464 key &getKey() 582 key &getKey()
465 { 583 {
466 return hsh.getKeyAtPos( nPos ); 584 return hsh.getKeyAtPos( nPos );
467 } 585 }
468 586
587 /**
588 * Get the value behind this iterator.
589 *@returs (value_type &) The value behind this iterator.
590 */
469 value &getValue() 591 value &getValue()
470 { 592 {
471 return hsh.getValueAtPos( nPos ); 593 return hsh.getValueAtPos( nPos );
472 } 594 }
473 }; 595 };
474 596
597 /**
598 * Get an iterator pointing to the first item in the hash table.
599 *@returns (iterator) An iterator pointing to the first item in the
600 * hash table.
601 */
475 iterator begin() 602 iterator begin()
476 { 603 {
477 return iterator( *this ); 604 return iterator( *this );
478 } 605 }
479 606
607 /**
608 * Get an iterator pointing to a point just past the last item in the
609 * hash table.
610 *@returns (iterator) An iterator pointing to a point just past the
611 * last item in the hash table.
612 */
480 iterator end() 613 iterator end()
481 { 614 {
482 return iterator( *this, true ); 615 return iterator( *this, true );
483 } 616 }
484 617
618 /**
619 * Get a list of all the keys in the hash table.
620 *@returns (std::list<key_type>) The list of keys in the hash table.
621 */
485 std::list<key> getKeys() 622 std::list<key> getKeys()
486 { 623 {
487 std::list<key> lKeys; 624 std::list<key> lKeys;
diff --git a/src/list.h b/src/list.h
index 4131987..9d1f904 100644
--- a/src/list.h
+++ b/src/list.h
@@ -21,6 +21,10 @@ namespace Bu
21 * members are only accessable const. Third, erasing a location does not 21 * members are only accessable const. Third, erasing a location does not
22 * invalidate the iterator, it simply points to the next valid location, or 22 * invalidate the iterator, it simply points to the next valid location, or
23 * end() if there are no more. 23 * end() if there are no more.
24 *
25 *@param value (typename) The type of data to store in your list
26 *@param valuealloc (typename) Memory Allocator for your value type
27 *@param linkalloc (typename) Memory Allocator for the list links.
24 */ 28 */
25 template<typename value, typename valuealloc=std::allocator<value>, typename linkalloc=std::allocator<struct ListLink<value> > > 29 template<typename value, typename valuealloc=std::allocator<value>, typename linkalloc=std::allocator<struct ListLink<value> > >
26 class List 30 class List
@@ -53,6 +57,10 @@ namespace Bu
53 clear(); 57 clear();
54 } 58 }
55 59
60 /**
61 * Assignment operator.
62 *@param src (const MyType &) The list to assign to your list.
63 */
56 MyType &operator=( const MyType &src ) 64 MyType &operator=( const MyType &src )
57 { 65 {
58 clear(); 66 clear();
@@ -62,6 +70,9 @@ namespace Bu
62 } 70 }
63 } 71 }
64 72
73 /**
74 * Clear the data from the list.
75 */
65 void clear() 76 void clear()
66 { 77 {
67 Link *pCur = pFirst; 78 Link *pCur = pFirst;
@@ -79,6 +90,10 @@ namespace Bu
79 nSize = 0; 90 nSize = 0;
80 } 91 }
81 92
93 /**
94 * Append a value to the list.
95 *@param v (const value_type &) The value to append.
96 */
82 void append( const value &v ) 97 void append( const value &v )
83 { 98 {
84 Link *pNew = la.allocate( 1 ); 99 Link *pNew = la.allocate( 1 );