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

Include File Hierarchy Viewer

Rate me:
Please Sign up or sign in to vote.
4.84/5 (108 votes)
29 Jul 2003CPOL8 min read 383K   4.5K   151  
A tool to view the include file hierarchy of your source code.
//====================================================================
// Although great care has gone into developing this software,
// it is provided without any guarantee of reliability, accuracy
// of information, or correctness of operation.  I am not responsible
// for any damages that may occur as a result of using this software.
// Use this software entirely at your own risk.
// Copyright 2003, Chris Richardson
//
// Description: Represents the results of a parsed file.
//
//====================================================================

#if !defined(AFX_PARSEDFILE_H__F1E983B7_3DD4_4AC5_8388_D1854E88ECAD__INCLUDED_)
#define AFX_PARSEDFILE_H__F1E983B7_3DD4_4AC5_8388_D1854E88ECAD__INCLUDED_

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

using namespace std;

class CParsedFile;
class CParsedFileGroup;
class CPugXmlBranch;

typedef vector<CParsedFile*>        CParsedFileArray;
typedef list<CParsedFile*>          CParsedFileList;

class CParsedFile  
{
public:
	CParsedFile( const TCHAR * p_pszFile );
	virtual ~CParsedFile();
   
   inline const CTCharString &      GetFileName() const;
   inline CParsedFileArray &        GetIncludedFiles();
   inline CParsedFileArray &        GetIncludedByFiles();

   void                             AddIncludedFile( CParsedFile * p_poFile );
   void                             AddIncludedByFile( CParsedFile * p_poFile );
   
   inline unsigned long             GetLineCount() const;
   inline void                      SetLineCount( unsigned long p_ulLines );

   inline void                      SetNotFoundFlag();
   inline bool                      GetNotFoundFlag() const;
   
   void                             SetAlreadyIncluded( bool p_bIncluded );
   inline bool                      GetAlreadyIncluded();
   
   void                             SaveToFile( FILE * p_pstFile, int p_iLevel = 1 );
   void                             ReadFromXml( CPugXmlBranch *     p_poBranch,
                                                 CParsedFileList &   p_roResults );

protected:
   bool                             c_bNotFoundFlag;
   CTCharString                     c_sFileName;
   unsigned long                    c_ulLineCount;
   CParsedFileArray                 c_oIncludedFiles;
   CParsedFileArray                 c_oIncludedByFiles;
   
   bool                             c_bAlreadyIncluded; // Flag for the GUI to use while recursing the include tree.
};

inline const CTCharString & CParsedFile::GetFileName() const
{
   return c_sFileName;
}
//
// ------------------------------------------------------------------
//
inline CParsedFileArray & CParsedFile::GetIncludedFiles()
{
   return c_oIncludedFiles;
}
//
// ------------------------------------------------------------------
//
inline CParsedFileArray & CParsedFile::GetIncludedByFiles()
{
   return c_oIncludedByFiles;
}
//
// ------------------------------------------------------------------
//
inline void CParsedFile::SetNotFoundFlag()
{
   c_bNotFoundFlag = true;
}
//
// ------------------------------------------------------------------
//
inline bool CParsedFile::GetNotFoundFlag() const
{
   return c_bNotFoundFlag;
}
//
// ------------------------------------------------------------------
//
inline bool CParsedFile::GetAlreadyIncluded()
{
   return c_bAlreadyIncluded;
}
//
// ------------------------------------------------------------------
//
inline void CParsedFile::SetLineCount( unsigned long p_ulLines )
{
   c_ulLineCount = p_ulLines;
}
//
// ------------------------------------------------------------------
//
inline unsigned long CParsedFile::GetLineCount() const
{
   return c_ulLineCount;
}
//
// ------------------------------------------------------------------
//

#endif // !defined(AFX_PARSEDFILE_H__F1E983B7_3DD4_4AC5_8388_D1854E88ECAD__INCLUDED_)

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)
United States United States
I like to program, I like to sail.

Comments and Discussions