Click here to Skip to main content
15,885,216 members
Articles / Programming Languages / C++

ToDoList Add-on

Rate me:
Please Sign up or sign in to vote.
4.69/5 (6 votes)
20 Apr 2002CPOL3 min read 241.5K   2.9K   57  
A Visual Studio add-in to help navigate to TODO:, TASK: etc comments, as well as showing STL containers in debug mode such as std::string, std::list etc
#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.

License

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


Written By
CEO ArtfulBits Inc.
Ukraine Ukraine
Name:Kucherenko Oleksandr

Born:September 20, 1979

Platforms: Win32, Linux; - well known and MS-DOS; Win16; OS/2 - old time not touched;

Hardware: IBM PC

Programming Languages: Assembler (for Intel 80386); Borland C/C++; Borland Pascal; Object Pascal; Borland C++Builder; Delphi; Perl; Java; Visual C++; Visual J++; UML; XML/XSL; C#; VB.NET; T-SQL; PL/SQL; and etc.

Development Environments: MS Visual Studio 2001-2008; MS Visual C++; Borland Delphi; Borland C++Builder; C/C++ any; Rational Rose; GDPro; Together and etc.

Libraries: STL, ATL, WTL, MFC, NuMega Driver Works, VCL; .NET 1.0, 1.1, 2.0, 3.5; and etc.

Technologies: Client/Server; COM; DirectX; DirectX Media; BDE; HTML/DHTML; ActiveX; Java Servlets; DCOM; COM+; ADO; CORBA; .NET; Windows Forms; GDI/GDI+; and etc.

Application Skills: Databases - design and maintain, support, programming; GUI Design; System Programming, Security; Business Software Development. Win/Web Services development and etc.

Comments and Discussions