prefs.cpp

Go to the documentation of this file.
00001 /*
00002  *  Copyright (C) 2004-2005 Alo Sarv <madcat_@users.sourceforge.net>
00003  *
00004  *  This program is free software; you can redistribute it and/or modify
00005  *  it under the terms of the GNU General Public License as published by
00006  *  the Free Software Foundation; either version 2 of the License, or
00007  *  (at your option) any later version.
00008  *
00009  *  This program is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *  GNU General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU General Public License
00015  *  along with this program; if not, write to the Free Software
00016  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017  */
00018 
00019 #include <hn/hnprec.h>
00020 #include <hn/prefs.h>
00021 #include <hn/hydranode.h>
00022 
00023 // Prefs class implementation
00024 // --------------------------
00025 Prefs::Prefs() : Object(&HydraNode::instance(), "config") {}
00026 Prefs::~Prefs() {}
00027 Prefs& Prefs::instance() {
00028         static Prefs prefs;
00029         return prefs;
00030 }
00031 
00032 // Override Object class virtuals
00033 uint8_t Prefs::getDataCount() const {
00034         return size();
00035 }
00036 std::string Prefs::getData(uint8_t num) const {
00037         // \todo This is stupid ... needs better logic
00038         Config::CIter iter = Config::begin();
00039         for (uint32_t i = 0; i < num; ++i, ++iter);
00040         return (*iter).second;
00041 }
00042 
00043 std::string Prefs::getFieldName(uint8_t num) const {
00044         // \todo This is stupid ... needs better logic
00045         Config::CIter iter = Config::begin();
00046         for (uint32_t i = 0; i < num; ++i, ++iter);
00047         return (*iter).first;
00048 }
00049