Click here to Skip to main content
15,891,828 members
Articles / Desktop Programming / MFC

Documenting Header Files

Rate me:
Please Sign up or sign in to vote.
2.95/5 (14 votes)
16 Sep 2003CPOL6 min read 63.8K   844   24  
This tool will turn a header file into an XML and/or HTML file for documentation purposes. The output may be merged with previously created or edited XML files.
// Helper classes - Constructors and Destructors
// Keep Your City clean

#include "stdafx.h"
#include "CStringHelpers.h"
#include "ModulHelpers.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

SModulVariable::SModulVariable()
{ m_strName    = _T("");
  m_strHREFName = _T("");
  m_strClass  = _T("");
  m_strSplitfileName  = _T("");
  m_strSplitfileTitle = _T("");
  m_strShortDescription = _T("");
  m_strLongDescription  = _T("");
  
  m_mtType = mt_unknown;

  m_astrParameter.RemoveAll();
  m_astrReturn.RemoveAll();
  m_astrFullName.RemoveAll();
  m_astrDescriptionParameter.RemoveAll();
  m_astrDescriptionReturn.RemoveAll();
}

SModulVariable::~SModulVariable()
{ m_strName.Empty();
  m_strHREFName.Empty();
  m_strClass.Empty();
  m_strSplitfileName.Empty();
  m_strSplitfileTitle.Empty();
  m_strShortDescription.Empty();
  m_strLongDescription.Empty();

  m_mtType = mt_unknown;

  m_astrParameter.RemoveAll();
  m_astrReturn.RemoveAll();
  m_astrFullName.RemoveAll();
  m_astrDescriptionParameter.RemoveAll();
  m_astrDescriptionReturn.RemoveAll();
}

void SModulVariable::Empty(void)
{ m_strName     = _T("");
  m_strHREFName = _T("");
  m_strClass    = _T("");
  m_strSplitfileName  = _T("");
  m_strSplitfileTitle = _T("");
  m_strShortDescription = _T("");
  m_strLongDescription  = _T("");

  m_mtType = mt_unknown;

  m_astrParameter.RemoveAll();
  m_astrReturn.RemoveAll();
  m_astrFullName.RemoveAll();
  m_astrDescriptionParameter.RemoveAll();
  m_astrDescriptionReturn.RemoveAll();
};

SModulClasses::SModulClasses()
{ m_strName         = _T("");
  m_strHREFName      = _T("");
  m_strBaseclass  = _T("");
  m_strHREFVariables = _T("");
  m_strHREFFunctions = _T("");
  m_strDescription   = _T("");
  m_strDescriptionMemberlist = _T("");
  m_strDescriptionMethodlist = _T("");

  m_mtType = mt_unknown;

  m_strSplitfileName  = _T("");
  m_strSplitfileTitle = _T("");
  m_strSplitfileNameClassVariables  = _T("");
  m_strSplitfileTitleClassVariables = _T("");
  m_strSplitfileNameClassFunctions  = _T("");
  m_strSplitfileTitleClassFunctions = _T("");

  m_iVariables          = 0;
  m_iTotalVariables     = 0;
  m_iprivateVariables   = 0;
  m_iprotectedVariables = 0;
  m_ipublicVariables    = 0;
  m_smvVariables = NULL;

  m_iFunctions          = 0;
  m_iTotalFunctions     = 0;
  m_iprivateFunctions   = 0;
  m_iprotectedFunctions = 0;
  m_ipublicFunctions    = 0;
  m_smvFunctions = NULL;

};

SModulClasses::~SModulClasses()
{ m_strName.Empty();
  m_strHREFName.Empty();
  m_strBaseclass.Empty();
  m_strHREFVariables.Empty();
  m_strHREFFunctions.Empty();
  m_strDescription.Empty();
  m_strDescriptionMemberlist.Empty();
  m_strDescriptionMethodlist.Empty();

  m_strSplitfileName.Empty();
  m_strSplitfileTitle.Empty();
  m_strSplitfileNameClassVariables.Empty();
  m_strSplitfileTitleClassVariables.Empty();
  m_strSplitfileNameClassFunctions.Empty();
  m_strSplitfileTitleClassFunctions.Empty();

  m_mtType = mt_unknown;

  delete [] m_smvVariables;
  m_iVariables          = 0;
  m_iTotalVariables     = 0;
  m_iprivateVariables   = 0;
  m_iprotectedVariables = 0;
  m_ipublicVariables    = 0;
  m_smvVariables = NULL;

  delete [] m_smvFunctions;
  m_iFunctions          = 0;
  m_iTotalFunctions     = 0;
  m_iprivateFunctions   = 0;
  m_iprotectedFunctions = 0;
  m_ipublicFunctions    = 0;
  m_smvFunctions = NULL;
};

void SModulClasses::Empty(void)
{ m_strName          = _T("");
  m_strHREFName      = _T("");
  m_strBaseclass     = _T("");
  m_strHREFVariables = _T("");
  m_strHREFFunctions = _T("");
  m_strDescription   = _T("");
  m_strDescriptionMemberlist = _T("");
  m_strDescriptionMethodlist = _T("");

  m_strSplitfileName  = _T("");
  m_strSplitfileTitle = _T("");
  m_strSplitfileNameClassVariables  = _T("");
  m_strSplitfileTitleClassVariables = _T("");
  m_strSplitfileNameClassFunctions  = _T("");
  m_strSplitfileTitleClassFunctions = _T("");

  m_mtType = mt_unknown;

  delete [] m_smvVariables;
  m_iVariables = 0;
  m_iTotalVariables = 0;
  m_smvVariables = NULL;

  delete [] m_smvFunctions;
  m_iFunctions = 0;
  m_iTotalFunctions = 0;
  m_smvFunctions = NULL;
};

SModul::SModul()
{ m_strHTMLTitle = _T("");
  m_strHREFModul           = _T("");
  m_strHREFGlobalVariables = _T("");
  m_strHREFGlobalFunctions = _T("");
  m_strSplitfileModulName  = _T("");
  m_strDescription         = _T("");
  m_strSplitfileNameGlobalVariables = _T("");
  m_strSplitfileNameGlobalFunctions = _T("");
  m_strSplitfileTitleModul           = _T("");
  m_strSplitfileTitleGlobalVariables = _T("");
  m_strSplitfileTitleGlobalFunctions = _T("");

  m_iClasses = 0;                 
  m_iNonClassVariables = 0;       
  m_iNonClassFunctions = 0;       
  m_iTotalNonClassVariables  = 0;  
  m_iLocalNonClassVariables  = 0;  
  m_iExternNonClassVariables = 0; 
  m_iTotalNonClassFunctions  = 0;  
  m_iLocalNonClassFunctions  = 0;  
  m_iExternNonClassFunctions = 0; 

  m_smvNonClassVariables = NULL;
  m_smvNonClassFunctions = NULL;
  m_smcClasses = NULL;          

  m_bCreateKeywords   = false;
  m_bCreateSplitfiles = false;
  m_bUseStyleSheet    = false;

  m_bDocumentPublic    = true;
  m_bDocumentProtected = true;
  m_bDocumentPrivate   = true;

  m_bDocumentExternal = true;
  m_bDocumentInternal = true;

  m_astrHIncludes.RemoveAll();
  m_astrCPPIncludes.RemoveAll();

}

SModul::~SModul()
{ m_strHTMLTitle.Empty();
  m_strHREFModul.Empty();
  m_strHREFGlobalVariables.Empty();
  m_strHREFGlobalFunctions.Empty();
  m_strDescription.Empty();
  m_strSplitfileModulName.Empty();
  m_strSplitfileNameGlobalVariables.Empty();
  m_strSplitfileNameGlobalFunctions.Empty();
  m_strSplitfileTitleModul.Empty();
  m_strSplitfileTitleGlobalVariables.Empty();
  m_strSplitfileTitleGlobalFunctions.Empty();

  m_iClasses = 0;                 
  m_iNonClassVariables = 0;       
  m_iNonClassFunctions = 0;       
  m_iTotalNonClassVariables  = 0;  
  m_iLocalNonClassVariables  = 0;  
  m_iExternNonClassVariables = 0; 
  m_iTotalNonClassFunctions  = 0;  
  m_iLocalNonClassFunctions  = 0;  
  m_iExternNonClassFunctions = 0; 
  
  delete [] m_smvNonClassVariables;
  delete [] m_smvNonClassFunctions;
  delete [] m_smcClasses;
  m_smvNonClassVariables = NULL;
  m_smvNonClassFunctions = NULL;
  m_smcClasses = NULL;          

  m_bCreateKeywords   = false;
  m_bCreateSplitfiles = false;
  m_bUseStyleSheet    = false;

  m_bDocumentPublic    = true;
  m_bDocumentProtected = true;
  m_bDocumentPrivate   = true;

  m_bDocumentExternal = true;
  m_bDocumentInternal = true;

  m_astrHIncludes.RemoveAll();
  m_astrCPPIncludes.RemoveAll();

}

void SModul::Empty(void)
{ m_strHTMLTitle = _T("");
  m_strHREFModul           = _T("");
  m_strHREFGlobalVariables = _T("");
  m_strHREFGlobalFunctions = _T("");
  m_strDescription         = _T("");
  m_strSplitfileModulName  = _T("");
  m_strSplitfileNameGlobalVariables = _T("");
  m_strSplitfileNameGlobalFunctions = _T("");
  m_strSplitfileTitleModul           = _T("");
  m_strSplitfileTitleGlobalVariables = _T("");
  m_strSplitfileTitleGlobalFunctions = _T("");

  m_iClasses = 0;                 
  m_iNonClassVariables = 0;       
  m_iNonClassFunctions = 0;       
  m_iTotalNonClassVariables  = 0;  
  m_iLocalNonClassVariables  = 0;  
  m_iExternNonClassVariables = 0; 
  m_iTotalNonClassFunctions  = 0;  
  m_iLocalNonClassFunctions  = 0;  
  m_iExternNonClassFunctions = 0; 

  delete [] m_smvNonClassVariables;
  delete [] m_smvNonClassFunctions;
  delete [] m_smcClasses;
  m_smvNonClassVariables = NULL;
  m_smvNonClassFunctions = NULL;
  m_smcClasses = NULL;          

  m_bCreateKeywords   = false;
  m_bCreateSplitfiles = false;
  m_bUseStyleSheet    = false;

  m_bDocumentPublic    = true;
  m_bDocumentProtected = true;
  m_bDocumentPrivate   = true;

  m_bDocumentExternal = true;
  m_bDocumentInternal = true;

  m_astrHIncludes.RemoveAll();
  m_astrCPPIncludes.RemoveAll();

}

void SModul::CountGlobals(CStringArray& astrText)
{ // clean up old stuff
  m_iNonClassVariables       = 0;
  m_iNonClassFunctions       = 0;
  m_iTotalNonClassVariables  = 0;
  m_iLocalNonClassVariables  = 0;
  m_iExternNonClassVariables = 0;
  m_iTotalNonClassFunctions  = 0;
  m_iLocalNonClassFunctions  = 0;
  m_iExternNonClassFunctions = 0;

  delete [] m_smvNonClassVariables;
  delete [] m_smvNonClassFunctions;
  m_smvNonClassVariables = NULL;
  m_smvNonClassFunctions = NULL;
  
  bool bInClass = false;
  int iCurlies = 0;
  int i = 0;
  int iStart = 0;
  int iEnde  = astrText.GetSize();
  if( 0 >= iEnde ) return;

  for( i = iStart; i < iEnde; i++ )
     { // Look if this line is the beginning of a class definition
	   if( 0 == astrText[i].Find(_T("class "))) 
         { if( i < (iEnde - 1) )
             { if( -1 != astrText[i+1].Find(TCHAR('{')) )
                 { bInClass = true;
				   continue;
                 }// if( -1 != astrText[i].Find(TCHAR('{')) )
             }// if( i < (iEnde - 1) )
         }// if( -1 != astrText[i].Find(_T("class ")))
       if( 0 == astrText[i].Find(_T("struct ")))
         { if( i < (iEnde - 1) )
             { if( -1 != astrText[i+1].Find(TCHAR('{')) )
                 { bInClass = true;
				   continue;
                 }// if( -1 != astrText[i].Find(TCHAR('{')) )
             }// if( i < (iEnde - 1) )
         }// if( -1 != astrText[i].Find(_T("struct ")))

       // Here is the reason why the curly brackets need there own lines(from Beautify)
       if( -1 != astrText[i].Find(_T("{") ) && bInClass )
	     { iCurlies ++;
		 }
       if( iCurlies == 0 && bInClass )
	     { bInClass = false;
		 }
       if( -1 != astrText[i].Find(_T("}")) && bInClass )
	     { iCurlies --;
		 }

       if( !bInClass )
	     { // declarations always end with a semi-colon
		   if( -1 != astrText[i].Find(_T(";")) )
		     { // let's assume only functions have paranthesises
			   if( -1 != astrText[i].Find(_T(")")) )
			     { m_iNonClassFunctions++;
				 }
               else
			     { m_iNonClassVariables++;
				 }
			 }
		 }//if( !bInClass )
     }// for( i = iStart; i < iEnde; i++ )
  if( 0 < m_iNonClassVariables )
    { m_smvNonClassVariables = new SModulVariable[m_iNonClassVariables];
	}
  if( NULL == m_smvNonClassVariables )
    { m_iNonClassVariables = 0;
  	}
  if( 0 < m_iNonClassFunctions )
    { m_smvNonClassFunctions = new SModulVariable[m_iNonClassFunctions];
	}
  if( NULL == m_smvNonClassFunctions )
    { m_iNonClassFunctions = 0;
	}
  for( i = 0; i< m_iNonClassVariables; i++ )
     { m_smvNonClassVariables[i].Empty();
	 }
  for( i = 0; i< m_iNonClassFunctions; i++ )
     { m_smvNonClassFunctions[i].Empty();
	 }
  m_iTotalNonClassVariables = m_iNonClassVariables;
  m_iTotalNonClassFunctions = m_iNonClassFunctions;

}

void SModul::CountClasses(CStringArray& astrText)
{ // Clean up old stuff
  m_iClasses = 0;
  delete [] m_smcClasses;
  m_smcClasses = NULL;

  int i = 0;
  int iStart = 0;
  int iEnde  = astrText.GetSize();
  if( 0 >= iEnde ) return;

  for( i = iStart; i < iEnde; i++ )
     { if( 0 == astrText[i].Find(_T("class ")) || 0 == astrText[i].Find(_T("struct ")) )
         { if( i < (iEnde - 1) )
             { if( -1 != astrText[i+1].Find(TCHAR('{')) )
                 { m_iClasses++;
                 }// if( -1 != astrText[i].Find(TCHAR('{')) )
             }// if( i < (iEnde - 1) )
         }// if( 0 == astrText[i].Find(_T("class ")) || 0 == astrText[i].Find(_T("struct ")) )
     }// for( i = iStart; i < iEnde; i++ )
/*
  for( i = iStart; i < iEnde; i++ )
     { if( 0 == astrText[i].Find(_T("struct ")))
         { if( i < (iEnde - 1) )
             { if( -1 != astrText[i+1].Find(TCHAR('{')) )
                 { m_iClasses++;
                 }// if( -1 != astrText[i].Find(TCHAR('{')) )
             }// if( i < (iEnde - 1) )
         }// if( -1 != astrText[i].Find(_T("struct ")))
     }// for( i = iStart; i < iEnde; i++ )
*/
  if( 0 < m_iClasses )
    { m_smcClasses = new SModulClasses[m_iClasses];
	}
  if( NULL == m_smcClasses )
    { m_iClasses = 0;
	}
  for( i = 0; i< m_iClasses; i++ )
     { m_smcClasses[i].Empty();
	 }
}


void SModul::CountClassMembers(const CString strClassname,  CStringArray& astrText)
{ if( 0 >= m_iClasses ) return;
  // search appropriate class structure
  SModulClasses* psmcClass = NULL;
  int i = 0;
  for( i = 0; i < m_iClasses; i++ )
     { if( strClassname == m_smcClasses[i].m_strName )
	     { psmcClass = &(m_smcClasses[i]);
		   break;
         }
     }
  if( NULL == psmcClass )// There is no class with this name
    { return;
	}
// clean up oldstuff
  psmcClass->m_iVariables = 0;
  delete [] (psmcClass->m_smvVariables);
  psmcClass->m_smvVariables = NULL;
  psmcClass->m_iFunctions = 0;
  delete [] (psmcClass->m_smvFunctions);
  psmcClass->m_smvFunctions = NULL;

  bool bInClass     = false;
  bool bValidName   = false;
  bool bNestedClass = false;
  int iCurlies = 0;
  int iPos      = -1;
  int iStart = 0;
  int iEnde  = astrText.GetSize();
  if( 0 >= iEnde ) return;

  for( i = iStart; i < iEnde; i++ )
     { iPos = astrText[i].Find(strClassname);	   
       if( (-1 != iPos) &&  (i < (iEnde - 1)) )// we found the name, but is it the start of the class deklaration
         { bValidName = true;// check the characters after the class name
           iPos = iPos + strClassname.GetLength();
           if( iPos < astrText[i].GetLength() )
             { bValidName = false;
               TCHAR chr = astrText[i][iPos];
               if( -1 ==  ::strValidCCharacters.Find(chr) )
                 { bValidName = true;
                 }// if( -1 ==  ::strValidCCharacters.Find(chr) )
              }// if( iPos <= astrText[i].GetLength() )
		   iPos = astrText[i].Find(strClassname);
		   if( bValidName )
		     { if( 0 >= iPos )// there must be a space before the name
			     { bValidName = false;
				 }
             }
		   if( bValidName )
		     { TCHAR chr = astrText[i][iPos-1];
			   if( TCHAR(' ') != chr )
			     { bValidName = false;
				 }
			 }
           if( -1 != astrText[i+1].Find(TCHAR('{')) && bValidName )
             { bInClass = true;
               continue;
             }// if( -1 != astrText[i+1].Find(TCHAR('{')) && bValidName )
         }// if( (-1 != iPos) &&  (i < (iEnde - 1)) )

       if( -1 != astrText[i].Find(_T("{") ) && bInClass )
	     { iCurlies ++;
		 }
       if( -1 != astrText[i].Find(_T("}")) && bInClass )
	     { iCurlies --;
		 }
       if( iCurlies == 0 && bInClass )
	     { bInClass = false;
		   break;
		 }
	   if( bInClass )
	     { if( 0 == astrText[i].Find(_T("class ")) || 0 == astrText[i].Find(_T("struct ")) )
		     { if( i < (iEnde - 1) )
                 { if( -1 != astrText[i+1].Find(TCHAR('{')) )
                     { bNestedClass = true;
                     }// if( -1 != astrText[i].Find(TCHAR('{')) )
                 }// if( i < (iEnde - 1) )
			 }// if class nesting?
		 }
       if( bNestedClass )
	     { int j = i+1;
		   int iNestedCurlies = 0;
		   for( j = i+1; j < iEnde ; j++ )
		      { if( astrText[j].Find(TCHAR('{')) )
			      { iNestedCurlies ++;
				  }
				if( astrText[j].Find(TCHAR('}')) )
			      { iNestedCurlies --;
				  }
                if( 0 == iNestedCurlies )
				  { break;
				  }
			  }
           bNestedClass = false;
		   if( j < iEnde )
		     { i = j;
			   continue;
			 }
           else
		     { bInClass = false;
			   break;
			 }
		 }
       if( bInClass )
	     { // declarations always end with a semi-colon
		   if( -1 != astrText[i].Find(_T(";")) )
		     { if( -1 != astrText[i].Find(_T(")")) )
			     { psmcClass->m_iFunctions++;
				 }
               else
			     { psmcClass->m_iVariables++;
				 }
			 }
		 }
     }// for( i = iStart; i < iEnde; i++ )

  if( 0 < psmcClass->m_iVariables )
    { psmcClass->m_smvVariables = new SModulVariable[psmcClass->m_iVariables];
	}
  if( NULL == psmcClass->m_smvVariables )
    { psmcClass->m_smvVariables = 0;
  	}
  if( 0 < psmcClass->m_iFunctions )
    { psmcClass->m_smvFunctions = new SModulVariable[psmcClass->m_iFunctions];
	}
  if( NULL == psmcClass->m_smvFunctions )
    { psmcClass->m_smvFunctions  = 0;
	}
  for( i = 0; i< psmcClass->m_iVariables; i++ )
     { psmcClass->m_smvVariables[i].Empty();
	 }
  for( i = 0; i< psmcClass->m_iFunctions; i++ )
     { psmcClass->m_smvFunctions[i].Empty();
	 }
  psmcClass->m_iTotalVariables = psmcClass->m_iVariables;
  psmcClass->m_iTotalFunctions = psmcClass->m_iFunctions;
}

void SModul::FindGlobalVariables(CStringArray& astrText)
{ if( 0 >= m_iNonClassVariables )
    { return;
	}
  bool bInClass     = false;
  int  iCurlies     = 0;
  int  iRegisterPos = 0;
  int  i = 0;
  int  iStart = 0;
  int  iEnde  = astrText.GetSize();
  if( 0 >= iEnde) return;

// Set the default type
  enum ModulType mtType = mt_local;

  for( i = iStart; i < iEnde; i++ )
     { if( 0 == astrText[i].Find(_T("class ")))
         { if( i < (iEnde - 1) )
             { if( -1 != astrText[i+1].Find(TCHAR('{')) )
                 { bInClass = true;
				   continue;
                 }// if( -1 != astrText[i].Find(TCHAR('{')) )
             }// if( i < (iEnde - 1) )
         }// if( -1 != astrText[i].Find(_T("class ")))
       if( 0 == astrText[i].Find(_T("struct ")))
         { if( i < (iEnde - 1) )
             { if( -1 != astrText[i+1].Find(TCHAR('{')) )
                 { bInClass = true;
				   continue;
                 }// if( -1 != astrText[i].Find(TCHAR('{')) )
             }// if( i < (iEnde - 1) )
         }// if( -1 != astrText[i].Find(_T("struct ")))

       if( -1 != astrText[i].Find(_T("{") ) && bInClass )
	     { iCurlies ++;
		 }
       if( iCurlies == 0 && bInClass )
	     { bInClass = false;
		 }
       if( -1 != astrText[i].Find(_T("}")) && bInClass )
	     { iCurlies --;
		 }

       if( !bInClass )
	     { // declarations always end with a semi-colon
		   if( -1 != astrText[i].Find(_T(";")) )    // Probably a variable
		     { if( -1 == astrText[i].Find(_T(")")) )// it is not a function
			     { // register global variable
				   int jEnd = i;
				   int jBegin = i;

				   mtType = mt_local;
				   if( 0 == astrText[i].Find(_T("extern ")) )   mtType = mt_global;
				   if( -1 != astrText[i].Find(_T(" extern ")) ) mtType = mt_global;
				   // actually enum is a type declaration, but treat it like a variable
				   if( 0 == astrText[i].Find(_T("enum ")) )   mtType = mt_global;
				   if( -1 != astrText[i].Find(_T(" enum ")) ) mtType = mt_global;
				   if( 0 == astrText[i].Find(_T("typedef ")) )   mtType = mt_global;
				   if( -1 != astrText[i].Find(_T(" typedef ")) ) mtType = mt_global;
				   // don't register initializations
				   if( 0 == i )
				     { m_smvNonClassVariables[iRegisterPos].m_strName = astrText[i];
					   m_smvNonClassVariables[iRegisterPos].m_mtType  = mtType;
				       if( mt_local  == mtType ) m_iLocalNonClassVariables++;
				       if( mt_global == mtType ) m_iExternNonClassVariables++;
				       iRegisterPos++;
				       astrText[i].Empty();
					   continue;
					 }// if first line then there is no initialisation here

				   for(int j = jEnd-1; j >= 0 ; j-- )
				      { if( -1 != astrText[j].Find(_T(";")) )
					      { jBegin = j+1;
						    break;
						  }
                        if( astrText[j].IsEmpty() )
					      { jBegin = j+1;
						    break;
						  }
					  }
                   if( j < 0 ) jBegin = 0;
                   // variable with initialization 
                   m_smvNonClassVariables[iRegisterPos].m_strName = astrText[jBegin];
				   mtType = mt_local;
				   if( 0 == astrText[jBegin].Find(_T("extern ")) )   mtType = mt_global;
				   if( -1 != astrText[jBegin].Find(_T(" extern ")) ) mtType = mt_global;
				   // actually enum is a type declaration, but treat it like an external variable
				   if( 0 == astrText[jBegin].Find(_T("enum ")) )   mtType = mt_global;
				   if( -1 != astrText[jBegin].Find(_T(" enum ")) ) mtType = mt_global;
				   if( 0 == astrText[i].Find(_T("typedef ")) )   mtType = mt_global;
				   if( -1 != astrText[i].Find(_T(" typedef ")) ) mtType = mt_global;
				   m_smvNonClassVariables[iRegisterPos].m_mtType  = mtType;
				   if( mt_local  == mtType ) m_iLocalNonClassVariables++;
				   if( mt_global == mtType ) m_iExternNonClassVariables++;

				   astrText[jBegin].Empty();
				   // now rescue initialization
				   if( jBegin != jEnd )
				     { for( j= jBegin+1; j <= jEnd; j++ ) 
					      { m_smvNonClassVariables[iRegisterPos].m_astrParameter.Add(astrText[j]);
						    m_smvNonClassVariables[iRegisterPos].m_astrDescriptionParameter.Add(_T(""));
						    astrText[j].Empty();
						  }
					 }
				   iRegisterPos++;
				 }// register variable
			 }// end of deklaration
		 }// if( !bInClass )

     }// for( i = iStart; i < iEnde; i++ )
// now remove empty lines
  m_iNonClassVariables = iRegisterPos;
  ::RemoveEmptyLines(astrText);
}

void SModul::FindGlobalFunctions(CStringArray& astrText, const CStringArray& astrNotReturns)
{ if( 0 >= m_iNonClassFunctions )
    {return;
	}
  
  bool bInClass = false;
  int iCurlies = 0;
  int iRegisterPos = 0;
  int i = 0;
  int iStart = 0;
  int iEnde  = astrText.GetSize();
  if( 0 >= iEnde) return;
// Set the default type
  enum ModulType mtType = mt_global;

  for( i = iStart; i < iEnde; i++ )
     { if( 0 == astrText[i].Find(_T("class ")))
         { if( i < (iEnde - 1) )
             { if( -1 != astrText[i+1].Find(TCHAR('{')) )
                 { bInClass = true;
				   continue;
                 }// if( -1 != astrText[i].Find(TCHAR('{')) )
             }// if( i < (iEnde - 1) )
         }// if( -1 != astrText[i].Find(_T("class ")))
       if( 0 == astrText[i].Find(_T("struct ")))
         { if( i < (iEnde - 1) )
             { if( -1 != astrText[i+1].Find(TCHAR('{')) )
                 { bInClass = true;
				   continue;
                 }// if( -1 != astrText[i].Find(TCHAR('{')) )
             }// if( i < (iEnde - 1) )
         }// if( -1 != astrText[i].Find(_T("struct ")))

       if( -1 != astrText[i].Find(_T("{") ) && bInClass )
	     { iCurlies ++;
		 }
       if( iCurlies == 0 && bInClass )
	     { bInClass = false;
		 }
       if( -1 != astrText[i].Find(_T("}")) && bInClass )
	     { iCurlies --;
		 }

       if( !bInClass )
	     {  // declarations always end with a semi-colon
		   if( -1 != astrText[i].Find(_T(";")) )     // Probably a function
		     { if( -1 != astrText[i].Find(_T(")")) ) // it is afunction
			     { CString strTest         = astrText[i];
				   CString strParameter    = _T("");
				   CString strFunctionName = _T("");
				   CString strReturnValue  = _T("");
				   // isolate parameters
				   int z = strTest.ReverseFind(TCHAR(')'));
				   int y = 0;
				   int iParanthesis = 0;
				   int k1 = -1;
				   for( y = z; y > 0; y--)
				      { if( strTest[y] == TCHAR(')') ) iParanthesis ++;
					    if( strTest[y] == TCHAR('(') ) iParanthesis --;
						if( 0 == iParanthesis ) break;
					  }
				   strParameter = strTest.Mid(y+1,z-y-1);// parameter list isolated
				   if( strParameter.IsEmpty() ) strParameter = _T("void");

				   strTest = strTest.Left(y); // Remove paramter list from text
				   strTest.TrimLeft();
				   strTest.TrimRight();

                   // isolate function name
				   z = strTest.ReverseFind(TCHAR(')'));
				   y = z;

				   if( -1 == z ) // if there is no paranthesis it is simple
				     {// functionname starts after the last space
					   z = strTest.ReverseFind(TCHAR(' '));
					   if( -1 == z )
					     { strFunctionName = strTest;
						   strReturnValue = _T("int (DEFAULT)");
                         }
                       else
					     { strFunctionName = strTest.Mid(z);
						   strReturnValue = strTest.Left(z);
						 }
                      }// Wenn keine Klammern
                   else
				     {// we have casting and grouping
					   for( y = z; y > 0; y--)
				          { if( strTest[y] == TCHAR(')') ) iParanthesis ++;
					        if( strTest[y] == TCHAR('(') ) iParanthesis --;
						    if( 0 == iParanthesis ) break;
					      }
				       strFunctionName = strTest.Mid(y+1,z-y-1);
				       strReturnValue = strTest.Left(y); 
					   if( strReturnValue.IsEmpty() ) strReturnValue = _T("int (DEFAULT)");
				   }// if function name in paranthesis

				   // now register functionname
                   strFunctionName.TrimLeft();
                   strFunctionName.TrimRight();
			       strReturnValue.TrimLeft();
			       strReturnValue.TrimRight();
                   bool bFound = false;
				   mtType = mt_global;
				   if( 0 == strReturnValue.Find(_T("static ")) )   mtType = mt_local;
				   if( -1 != strReturnValue.Find(_T(" static ")) ) mtType = mt_local;
				   // remember function names can be overwritten
				   if( 0 == iRegisterPos )
				     { // if it is the first function to register, than register it immediatly
					   m_smvNonClassFunctions[iRegisterPos].m_strName = strFunctionName;
					   m_smvNonClassFunctions[iRegisterPos].m_astrReturn.Add(strReturnValue);
					   m_smvNonClassFunctions[iRegisterPos].m_astrDescriptionReturn.Add(_T(""));
					   m_smvNonClassFunctions[iRegisterPos].m_astrFullName.Add(astrText[i]);
					   m_smvNonClassFunctions[iRegisterPos].m_mtType = mtType;
				       if( mt_local  == mtType ) m_iLocalNonClassFunctions++;
				       if( mt_global == mtType ) m_iExternNonClassFunctions++;
					   // analyse parameter list
					   ::RemoveSpaces(strParameter);
					   strTest = FindFirstParameter(strParameter);
					   ::RemoveSpaces(strTest);
					   while( !strTest.IsEmpty() )
					        { // if there is a parameter, iterate through the parameter list
							  m_smvNonClassFunctions[iRegisterPos].m_astrParameter.Add(strTest);
                              m_smvNonClassFunctions[iRegisterPos].m_astrDescriptionParameter.Add(_T(""));
						      strParameter = strParameter.Right(strParameter.GetLength() - strTest.GetLength() -1);
							  ::RemoveSpaces(strParameter);
							  strTest = FindFirstParameter(strParameter);
							  ::RemoveSpaces(strTest);
                            }  
 			           iRegisterPos++;
				       astrText[i].Empty();
					   continue;
					 }
                   bFound = false;
                   for( z = 0; z < iRegisterPos; z++ )
				      { // do we have a function with the same name already
					    if( m_smvNonClassFunctions[z].m_strName == strFunctionName )
					      { bFound = true;
						    break;
						  }
                      }
                   if( !bFound )
				     { z = iRegisterPos;
					   iRegisterPos++;
					 }                   
				   m_smvNonClassFunctions[z].m_strName = strFunctionName;

				   bFound = false;
				   for( k1 = 0; k1 < m_smvNonClassFunctions[z].m_astrReturn.GetSize(); k1++ )
				      { // do we have that return value for this function already
					    if( strReturnValue == m_smvNonClassFunctions[z].m_astrReturn[k1] )
					      { bFound = true;
						    break;
                          }
					  }
                   if( !bFound )
				     { m_smvNonClassFunctions[z].m_astrReturn.Add(strReturnValue);
					   m_smvNonClassFunctions[z].m_astrDescriptionReturn.Add(_T(""));
					 }

				   // analyse parameter list
				   ::RemoveSpaces(strParameter);
				   strTest = FindFirstParameter(strParameter);
				   ::RemoveSpaces(strTest);
				   while( !strTest.IsEmpty() )
				        { // if there is a parameter, iterate through the parameter list
						  bFound = false;
						  // do we have that parameter name already
                          for( k1 = 0; k1 < m_smvNonClassFunctions[z].m_astrParameter.GetSize(); k1++ )
				             { if( strTest == m_smvNonClassFunctions[z].m_astrParameter[k1] )
					             { bFound = true;
						           break;
                                 }
					         }
                          if( !bFound )
				             { m_smvNonClassFunctions[z].m_astrParameter.Add(strTest);
							   m_smvNonClassFunctions[z].m_astrDescriptionParameter.Add(_T(""));
					         }
					      strParameter = strParameter.Right(strParameter.GetLength() - strTest.GetLength() -1);
						  ::RemoveSpaces(strParameter);
						  strTest = FindFirstParameter(strParameter);
						  ::RemoveSpaces(strTest);
                        }  
				   if( mt_unknown == m_smvNonClassFunctions[z].m_mtType ) 
				       m_smvNonClassFunctions[z].m_mtType = mtType;
				   if( mtType > m_smvNonClassFunctions[z].m_mtType ) 
                       m_smvNonClassFunctions[z].m_mtType = mtType;
				   if( mt_local  == mtType ) m_iLocalNonClassFunctions++;
				   if( mt_global == mtType ) m_iExternNonClassFunctions++;
				   m_smvNonClassFunctions[z].m_astrFullName.Add(astrText[i]);
				   astrText[i].Empty();			   
				 }// register function
			 }
		 }// if( !bInClass )
     }// for( i = iStart; i < iEnde; i++ )
// now remove empty lines
  m_iNonClassFunctions = iRegisterPos;
  ::RemoveEmptyLines(astrText);
// now remove anwanted return words
  iStart = 0;
  iEnde  = m_iNonClassFunctions;
  for( i = iStart; i < iEnde; i++ )
     { ::RemoveNotReturns(m_smvNonClassFunctions[i].m_astrReturn, astrNotReturns );
	 }
}

void SModul::FindClasses(CStringArray& astrText)
{ if( 0 == m_iClasses ) return;
  int i = 0;
  int iStart = 0;
  int iEnde  = astrText.GetSize();
  if( 0 >= iEnde) return;

  int iRegisterPos = 0;
// first look for class definitions
  for( i = iStart; i < iEnde; i++ )
     { if( 0 == astrText[i].Find(_T("class ")) )
         { if( i < (iEnde - 1) )
             { if( -1 != astrText[i+1].Find(TCHAR('{')) )
                 { m_smcClasses[iRegisterPos].m_strName = astrText[i];
				   m_smcClasses[iRegisterPos].m_mtType = mt_Class;
				   iRegisterPos++;
                 }// if( -1 != astrText[i].Find(TCHAR('{')) )
             }// if( i < (iEnde - 1) )
         }// if( -1 != astrText[i].Find(_T("class ")))
     }// for( i = iStart; i < iEnde; i++ )
// structures are also classes
  for( i = iStart; i < iEnde; i++ )
     { if( 0 == astrText[i].Find(_T("struct ")) )
         { if( i < (iEnde - 1) )
             { if( -1 != astrText[i+1].Find(TCHAR('{')) )
                 { m_smcClasses[iRegisterPos].m_strName = astrText[i];
				   m_smcClasses[iRegisterPos].m_mtType = mt_Structure;
				   iRegisterPos++;
                 }// if( -1 != astrText[i].Find(TCHAR('{')) )
             }// if( i < (iEnde - 1) )
         }// if( -1 != astrText[i].Find(_T("struct ")))
     }// for( i = iStart; i < iEnde; i++ )

 for( i = 0; i < m_iClasses; i++  )
    { iStart = m_smcClasses[i].m_strName.Find(_T(":"));
	  if( -1 != iStart )
	    { CString strTest = m_smcClasses[i].m_strName;
		  m_smcClasses[i].m_strName = strTest.Left(iStart);
		  iEnde = strTest.GetLength();
		  m_smcClasses[i].m_strBaseclass = strTest.Right(iEnde - iStart - 1);
		  ::RemoveSpaces(m_smcClasses[i].m_strBaseclass);
		}
	  m_smcClasses[i].m_strName.Replace(_T("class"),_T(" "));
	  m_smcClasses[i].m_strName.Replace(_T("struct"),_T(" "));
	  ::RemoveSpaces(m_smcClasses[i].m_strName);
	}
}

void SModul::FindClassVariables(const CString strClassname, CStringArray& astrText)
{ if( 0 >= m_iClasses ) return;
  // search appropriate class structure
  SModulClasses* psmcClass = NULL;
  int i = 0;
  for( i = 0; i < m_iClasses; i++ )
     { if( strClassname == m_smcClasses[i].m_strName )
	     { psmcClass = &(m_smcClasses[i]);
		   break;
         }
     }
  if( NULL == psmcClass )// There is no class with this name
    { return;
	}
  if( 0 >= psmcClass->m_iVariables )// There are no variables
    { return;
	}
  
  bool bInClass     = false;
  bool bValidName   = false;
  bool bNestedClass = false;
  int iCurlies     = 0;
  int iPos         = -1;
  int iRegisterPos = 0;
  int iStart       = 0;
  int iFirstClassLine = iStart;
  int iEnde  = astrText.GetSize();
  if( 0 >= iEnde ) return;

// set the default types
  enum ModulType mtType = mt_unknown;
  if( mt_Class == psmcClass->m_mtType ) mtType = mt_private;
  if( mt_Structure == psmcClass->m_mtType ) mtType = mt_public;
  CString strTest;

  for( i = iStart; i < iEnde; i++ )
     { iPos = astrText[i].Find(strClassname);	   
       if( (-1 != iPos) &&  (i < (iEnde - 1)) )// we found the name, but is it the start of the class deklaration
         { bValidName = true;// check the characters after the class name
           iPos = iPos + strClassname.GetLength();
           if( iPos < astrText[i].GetLength() )
             { bValidName = false;
               TCHAR chr = astrText[i][iPos];
               if( -1 ==  ::strValidCCharacters.Find(chr) )
                 { bValidName = true;
                 }// if( -1 ==  ::strValidCCharacters.Find(chr) )
              }// if( iPos <= astrText[i].GetLength() )
		   iPos = astrText[i].Find(strClassname);
		   if( bValidName )
		     { if( 0 >= iPos )// there must be a space before the name
			     { bValidName = false;
				 }
             }
		   if( bValidName )
		     { TCHAR chr = astrText[i][iPos-1];
			   if( TCHAR(' ') != chr )
			     { bValidName = false;
				 }
			 }
           if( -1 != astrText[i+1].Find(TCHAR('{')) && bValidName )
             { bInClass = true;
			   iFirstClassLine = i+1;
               continue;
             }// if( -1 != astrText[i+1].Find(TCHAR('{')) && bValidName )
         }// if( (-1 != iPos) &&  (i < (iEnde - 1)) )

       if( -1 != astrText[i].Find(_T("{") ) && bInClass )
	     { iCurlies ++;
		 }
       if( -1 != astrText[i].Find(_T("}")) && bInClass )
	     { iCurlies --;
		 }
       if( iCurlies == 0 && bInClass )
	     { bInClass = false;
		   break;
		 }

	   if( bInClass )
	     { if( 0 == astrText[i].Find(_T("class ")) || 0 == astrText[i].Find(_T("struct ")) )
		     { if( i < (iEnde - 1) )
                 { if( -1 != astrText[i+1].Find(TCHAR('{')) )
                     { bNestedClass = true;
                     }// if( -1 != astrText[i].Find(TCHAR('{')) )
                 }// if( i < (iEnde - 1) )
			 }// if class nesting?
		 }
       if( bNestedClass )
	     { int j = i+1;
		   int iNestedCurlies = 0;
		   for( j = i+1; j < iEnde ; j++ )
		      { if( astrText[j].Find(TCHAR('{')) )
			      { iNestedCurlies ++;
				  }
				if( astrText[j].Find(TCHAR('}')) )
			      { iNestedCurlies --;
				  }
                if( 0 == iNestedCurlies )
				  { break;
				  }
			  }
           bNestedClass = false;
		   if( j < iEnde )
		     { i = j;
			   continue;
			 }
           else
		     { bInClass = false;
			   break;
			 }
		 }
       if( bInClass )
	     { if( 0 == astrText[i].Compare(_T("public:")) ) mtType = mt_public;
           if( 0 == astrText[i].Compare(_T("protected:")) ) mtType = mt_protected;
		   if( 0 == astrText[i].Compare(_T("private:")) ) mtType = mt_private;
		   // declarations always end with a semi-colon
		   if( -1 != astrText[i].Find(_T(";")) )     // Probably a variable
		     { if( -1 == astrText[i].Find(_T(")")) ) // it is not a function
			     { // register class variable
				   int jEnd = i;
				   int jBegin = i;
				   // don't register initializations
				   if( 0 == i )
				     { psmcClass->m_smvVariables[iRegisterPos].m_strName = astrText[i];
				       psmcClass->m_smvVariables[iRegisterPos].m_strClass = strClassname;
					   psmcClass->m_smvVariables[iRegisterPos].m_mtType  = mtType;
					   iRegisterPos++;
				       astrText[i].Empty();
					   continue;
					 }// if first line then there is no initialisation here

				   for(int j = jEnd-1; j >= iFirstClassLine ; j-- )
				      { if( -1 != astrText[j].Find(_T(";")) )
					      { jBegin = j+1;
						    break;
						  }
                        if( -1 != astrText[j].Find(_T("private:")) )
					      { jBegin = j+1;
						    break;
						  }
                        if( -1 != astrText[j].Find(_T("protected:")) )
					      { jBegin = j+1;
						    break;
						  }
                        if( -1 != astrText[j].Find(_T("public:")) )
					      { jBegin = j+1;
						    break;
						  }
                        if( astrText[j].IsEmpty() )
					      { jBegin = j+1;
						    break;
						  }
					  }
                   if( j < 0 ) jBegin = 0;

				   if( mt_private   == mtType ) psmcClass->m_iprivateVariables++;
				   if( mt_protected == mtType ) psmcClass->m_iprotectedVariables++;
				   if( mt_public    == mtType ) psmcClass->m_ipublicVariables++;
                   psmcClass->m_smvVariables[iRegisterPos].m_strName  = astrText[jBegin];
				   psmcClass->m_smvVariables[iRegisterPos].m_strClass = strClassname;
				   psmcClass->m_smvVariables[iRegisterPos].m_mtType   = mtType;
				   astrText[jBegin].Empty();
				   // now rescue initialization
				   if( jBegin != jEnd )
				     { for( j= jBegin+1; j <= jEnd; j++ ) 
					      { psmcClass->m_smvVariables[iRegisterPos].m_astrParameter.Add(astrText[j]);
						    psmcClass->m_smvVariables[iRegisterPos].m_astrDescriptionParameter.Add(_T(""));
						    astrText[j].Empty();
						  }
					 }
				   iRegisterPos++;
				 }// register variable
			 }// end of deklaration
		 }// if( bInClass )
     }// for( i = iStart; i < iEnde; i++ )
// now remove empty lines
  psmcClass->m_iVariables = iRegisterPos;
  ::RemoveEmptyLines(astrText);
}

void SModul::FindClassFunctions(const CString strClassname, CStringArray& astrText, const CStringArray& astrNotReturns)
{ if( 0 >= m_iClasses ) return;
  // search appropriate class structure
  SModulClasses* psmcClass = NULL;
  int i = 0;
  for( i = 0; i < m_iClasses; i++ )
     { if( strClassname == m_smcClasses[i].m_strName )
	     { psmcClass = &(m_smcClasses[i]);
		   break;
         }
     }
  if( NULL == psmcClass )// There is no class with this name
    { return;
	}
  if( 0 >= psmcClass->m_iFunctions )// There are no functions
    { return;
	}

  bool bInClass     = false;
  bool bValidName   = false;
  bool bNestedClass = false;
  int iCurlies = 0;
  int iPos      = -1;
  int iRegisterPos = 0;
  int iStart = 0;
  int iEnde  = astrText.GetSize();
  if( 0 >= iEnde ) return;

// set the default types
  enum ModulType mtType = mt_unknown;
  if( mt_Class == psmcClass->m_mtType ) mtType = mt_private;
  if( mt_Structure == psmcClass->m_mtType ) mtType = mt_public;

  for( i = iStart; i < iEnde; i++ )
     { iPos = astrText[i].Find(strClassname);	   
       if( (-1 != iPos) &&  (i < (iEnde - 1)) )// we found the name, but is it the start of the class deklaration
         { bValidName = true;// check the characters after the class name
           iPos = iPos + strClassname.GetLength();
           if( iPos < astrText[i].GetLength() )
             { bValidName = false;
               TCHAR chr = astrText[i][iPos];
               if( -1 ==  ::strValidCCharacters.Find(chr) )
                 { bValidName = true;
                 }// if( -1 ==  ::strValidCCharacters.Find(chr) )
              }// if( iPos <= astrText[i].GetLength() )
		   iPos = astrText[i].Find(strClassname);
		   if( bValidName )
		     { if( 0 >= iPos )// there must be a space before the name
			     { bValidName = false;
				 }
             }
		   if( bValidName )
		     { TCHAR chr = astrText[i][iPos-1];
			   if( TCHAR(' ') != chr )
			     { bValidName = false;
				 }
			 }
           if( -1 != astrText[i+1].Find(TCHAR('{')) && bValidName )
             { bInClass = true;
               continue;
             }// if( -1 != astrText[i+1].Find(TCHAR('{')) && bValidName )
         }// if( (-1 != iPos) &&  (i < (iEnde - 1)) )

       if( -1 != astrText[i].Find(_T("{") ) && bInClass )
	     { iCurlies ++;
		 }
       if( -1 != astrText[i].Find(_T("}")) && bInClass )
	     { iCurlies --;
		 }
       if( iCurlies == 0 && bInClass )
	     { bInClass = false;
		   break;
		 }

	   if( bInClass )
	     { if( 0 == astrText[i].Find(_T("class ")) || 0 == astrText[i].Find(_T("struct ")) )
		     { if( i < (iEnde - 1) )
                 { if( -1 != astrText[i+1].Find(TCHAR('{')) )
                     { bNestedClass = true;
                     }// if( -1 != astrText[i].Find(TCHAR('{')) )
                 }// if( i < (iEnde - 1) )
			 }// if class nesting?
		 }
       if( bNestedClass )
	     { int j = i+1;
		   int iNestedCurlies = 0;
		   for( j = i+1; j < iEnde ; j++ )
		      { if( astrText[j].Find(TCHAR('{')) )
			      { iNestedCurlies ++;
				  }
				if( astrText[j].Find(TCHAR('}')) )
			      { iNestedCurlies --;
				  }
                if( 0 == iNestedCurlies )
				  { break;
				  }
			  }
           bNestedClass = false;
		   if( j < iEnde )
		     { i = j;
			   continue;
			 }
           else
		     { bInClass = false;
			   break;
			 }
		 }
       if( bInClass )
	     { if( 0 == astrText[i].Compare(_T("public:")) ) mtType = mt_public;
           if( 0 == astrText[i].Compare(_T("protected:")) ) mtType = mt_protected;
		   if( 0 == astrText[i].Compare(_T("private:")) ) mtType = mt_private;		   
		   if( -1 != astrText[i].Find(_T(";")) )
		     { if( -1 != astrText[i].Find(_T(")")) )
			     { CString strTest         = astrText[i];
				   CString strParameter    = _T("");
				   CString strFunctionName = _T("");
				   CString strReturnValue  = _T("");
				   // isolate parameters
				   int z = strTest.ReverseFind(TCHAR(')'));
				   int y = z;
				   int iParanthesis = 0;
				   int k1 = -1;
				   for( ; y > 0; y--)
				      { if( strTest[y] == TCHAR(')') ) iParanthesis ++;
					    if( strTest[y] == TCHAR('(') ) iParanthesis --;
						if( 0 == iParanthesis ) break;
					  }
				   strParameter = strTest.Mid(y+1,z-y-1);// parameter list isolated
				   if( strParameter.IsEmpty() ) strParameter = _T("void");

				   strTest = strTest.Left(y); // Remove paramter list from text
				   strTest.TrimLeft();
				   strTest.TrimRight();

                   // isolate function name
				   z = strTest.ReverseFind(TCHAR(')'));
				   y = z;

				   if( -1 == z ) // if there is no paranthesis it is simple
				     { z = strTest.ReverseFind(TCHAR(' '));
					   if( -1 == z )
					     { strFunctionName = strTest;
						   strReturnValue = _T("int (DEFAULT)");
                         }
                       else
					     { strFunctionName = strTest.Mid(z);
						   strReturnValue = strTest.Left(z);
						 }
                      }//simple function name
                   else
				     { // we have casting and grouping
					   iParanthesis = 0;
					   for( ; y > 0; y--)
				          { if( strTest[y] == TCHAR(')') ) iParanthesis ++;
					        if( strTest[y] == TCHAR('(') ) iParanthesis --;
						    if( 0 == iParanthesis ) break;
					      }
				       strFunctionName = strTest.Mid(y+1,z-y-1);
				       strReturnValue = strTest.Left(y); 
					   if( strReturnValue.IsEmpty() ) strReturnValue = _T("int (DEFAULT)");
				   }// if function name in paranthesis
				   // count function
				   if( mt_private   == mtType ) psmcClass->m_iprivateFunctions++;
				   if( mt_protected == mtType ) psmcClass->m_iprotectedFunctions++;
				   if( mt_public    == mtType ) psmcClass->m_ipublicFunctions++;
				 // now register functionname
                   strFunctionName.TrimLeft();
                   strFunctionName.TrimRight();
			       strReturnValue.TrimLeft();
			       strReturnValue.TrimRight();
                   bool bFound = false;
				   // remember function names can be overwritten
				   if( 0 == iRegisterPos )
				     { // if it is the first function to register, than register it immediatly
					   psmcClass->m_smvFunctions[iRegisterPos].m_strName = strFunctionName;
					   psmcClass->m_smvFunctions[iRegisterPos].m_astrFullName.Add(astrText[i]);
					   psmcClass->m_smvFunctions[iRegisterPos].m_astrReturn.Add(strReturnValue);
					   psmcClass->m_smvFunctions[iRegisterPos].m_astrDescriptionReturn.Add(_T(""));
					   psmcClass->m_smvFunctions[iRegisterPos].m_strClass = strClassname;
					   psmcClass->m_smvFunctions[iRegisterPos].m_mtType   = mtType;
					   // analyse parameter list
					   RemoveSpaces(strParameter);
					   strTest = FindFirstParameter(strParameter);
					   RemoveSpaces(strTest);
					   while( !strTest.IsEmpty() )
					        { // if there is a parameter, iterate through the parameter list
							  psmcClass->m_smvFunctions[iRegisterPos].m_astrParameter.Add(strTest);
							  psmcClass->m_smvFunctions[iRegisterPos].m_astrDescriptionParameter.Add(_T(""));
						      strParameter = strParameter.Right(strParameter.GetLength() - strTest.GetLength() -1);
							  RemoveSpaces(strParameter);
							  strTest = FindFirstParameter(strParameter);
							  RemoveSpaces(strTest);
                            }  
 			           iRegisterPos++;
				       astrText[i].Empty();
					   continue;
					 }
                   bFound = false;
                   for( z = 0; z < iRegisterPos; z++ )
				      { // do we have a function with the same name already
					    if( psmcClass->m_smvFunctions[z].m_strName == strFunctionName )
					      { bFound = true;
						    break;
						  }
                      }
                   if( !bFound )
				     { z = iRegisterPos;
					   iRegisterPos++;
					 }
				   psmcClass->m_smvFunctions[z].m_strName = strFunctionName;

				   bFound = false;
				   for( k1 = 0; k1 < psmcClass->m_smvFunctions[z].m_astrReturn.GetSize(); k1++ )
				      {  // do we have that return value for this function already
					    if( strReturnValue == psmcClass->m_smvFunctions[z].m_astrReturn[k1] )
					      { bFound = true;
						    break;
                          }
					  }
                   if( !bFound )
				     { psmcClass->m_smvFunctions[z].m_astrReturn.Add(strReturnValue);
					   psmcClass->m_smvFunctions[z].m_astrDescriptionReturn.Add(_T(""));
					 }

				   // analyse parameter list
				   RemoveSpaces(strParameter);
				   strTest = FindFirstParameter(strParameter);
				   RemoveSpaces(strTest);
				   while( !strTest.IsEmpty() )
				        { // if there is a parameter, iterate through the parameter list
						  bFound = false;
						  // do we have that parameter name already
                          for( k1 = 0; k1 < psmcClass->m_smvFunctions[z].m_astrParameter.GetSize(); k1++ )
				             { if( strTest == psmcClass->m_smvFunctions[z].m_astrParameter[k1] )
					             { bFound = true;
						           break;
                                 }
					         }
                          if( !bFound )
				             { psmcClass->m_smvFunctions[z].m_astrParameter.Add(strTest);
							   psmcClass->m_smvFunctions[z].m_astrDescriptionParameter.Add(_T(""));
					         }
					      strParameter = strParameter.Right(strParameter.GetLength() - strTest.GetLength() -1);
						  RemoveSpaces(strParameter);
						  strTest = FindFirstParameter(strParameter);
						  RemoveSpaces(strTest);
                        }  
				   psmcClass->m_smvFunctions[z].m_astrFullName.Add(astrText[i]);
				   if( mt_unknown == psmcClass->m_smvFunctions[z].m_mtType ) 
				       psmcClass->m_smvFunctions[z].m_mtType = mtType;
				   if( mtType > psmcClass->m_smvFunctions[z].m_mtType ) 
                       psmcClass->m_smvFunctions[z].m_mtType = mtType;
				   astrText[i].Empty();			   
				 }// register function
			 }
		 }// if( bInClass )
     }// for( i = iStart; i < iEnde; i++ )
// now remove empty lines
  psmcClass->m_iFunctions = iRegisterPos;
  RemoveEmptyLines(astrText);
// now remove anwanted return words
  iStart = 0;
  iEnde  = psmcClass->m_iFunctions;
  for( i = iStart; i < iEnde; i++ )
     { ::RemoveNotReturns(psmcClass->m_smvFunctions[i].m_astrReturn, astrNotReturns);
	 }

}

void SModul::MakeHREFNames(void)
{ m_strHREFModul           = _T("Modul") + m_strHTMLTitle;
  m_strHREFGlobalVariables = m_strHREFModul + _T("GV");
  m_strHREFGlobalFunctions = m_strHREFModul + _T("GF");;
  ::CorrectHREFName(m_strHREFModul);
  ::CorrectHREFName(m_strHREFGlobalVariables);
  ::CorrectHREFName(m_strHREFGlobalFunctions);

  int i = 0;
  int j = 0;
  if( 0 < m_iNonClassVariables )
    { for( i = 0; i < m_iNonClassVariables; i++ )
	     { m_smvNonClassVariables[i].m_strHREFName = _T("GV") + m_smvNonClassVariables[i].m_strName;
           ::CorrectHREFName(m_smvNonClassVariables[i].m_strHREFName);
		 }
	}
  if( 0 < m_iNonClassFunctions )
    { for( i = 0; i < m_iNonClassFunctions; i++ )
	     { m_smvNonClassFunctions[i].m_strHREFName = _T("GF") + m_smvNonClassFunctions[i].m_strName;
           ::CorrectHREFName(m_smvNonClassFunctions[i].m_strHREFName);
		 }
	}
  if( 0 < m_iClasses )
    { for( i = 0; i < m_iClasses; i++ )
	     { m_smcClasses[i].m_strHREFName      = _T("Class") + m_smcClasses[i].m_strName;
		   m_smcClasses[i].m_strHREFVariables = m_smcClasses[i].m_strHREFName +_T("CV");
		   m_smcClasses[i].m_strHREFFunctions = m_smcClasses[i].m_strHREFName +_T("CF");
           ::CorrectHREFName(m_smcClasses[i].m_strHREFName);
           ::CorrectHREFName(m_smcClasses[i].m_strHREFVariables);
           ::CorrectHREFName(m_smcClasses[i].m_strHREFFunctions);
		   if( 0 < m_smcClasses[i].m_iVariables )
		     { for( j = 0; j < m_smcClasses[i].m_iVariables ; j++ )
			      { m_smcClasses[i].m_smvVariables[j].m_strHREFName = 
				      _T("CV") + m_smcClasses[i].m_strName + m_smcClasses[i].m_smvVariables[j].m_strName;
					::CorrectHREFName(m_smcClasses[i].m_smvVariables[j].m_strHREFName);
				  }// for( j = 0; j < m_smcClasses[i].m_iVariables ; j++ )
			 }// if( 0 < m_smcClasses[i].m_iVariables )
	       if( 0 < m_smcClasses[i].m_iFunctions )
		     { for( j = 0; j < m_smcClasses[i].m_iFunctions ; j++ )
			      { m_smcClasses[i].m_smvFunctions[j].m_strHREFName = 
				      _T("CF") + m_smcClasses[i].m_strName + m_smcClasses[i].m_smvFunctions[j].m_strName;
					::CorrectHREFName(m_smcClasses[i].m_smvFunctions[j].m_strHREFName);
				  }// for( j = 0; j < m_smcClasses[i].m_iFunctions ; j++ )
			 }// if( 0 < m_smcClasses[i].m_iFunctions )
		 }// for( i = 0; i < m_iClasses; i++ )
    }// if( 0 < m_iClasses )
}

void SModul::MakeSplitfileNames(const CString &strHeaderFilename, const CString& strHTMLFilename)
{ static const CString strTitleModul           = _T("Module: ");
  static const CString strTitleGlobalVariables = _T("Global Variables of Module ");
  static const CString strTitleGlobalFunctions = _T("Global Functions of Module ");
  static const CString strTitleGlobalFunction  = _T("Global Functions: ");

  static const CString strTitleClass            = _T("Class: ");
  static const CString strTitleClassVariables   = _T("Members of Class ");
  static const CString strTitleClasssFunctions  = _T("Methods of Class ");

  TCHAR  drive[_MAX_DRIVE];
  TCHAR  dir[_MAX_DIR];
  TCHAR  fname[_MAX_FNAME];
  TCHAR  ext[_MAX_EXT];
  _splitpath( strHTMLFilename, drive, dir, fname, ext );
  CString strSplitfileName = fname;
  m_strSplitfileModulName = fname;
  m_strSplitfileModulName += ext;
  _splitpath( strHeaderFilename, drive, dir, fname, ext );
  CString strSplitfileTitle = fname;
  m_strSplitfileNameGlobalVariables  = strSplitfileName + _T("GV.htm");
  m_strSplitfileNameGlobalFunctions  = strSplitfileName + _T("GF.htm");
  m_strSplitfileTitleModul           = strTitleModul + strSplitfileName;
  m_strSplitfileTitleGlobalVariables = strTitleGlobalVariables + strSplitfileTitle;
  m_strSplitfileTitleGlobalFunctions = strTitleGlobalFunctions + strSplitfileTitle;
  
  int i = 0;
  int j = 0;
  if( 0 < m_iNonClassFunctions )
    { for( i = 0; i < m_iNonClassFunctions; i++ )
	     { m_smvNonClassFunctions[i].m_strSplitfileName = m_smvNonClassFunctions[i].m_strName;
           ::CorrectHREFName(m_smvNonClassFunctions[i].m_strSplitfileName);
           m_smvNonClassFunctions[i].m_strSplitfileName = strSplitfileName + _T("GF") + m_smvNonClassFunctions[i].m_strSplitfileName + _T(".htm");
           m_smvNonClassFunctions[i].m_strSplitfileTitle =  strTitleGlobalFunction + m_smvNonClassFunctions[i].m_strName;
		 }
	}

  if( 0 >= m_iClasses )
    { return;
	}
    
  if( 0 < m_iClasses )
    { for( i = 0; i < m_iClasses; i++ )
	     { m_smcClasses[i].m_strSplitfileName  = strSplitfileName + _T("_Class_") + m_smcClasses[i].m_strName + _T(".htm");
           m_smcClasses[i].m_strSplitfileTitle = strTitleClass + m_smcClasses[i].m_strName;
		   if( 0 < m_smcClasses[i].m_iVariables )
		     {m_smcClasses[i].m_strSplitfileNameClassVariables  = strSplitfileName + _T("_Class_") + m_smcClasses[i].m_strName + _T("CV.htm");
			  m_smcClasses[i].m_strSplitfileTitleClassVariables = strTitleClassVariables + m_smcClasses[i].m_strName;
			 }// if( 0 < m_smcClasses[i].m_iVariables )
	       if( 0 < m_smcClasses[i].m_iFunctions )
		     { m_smcClasses[i].m_strSplitfileNameClassFunctions  = strSplitfileName + _T("_Class_") + m_smcClasses[i].m_strName + _T("CF.htm");
			   m_smcClasses[i].m_strSplitfileTitleClassFunctions = strTitleClasssFunctions + m_smcClasses[i].m_strName;
			   for( j = 0; j < m_smcClasses[i].m_iFunctions ; j++ )
			      { m_smcClasses[i].m_smvFunctions[j].m_strSplitfileName = m_smcClasses[i].m_smvFunctions[j].m_strName;
				    ::CorrectHREFName(m_smcClasses[i].m_smvFunctions[j].m_strSplitfileName);
				    m_smcClasses[i].m_smvFunctions[j].m_strSplitfileName =
					    strSplitfileName + _T("CF") + m_smcClasses[i].m_strName + m_smcClasses[i].m_smvFunctions[j].m_strSplitfileName + _T(".htm");
					m_smcClasses[i].m_smvFunctions[j].m_strSplitfileTitle = m_smcClasses[i].m_strName + _T(":") + m_smcClasses[i].m_smvFunctions[j].m_strName;
				  }// for( j = 0; j < m_smcClasses[i].m_iFunctions ; j++ )
			 }// if( 0 < m_smcClasses[i].m_iFunctions )
		 }// for( i = 0; i < m_iClasses; i++ )
    }// if( 0 < m_iClasses )
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
Germany Germany
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions