
//  Copyright (C) 2009 by Arnaud Dupuis
//  a.dupuis@infinityperl.org
//  http://www.infinityperl.org
// 
//  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 3 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 ASSUMA_ADDONINSTANCE_H
#define ASSUMA_ADDONINSTANCE_H

#include <QMap>
#include <QString>
#include <QStringList>
/*! \class AssumaAddonInstance
* \brief This class represents an addon instance.
*
* This class represents an addon instance. It is only descriptive, it contains (meta)informations but no runable code.
* The purpose of this class is to help encapsulate an addon's bundle and make informations about it easily accessible to C++ code.
*/
class AssumaAddonInstance{
	public:
		//! Constructor
		/*!
		The constructor of the instance. Do nothing but to initialyze internal data structures.
		*/
		AssumaAddonInstance();
		//! Destructor
		/*!
		Free the memory taken by the internal data structures.
		*/
		~AssumaAddonInstance();
		/*!
		Returns the list of values associated with the key key.
		If the instance contains no item with key key, the function returns an empty QStringList.
		\param key the key name.
		\sa insertValue
		*/
		QStringList getValues(const QString & );
		/*!
		Return the author name or an empty string if "Author" key hold no value.
		\sa getValues
		*/
		QString author();
		/*!
		Return the version number or an empty string if "Version" key hold no value.
		\sa getValues
		*/
		QString version();
		/*!
		Return the addon name or an empty string if "Name" key hold no value.
		\sa getValues
		*/
		QString name();
		/*!
		Return the license type or "GPL3" if "License" key hold no value.
		\sa getValues
		*/
		QString license();
		/*!
		Return the addon description or an empty string if "Description" key hold no value.
		\sa getValues
		*/
		QString description();
		/*!
		Return the addon type or an empty string if "Type" key hold no value.
		\sa getValues
		*/
		QString type();
		/*!
		Return the files which contains code in the addon bundle or an empty string list if "CodeFile" key hold no values.
		\sa getValues
		*/
		QStringList codeFiles();
		/*!
		Return the ui file name (and relative path) or an empty string list if "Ui" key hold no value.
		\sa getValues
		*/
		QString uiFile();
		/*!
		Return the list of translation files or an empty string list if "Locales" key hold no values.
		\sa getValues
		*/
		QStringList locales();
		/*!
		Inserts a new item with the key key and a value of value.
		If there is already an item with the same key in the map, this function will simply create a new one.
		
		Please take in consideration that some keys are expected to have a single value (see accessors above).
		\param key the key name
		\param value the value to insert.
		\sa getValues
		*/
		void insertValue(const QString & , const QString &);
	private:
		QMap<QString,QString> _data;
};

#endif
