/***************************************************************************
*   Copyright (C) 2005 by Denis A. Birukov aka Messenger of death         *
*   riper@fromru.com                                                      *
*                                                                         *
*   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.,                                       *
*   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
***************************************************************************/
#ifndef TEXTCONFIG_H
#define TEXTCONFIG_H
#include <string>
#include "config_classes.h"
#include "storage.h"

#ifdef Revision
#undef Revision
#endif
#define Revision "textconfig.h $Revision: 1.3 $";

class Text_Config_Features : public Config_Features
{
	public:
		virtual bool _support_save() { return true;}
		virtual bool _support_load() { return true;}
		~Text_Config_Features() {}
};

class Text_Config : public Config_Interface
{

	public:
		virtual const Text_Config_Features& _get_features();
		virtual std::string _get_driver_name() { return "TextConfig";};
		virtual std::string _get_value ( std::string name, std::string def );
		virtual bool _set_value ( std::string name, std::string val, bool replace = true );
                virtual int _del_value ( std::string name, bool is_delete_subvalues = false );
                virtual bool _save ( std::string *params, int params_num );
		virtual bool _load ( std::string *params, int params_num );
		void _read_block ( std::istream& stream, const std::string blockname );
                virtual void for_each ( config_functor *functor );
                Text_Config() {}
		virtual ~Text_Config() {}
	private:
		class Storage<std::string,std::string> _storage_;
};

extern "C" Config_Interface* _get_config_interface ( std::string * params, int params_num );


#endif
