~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_list.h

  • Committer: Brian Aker
  • Date: 2011-02-22 06:12:02 UTC
  • mfrom: (2190.1.6 drizzle-build)
  • Revision ID: brian@tangent.org-20110222061202-k03czxykqy4x9hjs
List update, header fixes, multiple symbols, and David deletes some code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
302
302
    :list(0), el(0), prev(0), current(0)
303
303
  {}
304
304
 
305
 
  base_list_iterator(base_list &list_par)
306
 
  { init(list_par); }
307
 
 
308
 
  inline void init(base_list &list_par)
 
305
  base_list_iterator(base_list &list_par, list_node** el0)
 
306
    :list(&list_par), el(el0), prev(0), current(0)
309
307
  {
310
 
    list= &list_par;
311
 
    el= &list_par.first;
312
 
    prev= 0;
313
 
    current= 0;
314
308
  }
315
309
 
316
310
  inline void *next(void)
370
364
public:
371
365
  typedef List_iterator<T> iterator;
372
366
 
 
367
  friend class List_iterator<T>;
 
368
 
373
369
  inline List() :base_list() {}
374
370
  inline List(const List<T> &tmp) :base_list(tmp) {}
375
371
  inline List(const List<T> &tmp, memory::Root *mem_root) :
396
392
 
397
393
  iterator begin()
398
394
  {
399
 
    return iterator(*this);
 
395
    return iterator(*this, &first);
400
396
  }
401
397
};
402
398
 
404
400
template <class T> class List_iterator :public base_list_iterator
405
401
{
406
402
public:
407
 
  explicit List_iterator(List<T> &a) : base_list_iterator(a) {}
408
 
  List_iterator() : base_list_iterator() {}
 
403
  List_iterator(List<T>& a, list_node** b) : base_list_iterator(a, b) {};
 
404
  List_iterator() {};
409
405
  inline T* operator++(int) { return (T*) base_list_iterator::next(); }
410
406
  inline T *replace(T *a)   { return (T*) base_list_iterator::replace(a); }
411
407
  inline T *replace(List<T> &a) { return (T*) base_list_iterator::replace(a); }
428
424
*/
429
425
 
430
426
template <typename T>
431
 
inline
432
 
void
433
 
list_copy_and_replace_each_value(List<T> &list, memory::Root *mem_root)
 
427
void list_copy_and_replace_each_value(List<T> &list, memory::Root *mem_root)
434
428
{
435
429
  /* Make a deep copy of each element */
436
 
  typename List<T>::iterator it(list);
 
430
  typename List<T>::iterator it(list.begin());
437
431
  T *el;
438
432
  while ((el= it++))
439
433
    it.replace(el->clone(mem_root));