// EdIRDict.hpp : header file
//

#ifndef _EDIRDICT_HPP_
#define _EDIRDICT_HPP_

#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000


#define C_INVALID_ID								-1
#define C_INVALID_WORD							""
#define C_INVALID_LANGUAGE					""
#define C_INVALID_SCRIPTNAME				""

#define M_ID_IS_VALID(a)						((a)!=C_INVALID_ID)
#define M_WORD_IS_VALID(a)					((a)!=C_INVALID_WORD)
#define M_LANGUAGE_IS_VALID(a)			((a)!=C_INVALID_LANGUAGE)
#define M_SCRIPTNAME_IS_VALID(a)		((a)!=C_INVALID_SCRIPTNAME)

#define M_ID_IS_INVALID(a)					((a)==C_INVALID_ID)
#define M_WORD_IS_INVALID(a)				((a)==C_INVALID_WORD)
#define M_LANGUAGE_IS_INVALID(a)		((a)==C_INVALID_LANGUAGE)
#define M_SCRIPTNAME_IS_INVALID(a)	((a)==C_INVALID_SCRIPTNAME)

//////////////////////////////////////////////////////////////////
// class CPA_EdIR_WordEntry
//////////////////////////////////////////////////////////////////

/****************************************************************************/
class CPA_EdIR_WordEntry
{
//ANNECY CB
	public:
//	private:
//END 
		CString	m_csLanguage;
		CString	m_csWord;

	public:
		CPA_EdIR_WordEntry();
		CPA_EdIR_WordEntry(CString,CString);

		CString	m_fn_csGetLanguage();
		CString	m_fn_csGetWord();

		void		m_fn_vSetLanguage(CString);
		void		m_fn_vSetWord(CString);
};

//////////////////////////////////////////////////////////////////
// class CPA_EdIR_DictionnaryEntry
//////////////////////////////////////////////////////////////////

/****************************************************************************/
class CPA_EdIR_DictionnaryEntry
{
	private:
		CPA_EdIR_WordEntry	*m_pclWordEntries;
		CString							m_csScriptName;
		long								m_lId;
		long								m_lNbEntries;
		long								m_lCurrentEntry;

	public:
		CPA_EdIR_DictionnaryEntry(long);
		~CPA_EdIR_DictionnaryEntry();

		void		m_fn_vAddEntry(CString,CString);

		CString	m_fn_csGetScriptName();
		long		m_fn_lGetId();

		void		m_fn_vSetScriptName(CString);
		void		m_fn_vSetId(long);

		CString	m_fn_csGetName(CString);

		CString	m_fn_csTranslate(CString,CString);
//ANNECY CB
		BOOL		m_fn_bEntryExists(CString &, CString &);
//		BOOL		m_fn_bEntryExists(CString,CString);
	public:
		char	m_acFirstLetter[256];
		char	m_acSecondLetter[256];
//END ANNECY
};

//////////////////////////////////////////////////////////////////
// class CPA_EdIR_Dictionary
//////////////////////////////////////////////////////////////////
//ANNECY CB
#include <afxtempl.h>
//END
/****************************************************************************/
class CPA_EdIR_Dictionary
{
	private:
		CPA_EdIR_DictionnaryEntry	**m_ppclDictionnaryEntry;
		long											m_lNbEntries;
		long											m_lCurrentEntry;

		//for fast translation
		struct CPA_EdIR_stCouple
		{
			CString	csWord;
			CString	csTranslatedWord;
		};

		CPA_EdIR_stCouple	*m_pstCouple;
		static int				m_fn_iCompareNoCase(const void *,const void *);
		CString						m_csOldLanguage1;
		CString						m_csOldLanguage2;

	public:
		CPA_EdIR_Dictionary(long,long);
		~CPA_EdIR_Dictionary();

		long		m_fn_lGetNbEntries();

		void		m_fn_vAddEntry(CString,long,CString,CString);
//ANNECY CB
		long		m_fn_lGetId(CString &,CString &);
		CString	m_fn_csGetWord(long,CString&);
//		long		m_fn_lGetId(CString,CString);
//		CString	m_fn_csGetWord(long,CString);
//END ANNECY
		CString	m_fn_csTranslate(CString,CString);

		void		m_fn_vInitFastTranslation(CString,CString);
		CString	m_fn_csFastTranslate(CString);
//ANNECY CB
	public:
		char		m_acFirstLetter[256];
		char		m_acSecondLetter[256];
//END ANNECY
};

#endif //_EDIRDICT_HPP_
