//ParseSection.hpp

#ifndef _PARSESECTION
#define _PARSESECTION

const char cBeginBracket = '{';
const char cEndBracket = '}';
const char cExternalReferencesIndicator = '^';
const char cThisFileReference = '*';
const char cStringDelimitator = '"';
const char cBackslash = '\\';
const char cParameterBeginIndicator = '(';
const char cParameterEndIndicator = ')';
const static char szEditModificationsKW [] = {"Edit-Modifications:"};
const static char szEditGeometricModificationsKW [] = {"Edit-Geometric-Modifications:"};

class CParseSection
{
private:
	CString		m_csFinalMDFFileName;
	CStringList m_lstOfRoots;
	CStringList m_lstOfInitialMDFSections;
	CStringList m_lstOfInitialUnchangeableMDFSections;
	CStringList m_lstOfIncludedExternalReferences;

protected:
	int CopySection (CString csFileName, CString csSectionName, BOOL bCopyAsItIs = FALSE);
	int CopySectionWithAnalyze (CString csFileName, CString csSectionName)
	{
		return CopySection (csFileName, csSectionName, FALSE);
	}
	int CopySectionAsItIs (CString csFileName, CString csSectionName)
	{
		return CopySection (csFileName, csSectionName, TRUE);
	}
	int ReadSection (CString csFileName, CString csSectionName, CStringList &rSection);
	int AnalyseSection (CString csFileName, CStringList &rSection);
	int WriteSection (CStringList &rSection);
	int FillListOfInitialMDFSections (CString csInitialMDFFileName);
	CString ComputeAbsoluteFileName (CString csFileName);
	int IsFileNameAbsolute (CString csFileName);
	int CreateTheFinalMDFFile ();
	int IsSectionIncluded (CString csSectionName);
	CString RemoveParameters (CString csRedSectionName);


public:
	CParseSection (CString csFinalMDFFileName = "");
	int ParseFile (CString csInitialMDFFileName, CString csFinalMDFFileName = "");
	void AddRoot (CString csRoot);

};

#endif //_PARSESECTION