00001 /*! 00002 * \file PasswordTree.h 00003 * \brief Defines the password tree manager 00004 * 00005 * \author Frederic RUAUDEL <grumz@users.sf.net> 00006 * 00007 * $Revision: 1.9 $ 00008 * $Date: 2003/02/20 14:18:46 $ 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_H 00029 #define PASSWORD_TREE_H 00030 00031 #include <stdio.h> 00032 00033 #include <PasswordInfos.h> 00034 #include <PasswordRootElement.h> 00035 #include <PasswordCodecPrototype.h> 00036 #include <PasswordTreeElementFactory.h> 00037 #include <PasswordTreeAddElementVisitor.h> 00038 #include <PasswordSaverVisitor.h> 00039 #include <PassguardErrorManager.h> 00040 00041 using namespace std; 00042 00043 /*! 00044 * \brief The password tree manager 00045 **/ 00046 class PasswordTree : public PassguardErrorManager 00047 { 00048 public: 00049 PasswordTree (PasswordTreeElementFactory* factory); 00050 ~PasswordTree (); 00051 00052 void create (PasswordCodecPrototype* codec); 00053 bool save (PasswordCodecPrototype* codec, string password); 00054 bool saveAs (PasswordCodecPrototype* codec, string password, string filename); 00055 PasswordRootElement* getRoot (void); 00056 00057 private: 00058 PasswordRootElement* _tree_root; 00059 PasswordTreeAddElementVisitor _insertion_visitor; 00060 PasswordSaverVisitor _saver_visitor; 00061 PasswordTreeElementFactory* _factory; 00062 }; 00063 00064 #endif /* PASSWORD_TREE_H */