Aegis  4.25.D505
common/symtab_iter.h
Go to the documentation of this file.
00001 //
00002 //      aegis - project change supervisor
00003 //      Copyright (C) 2001, 2004-2008 Peter Miller
00004 //
00005 //      This program is free software; you can redistribute it and/or modify
00006 //      it under the terms of the GNU General Public License as published by
00007 //      the Free Software Foundation; either version 3 of the License, or
00008 //      (at your option) any later version.
00009 //
00010 //      This program is distributed in the hope that it will be useful,
00011 //      but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 //      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 //      GNU General Public License for more details.
00014 //
00015 //      You should have received a copy of the GNU General Public License
00016 //      along with this program. If not, see
00017 //      <http://www.gnu.org/licenses/>.
00018 //
00019 
00020 #ifndef COMMON_SYMTAB_ITER_H
00021 #define COMMON_SYMTAB_ITER_H
00022 
00023 #include <common/symtab.h>
00024 
00029 class symtab_iterator
00030 {
00031 public:
00032     ~symtab_iterator();
00033     symtab_iterator(const symtab_ty *);
00034 
00035     void reset(void);
00036     bool next(string_ty **key, void **data);
00037     bool next(nstring &key, void *&data);
00038 
00039 private:
00040     //
00041     // These fields are for internal use only, and are not to be
00042     // accessed or manipulated by clents of this interface.
00043     //
00044     const symtab_ty *stp;
00045     symtab_ty::row_t *rp;
00046     str_hash_ty pos;
00047 
00048     symtab_iterator();
00049     symtab_iterator(const symtab_iterator &);
00050     symtab_iterator &operator=(const symtab_iterator &);
00051 };
00052 
00053 inline symtab_iterator *
00054 symtab_iterator_new(symtab_ty *arg)
00055 {
00056     return new symtab_iterator(arg);
00057 }
00058 
00059 inline void
00060 symtab_iterator_delete(symtab_iterator *stip)
00061 {
00062     delete stip;
00063 }
00064 
00065 inline void
00066 symtab_iterator_reset(symtab_iterator *stip)
00067 {
00068     stip->reset();
00069 }
00070 
00071 inline int
00072 symtab_iterator_next(symtab_iterator *stip, string_ty **key_p, void **data_p)
00073 {
00074     return stip->next(key_p, data_p);
00075 }
00076 
00077 #endif // COMMON_SYMTAB_ITER_H