• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

ut_stack.h

Go to the documentation of this file.
00001 /* -*- mode: C++; tab-width: 4; c-basic-offset: 4; -*- */
00002 
00003 /* AbiSource Program Utilities
00004  * Copyright (C) 1998 AbiSource, Inc.
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * as published by the Free Software Foundation; either version 2
00009  * of the License, or (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00019  * 02110-1301 USA.
00020  */
00021 
00022 
00023 
00024 #ifndef UT_STACK_H
00025 #define UT_STACK_H
00026 
00027 /* pre-emptive dismissal; ut_types.h is needed by just about everything,
00028  * so even if it's commented out in-file that's still a lot of work for
00029  * the preprocessor to do...
00030  */
00031 #ifndef UT_TYPES_H
00032 #include "ut_types.h"
00033 #endif
00034 #include "ut_vector.h"
00035 
00036 class ABI_EXPORT UT_Stack
00037 {
00038 public:
00039     bool            push(void * pVoid);
00040     bool            pop(void ** ppVoid);
00041     bool            viewTop(void ** ppVoid) const;
00042     UT_sint32       getDepth(void) const;
00043     void            clear() {m_vecStack.clear();}
00044 
00045 private:
00046     UT_Vector       m_vecStack;
00047 };
00048 
00049 /* some people have been storing numbers casted to pointers in a UT_Stack;
00050  * this causes problems sometimes on 64-bit architectures.
00051  *
00052  * so, here is a number stack
00053  */
00054 class ABI_EXPORT UT_NumberStack
00055 {
00056 public:
00057     UT_NumberStack (UT_uint32 sizehint = 32, UT_uint32 baseincr = 32); // see UT_NumberVector
00058 
00059     bool            push (UT_sint32 number);
00060     bool            pop (UT_sint32 * number = 0);
00061     bool            viewTop (UT_sint32 & number) const;
00062     UT_sint32       getDepth (void) const;
00063     void            clear() {m_vecStack.clear();}
00064 
00065 private:
00066     UT_NumberVector m_vecStack;
00067 };
00068 
00069 #endif /* UT_STACK_H */

Generated on Sun Feb 14 2021 for AbiWord by  doxygen 1.7.1