/*************************************************************************/
/* Copyright (c) 2015 dx, http://kaimi.ru                                */
/*                                                                       */
/* Permission is hereby granted, free of charge, to any person           */
/* obtaining a copy of this software and associated documentation        */
/* files (the "Software"), to deal in the Software without               */
/* restriction, including without limitation the rights to use,          */
/* copy, modify, merge, publish, distribute, sublicense, and/or          */
/* sell copies of the Software, and to permit persons to whom the        */
/* Software is furnished to do so, subject to the following conditions:  */
/* The above copyright notice and this permission notice shall be        */
/* included in all copies or substantial portions of the Software.       */
/*                                                                       */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,       */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF    */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY  */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,  */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE     */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                */
/*************************************************************************/
#pragma once
#include "version_info_types.h"
#include "version_info_viewer.h"

namespace pe_bliss
{
	//Helper class to read and edit version information
	//lang_string_values_map: map of version info strings with encodings
	//translation_values_map: map of translations
	class version_info_editor : public version_info_viewer
	{
	public:
		//Default constructor
		//strings - version info strings with charsets
		//translations - version info translations map
		version_info_editor(lang_string_values_map& strings, translation_values_map& translations);

		//Below functions have parameter translation
		//If it's empty, the default language translation will be taken
		//If there's no default language translation, the first one will be taken

		//Sets company name
		void set_company_name(const std::wstring& value, const std::wstring& translation = std::wstring());
		//Sets file description
		void set_file_description(const std::wstring& value, const std::wstring& translation = std::wstring());
		//Sets file version
		void set_file_version(const std::wstring& value, const std::wstring& translation = std::wstring());
		//Sets internal file name
		void set_internal_name(const std::wstring& value, const std::wstring& translation = std::wstring());
		//Sets legal copyright
		void set_legal_copyright(const std::wstring& value, const std::wstring& translation = std::wstring());
		//Sets original file name
		void set_original_filename(const std::wstring& value, const std::wstring& translation = std::wstring());
		//Sets product name
		void set_product_name(const std::wstring& value, const std::wstring& translation = std::wstring());
		//Sets product version
		void set_product_version(const std::wstring& value, const std::wstring& translation = std::wstring());

		//Sets version info property value
		//property_name - property name
		//value - property value
		//If translation does not exist, it will be added to strings and translations lists
		//If property does not exist, it will be added
		void set_property(const std::wstring& property_name, const std::wstring& value, const std::wstring& translation = std::wstring());

		//Adds translation to translation list
		void add_translation(const std::wstring& translation);
		void add_translation(uint16_t language_id, uint16_t codepage_id);

		//Removes translation from translations and strings lists
		void remove_translation(const std::wstring& translation);
		void remove_translation(uint16_t language_id, uint16_t codepage_id);

	private:
		lang_string_values_map& strings_edit_;
		translation_values_map& translations_edit_;
	};
}
