00001 /*! 00002 * \file PasswordInfos.h 00003 * \brief Defines the structure holding the password informations 00004 * 00005 * \author Frederic RUAUDEL <grumz@users.sf.net> 00006 * 00007 * $Revision: 1.8 $ 00008 * $Date: 2003/02/22 14:03:35 $ 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_INFOS_H 00029 #define PASSWORD_INFOS_H 00030 00031 #include <stdio.h> 00032 00033 #include <iostream> 00034 #include <string> 00035 #include <vector> 00036 00037 #include <PassguardErrorManager.h> 00038 00039 using namespace std; 00040 00041 /*! 00042 * \brief Structure holding the password informations 00043 * 00044 * It is composed by a password string, a vector of elements describing 00045 * what the password is for (eg. host, service, user, etc.) and a 00046 * description string to give more information if necessary. 00047 * 00048 * The elements' vector will be the basis for the construction of the password 00049 * tree. Each element represent a branch of the tree and the password is 00050 * the leaf. 00051 **/ 00052 class PasswordInfos : public PassguardErrorManager 00053 { 00054 public: 00055 PasswordInfos (unsigned int nb_elements); 00056 PasswordInfos (const PasswordInfos& password_infos); 00057 ~PasswordInfos (); 00058 00059 string getElement (unsigned int nth); 00060 bool setElement (unsigned int nth, string name); 00061 string& operator[] (int nth); 00062 00063 unsigned int getNbElements (void) const; 00064 00065 string getPassword (void) const; 00066 void setPassword (string password); 00067 00068 string getDescription (void) const; 00069 void setDescription (string description); 00070 00071 bool isEqualUntilLevel (PasswordInfos password_infos, int nth); 00072 bool operator== (PasswordInfos& password_infos); 00073 PasswordInfos& operator= (const PasswordInfos& password_infos); 00074 00075 string getString (char inline_separator); 00076 void print (void); 00077 void print (PasswordInfos fields_name); 00078 00079 private: 00080 vector<string> _elements; 00081 string _password; 00082 string _description; 00083 }; 00084 00085 #endif /* PASSWORD_INFOS_H */