//
//	Copyright © 2006 Nemetschek North America 
//	All Rights Reserved.
//
// Created by Vladislav Stanev


#ifndef VW_RECORD_FORMAT_OBJECT__H
#define VW_RECORD_FORMAT_OBJECT__H

#pragma once

namespace VWFC
{
	using namespace Tools;
	
	namespace VWObjects
	{
		class VWRecordFormatObj : public VWObject
		{
		public:
								VWRecordFormatObj(MCObjectHandle hFormatHandle);
								VWRecordFormatObj(const TXString& formatName);
								VWRecordFormatObj(const VWRecordFormatObj& src);
			virtual				~VWRecordFormatObj();

			VWRecordFormatObj&	operator=(const VWRecordFormatObj& src);
	
		public:
			TXString			GetFormatName() const;
			bool				IsParametric() const;
			void				SetParametric(bool bIsParametric);
			bool				GetFormatVisibility() const;
			void				SetFormatVisibility(bool bVisibility);

		// parameters
		public:
			size_t				AddParamLong(const TXString& name, long value, bool bUpdateExistingRecords = true);
			size_t				AddParamBool(const TXString& name, bool value, bool bUpdateExistingRecords = true);
			size_t				AddParamReal(const TXString& name, double value, bool bUpdateExistingRecords = true);
			size_t				AddParamString(const TXString& name, const TXString& value, bool bUpdateExistingRecords = true);

			size_t				GetParamsCount() const;
			TXString			GetParamName(size_t paramIndex) const;
			TXString			GetParamLocalizedName(size_t paramIndex) const;
			// returns ((size_t) -1) if not found
			size_t				GetParamIndex(const TXString& paramName) const;
			EFieldStyle			GetParamStyle(size_t paramIndex) const;
			TXString			GetParamValue(size_t paramIndex) const;
			void				SetParamValue(size_t paramIndex, const TXString& value);

			long				GetParamLong(size_t paramIndex) const;
			void				SetParamLong(size_t paramIndex, long value);
			bool				GetParamBool(size_t paramIndex) const;
			void				SetParamBool(size_t paramIndex, bool value);
			double				GetParamReal(size_t paramIndex) const;
			void				SetParamReal(size_t paramIndex, double value);
			TXString			GetParamString(size_t paramIndex) const;
			void				SetParamString(size_t paramIndex, const TXString& value);

		// Tools
		public:
			// Return true if the specified object handle is record format
			static bool				IsRecordFormatObject(MCObjectHandle hObj);
			static bool				IsRecordFormatObject(MCObjectHandle hObj, const char* szName);
			static MCObjectHandle	GetRecordFormat(const char* szName);

			static void				DeleteRecordFormat(MCObjectHandle hRecFormat);
		};
	}
}

#endif // VW_RECORD_FORMAT_OBJECT__H