00001 /* 00002 * The Mana World Server 00003 * Copyright 2004 The Mana World Development Team 00004 * 00005 * This file is part of The Mana World. 00006 * 00007 * The Mana World is free software; you can redistribute it and/or modify it 00008 * under the terms of the GNU General Public License as published by the Free 00009 * Software Foundation; either version 2 of the License, or any later version. 00010 * 00011 * The Mana World is distributed in the hope that it will be useful, but 00012 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 00013 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 00014 * more details. 00015 * 00016 * You should have received a copy of the GNU General Public License along 00017 * with The Mana World; if not, write to the Free Software Foundation, Inc., 00018 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 * 00020 * $Id: storage.cpp 2951 2006-12-29 13:43:24Z gmelquio $ 00021 */ 00022 00023 #include "account-server/dalstorage.hpp" 00024 #include "account-server/storage.hpp" 00025 00026 // initialize the static attributes. 00027 Storage* Storage::mInstance = 0; 00028 std::string Storage::mName(""); 00029 std::string Storage::mUser(""); 00030 std::string Storage::mPassword(""); 00031 00032 00036 Storage::Storage(void) 00037 throw() 00038 { 00039 // NOOP 00040 } 00041 00042 00046 Storage::~Storage(void) 00047 throw() 00048 { 00049 // NOOP 00050 } 00051 00052 00056 Storage& 00057 Storage::instance(const std::string& name) 00058 { 00059 if (mInstance == 0) { 00060 mInstance = new DALStorage(); 00061 00062 // set the name of the storage. 00063 mName = name; 00064 } 00065 00066 return (*mInstance); 00067 } 00068 00069 00073 void 00074 Storage::destroy(void) 00075 { 00076 if (mInstance != 0) { 00077 delete mInstance; 00078 mInstance = 0; 00079 } 00080 00081 // reset the attributes. 00082 mName = ""; 00083 mUser = ""; 00084 mPassword = ""; 00085 } 00086 00087 00091 bool 00092 Storage::isOpen(void) const 00093 { 00094 return mIsOpen; 00095 } 00096 00097 00101 const std::string& 00102 Storage::getName(void) const 00103 { 00104 return mName; 00105 } 00106 00107 00111 void 00112 Storage::setUser(const std::string& userName) 00113 { 00114 mUser = userName; 00115 } 00116 00117 00121 const std::string& 00122 Storage::getUser(void) const 00123 { 00124 return mUser; 00125 } 00126 00127 00131 void 00132 Storage::setPassword(const std::string& password) 00133 { 00134 mPassword = password; 00135 } 00136 00137 00141 const std::string& 00142 Storage::getPassword(void) const 00143 { 00144 return mPassword; 00145 }
1.3.9.1