/* Cfour (C++ Common Console Classes) * Copyright (C) 2001 Jeffrey Bakker * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * * Author: Jeffrey Bakker * Filename: logpass.cpp * File version: 1.1 * * =========================================================================== * * Created on: July 6th, 2001 * * =========================================================================== * * Remark: * * This is the implementation of the LogPass class which provides set & get * methods, as well as verification methods. * * =========================================================================== * * LogPass(): * * Description: default constructor. * * Input: * - takes 0 parameters * * =========================================================================== * * LogPass(string log, string pass, char a): * * Description: overloaded constructor sets the values passed to it. * * Input: * * Parameter 1 * - Name: log * - Type: string * - Description: the value for Log * * Parameter 2 * - Name: pass * - Type: string * - Description: the value for Pass * * Parameter 3 * - Name: a * - Type: character * - Description: the value for access_Lv * * =========================================================================== * * string get_log(): * * Description: returns the Login name. * * Input: * - takes 0 parameters * * Output: * - returns Log (string) * * =========================================================================== * * string get_pass(): * * Description: returns the Password. * * Input: * - takes 0 parameters * * Output: * - returns Pass (string) * * =========================================================================== * * char get_level(): * * Description: returns the Access Level. * * Input: * - takes 0 parameters * * Output: * - returns access_Lv (char) * * =========================================================================== * * void set_log(string L): * * Description: sets the Login name. * * Input: * * Parameter 1 * - Name: L * - Type: string * - Description: the new value for Log * * Output: * - returns nothing * * =========================================================================== * * void set_pass(string P): * * Description: sets the Password. * * Input: * * Parameter 1 * - Name: P * - Type: string * - Description: the new value for Pass * * Output: * - returns nothing * * =========================================================================== * * void set_access(char A): * * Description: sets the Access Level. * * Input: * * Parameter 1 * - Name: A * - Type: character * - Description: the new value for access_Lv * * Output: * - returns nothing * * =========================================================================== * * bool vlogin(string L): * * Description: verifies whether or not the Logins match. * * Input: * * Parameter 1 * - Name: L * - Type: string * - Description: the Login to be checked * * Output: * - returns true if L matches Log, false otherwise * * =========================================================================== * * bool vpassword(string P): * * Description: verifies whether or not the Passwords match. * * Input: * * Parameter 1 * - Name: P * - Type: string * - Description: the Password to be checked * * Output: * - returns true if P matches Pass, false otherwise * _______. .. */ #include "logpass.h" // default constructor -------------------------------------------------------- LogPass::LogPass() { Log = "staffmember"; Pass = "please"; access_Lv = '1'; } // overloaded constructor ----------------------------------------------------- LogPass::LogPass(string L, string P, char A) { Log = L; Pass = P; access_Lv = A; } //----------------------------------------------------------------------------- // get methods ---------------------------------------------------------------- string LogPass::get_log() const {return Log;} string LogPass::get_pass() const {return Pass;} char LogPass::get_level() const {return access_Lv;} //----------------------------------------------------------------------------- // set methods ---------------------------------------------------------------- void LogPass::set_log(string L) {Log = L;} void LogPass::set_pass(string P) {Pass = P;} void LogPass::set_access(char A) {access_Lv = A;} //----------------------------------------------------------------------------- // verification methods ------------------------------------------------------- bool LogPass::vlogin(string L) const { if (L == Log) {return true;} return false; } bool LogPass::vpassword(string P) const { if (P == Pass) {return true;} return false; } //-----------------------------------------------------------------------------