00001 // -*- c++ -*- 00002 // 00003 // $Id: globals.h 3356 2010-09-18 21:06:17Z rafi $ 00004 // 00005 // Copyright (C) 2009-2010 Rafael Ostertag 00006 // 00007 // This file is part of YAPET. 00008 // 00009 // YAPET is free software: you can redistribute it and/or modify it under the 00010 // terms of the GNU General Public License as published by the Free Software 00011 // Foundation, either version 3 of the License, or (at your option) any later 00012 // version. 00013 // 00014 // YAPET is distributed in the hope that it will be useful, but WITHOUT ANY 00015 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00016 // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 00017 // details. 00018 // 00019 // You should have received a copy of the GNU General Public License along with 00020 // YAPET. If not, see <http://www.gnu.org/licenses/>. 00021 // 00022 00029 #ifndef _GLOBALS_H 00030 #define _GLOBALS_H 00031 00032 #ifdef HAVE_CONFIG_H 00033 # include "config.h" 00034 #endif 00035 00036 #ifdef HAVE_SYS_TYPES_H 00037 # include <sys/types.h> 00038 #endif 00039 00040 #include "pwgen/rng.h" 00041 00042 namespace YAPET { 00046 namespace GLOBALS { 00047 00048 class Globals { 00049 private: 00050 static YAPET::PWGEN::RNGENGINE pwgen_rng; 00051 static int selected_character_pools; 00052 static size_t selected_password_length; 00053 static bool allow_lock_quit; 00054 static unsigned int pw_input_timeout; 00055 inline Globals() {} 00056 inline ~Globals() {} 00057 inline Globals (const Globals&) {} 00058 inline const Globals& operator= (const Globals&) { 00059 return *this; 00060 } 00061 00062 public: 00063 static void setPWGenRNG(YAPET::PWGEN::RNGENGINE e); 00064 static YAPET::PWGEN::RNGENGINE getPWGenRNG(); 00065 static void setCharacterPools(int cp); 00066 static int getCharacterPools(); 00067 static void setPasswordLength(size_t pl); 00068 static size_t getPasswordLength(); 00069 static void setAllowLockQuit(bool b); 00070 static bool getAllowLockQuit(); 00071 static void setPwInputTimeout(unsigned int i); 00072 static unsigned int getPwInputTimeout(); 00073 }; 00074 00075 } 00076 } 00077 #endif // _GLOBALS_H
1.7.1