00001 /******************************************************************************* 00002 00003 Copyright (C) 2007 by Brendon Costa 00004 00005 This library is free software; you can redistribute it and/or modify 00006 it under the terms of the "LGPL Like" License defined in the file COPYING 00007 that should have been distributed along with this source. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00012 00013 You should have received a copy of the "LGPL Like" License 00014 along with this library; see the file COPYING. if not, it can be 00015 obtained from the EDoc++ website: 00016 http://edoc.sourceforge.net/license.html 00017 00018 *******************************************************************************/ 00019 #include "config.h" 00020 00021 #include "EDoc/StackRef.h" 00022 00023 namespace EDoc 00024 { 00025 //=========================================================================== 00026 StackRef::StackRef(PStack& stack_in, const void* item_in) : 00027 valid(false), 00028 stack(stack_in), 00029 item(item_in) 00030 { 00031 valid = stack.Push(item); 00032 } 00033 //=========================================================================== 00034 StackRef::~StackRef() 00035 { 00036 if (valid) 00037 { 00038 if (!stack.Pop(item)) 00039 { 00040 EDOC_ASSERT(false, "Stack mismatch."); 00041 } 00042 } 00043 } 00044 //=========================================================================== 00045 00046 }