00001 /*! 00002 * \file PasswordTreeElement.h 00003 * \brief Define the main element of the password composite 00004 * 00005 * \author Frederic RUAUDEL <grumz@users.sf.net> 00006 * 00007 * $Revision: 1.9 $ 00008 * $Date: 2003/02/22 14:02:13 $ 00009 * 00010 * \b PassGuardFramework 00011 * Copyleft (c) 2002 Frederic RUAUDEL, all rights reversed 00012 * 00013 * This program is free software which I release under the GNU General Public 00014 * License. You may redistribute and/or modify this program under the terms 00015 * of that license as published by the Free Software Foundation; either 00016 * version 2 of the License, or (at your option) any later version. 00017 * 00018 * This program is distributed in the hope that it will be useful, 00019 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00020 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00021 * GNU General Public License for more details. Version 2 is in the 00022 * COPYING file in the top level directory of this distribution. 00023 * 00024 * To get a copy of the GNU General Public License, write to the Free Software 00025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00026 **/ 00027 00028 #ifndef PASSWORD_TREE_ELEMENT_H 00029 #define PASSWORD_TREE_ELEMENT_H 00030 00031 #include <stdio.h> 00032 00033 #include <string> 00034 00035 #include <PasswordTreeElementAbstractVisitor.h> 00036 00037 using namespace std; 00038 00039 /*! 00040 * \brief Main element of the password composite 00041 **/ 00042 class PasswordTreeElement : public PassguardErrorManager 00043 { 00044 public: 00045 virtual ~PasswordTreeElement (); 00046 00047 bool isSavable (void) const; 00048 virtual void setSavable (bool savable); 00049 00050 string getName (void) const; 00051 void setName (string name); 00052 00053 int getDeepness (void) const; 00054 void setDeepness (int deepness); 00055 00056 virtual bool addElement (PasswordTreeElement* element); 00057 virtual bool delElement (PasswordTreeElement* element); 00058 00059 virtual int getNbChild (void); 00060 00061 virtual bool allow (PasswordTreeElementAbstractVisitor& visitor) = 0; 00062 00063 protected: 00064 PasswordTreeElement (string name, int deepness); 00065 00066 string _name; 00067 int _deepness; 00068 bool _savable; 00069 }; 00070 00071 /*! 00072 * \fn bool PasswordTreeElement::allow (PasswordTreeElementAbstractVisitor& visitor) = 0 00073 * 00074 * \brief Defines the visitor interface to deal with data 00075 * processing accross the composite 00076 * 00077 * \param visitor the visitor class that will make the wanted data processing 00078 * 00079 * \retval false data can't be processed in this branch so switch 00080 * to next one of the current level 00081 * \retval true data have been processed so stop running through 00082 * the composite 00083 **/ 00084 00085 #endif /* PASSWORD_TREE_ELEMENT_H */