Used a more uniform of logging and added a commandline parser.
[UnsignedByte.git] / src / DB / Savables / Echo.cpp
blob265c282d7e73756f4c17c842eb7febb4a200748e
1 /***************************************************************************
2 * Copyright (C) 2008 by Sverre Rabbelier *
3 * sverre@rabbelier.nl *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 3 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
21 #include "Echo.h"
22 #include "Global.h"
23 #include "FieldImpls.h"
24 #include "TableImpls.h"
26 using mud::Echo;
27 using namespace mud;
29 Echo::Echo(SavableManagerPtr echo) :
30 m_echo(echo)
32 Assert(echo);
35 Echo::~Echo(void)
37 Unlock();
40 const std::string& Echo::getMessage() const
42 return m_echo->getValue(db::TableImpls::Get()->ECHOS->MESSAGE)->getStringValue();
45 value_type Echo::getAudibility() const
47 return m_echo->getValue(db::TableImpls::Get()->ECHOS->AUDIBILITY)->getIntegerValue();
50 value_type Echo::getVisibility() const
52 return m_echo->getValue(db::TableImpls::Get()->ECHOS->VISIBILITY)->getIntegerValue();
55 void Echo::setMessage(const std::string& message)
57 Lock();
58 ValuePtr value(new FieldValue(db::TableImpls::Get()->ECHOS->MESSAGE, message));
59 m_echo->setValue(value);
62 void Echo::setAudibility(value_type audibility)
64 Lock();
65 ValuePtr value(new FieldValue(db::TableImpls::Get()->ECHOS->AUDIBILITY, audibility));
66 m_echo->setValue(value);
69 void Echo::setVisibility(value_type visibility)
71 Lock();
72 ValuePtr value(new FieldValue(db::TableImpls::Get()->ECHOS->VISIBILITY, visibility));
73 m_echo->setValue(value);
76 void Echo::Delete()
78 Lock();
79 m_echo->erase();
82 void Echo::Save()
84 Lock();
85 m_echo->save();
88 void Echo::Discard()
90 Lock();
91 m_echo->discard();
94 bool Echo::Exists()
96 return m_echo->exists();
99 SavableManagerPtr Echo::getManager() const
101 return m_echo;
104 TableImplPtr Echo::getTable() const
106 return m_echo->getTable();