|
#ifndef _OUTPUT_BASE_CLASS_H_
#define _OUTPUT_BASE_CLASS_H_
#pragma once
#include <map>
class CToDoWorkSpace;
#ifndef PURE
# define PURE =0
#endif
//////////////////////////////////////////////////////////////////////////
//
typedef enum
{
sortByFilename = 0,
sortByDirectory = 1,
sortByExtension = 2,
sortByKeyword = 3,
sortByComments = 4
} TSorting;
//////////////////////////////////////////////////////////////////////////
//
typedef std::vector<TSorting> TSortList;
//////////////////////////////////////////////////////////////////////////
//
class CSortElement
{
public:
long m_lLine;
string m_strDir;
string m_strFileName;
string m_strExtension;
string m_strKeyWord;
string m_strComment;
TSortList *m_pSort;
CSortElement( const CSortElement &twin );
CSortElement( string &KeyWord, string &Comment, string &FileName,
TSortList &Sort, long lLine );
const char *GetByType( const TSorting type );
bool operator < ( CSortElement &twin );
CSortElement &operator =( const CSortElement &twin );
char *GetResultString( void );
};
//////////////////////////////////////////////////////////////////////////
//
class IOutputSort
{
public:
virtual void SetApplication( IApplication *pAppl ) PURE;
virtual void SetSourceData( CToDoWorkSpace *pWork ) PURE;
virtual HANDLE OutputSort( void ) PURE;
virtual void AddSorting( TSorting sort ) PURE;
virtual void ShowKeyword( string &strKey ) PURE;
virtual void ShowProject( string &strPrj ) PURE;
virtual void ClearSorting( void ) PURE;
};
//////////////////////////////////////////////////////////////////////////
//
typedef std::vector<CSortElement> TTableView;
//////////////////////////////////////////////////////////////////////////
//
class CSortImpl : public IOutputSort
{
public:
CSortImpl( IApplication *pAppl, CToDoWorkSpace *pWork, string &Key, string &Prj )
: m_pAppl( pAppl )
, m_pWork( pWork )
, m_strKeyword( Key )
, m_strProject( Prj )
, m_hThread( NULL )
{
}
~CSortImpl( void )
{
ClearSorting();
if( m_hThread != NULL )
{
::TerminateThread( m_hThread, ( DWORD )-1 );
m_hThread = NULL;
}
}
virtual void SetApplication( IApplication *pAppl );
virtual void SetSourceData( CToDoWorkSpace *pWork );
virtual HANDLE OutputSort( void );
virtual void AddSorting( TSorting sort );
virtual void ClearSorting( void );
virtual void ShowKeyword( string &strKey );
virtual void ShowProject( string &strPrj );
protected:
void OutputString( string &strOut );
void OutputString( char *czString );
void CreateSortTable( void );
void CreateByProject( TProject &project );
void CreateByMultiParse( CToDoMultiParse &parse );
void CreateByKeyword( const string &FileName, CToDoSingleParse &parse );
static int ShowResultsThread( CSortImpl *pThis );
CComPtr<IApplication> m_pAppl;
TSortList m_cList;
CToDoWorkSpace *m_pWork;
TTableView m_cTable;
HANDLE m_hThread;
string m_strKeyword;
string m_strProject;
};
#endif // _OUTPUT_BASE_CLASS_H_
|
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.