home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / C / BC_502 / ADDON.PAK / PROJECT3.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-06  |  2.5 KB  |  129 lines

  1. #ifndef __AOEXPCH_H
  2.   #include "aoexpch.h"
  3. #endif
  4. #pragma hdrstop
  5.  
  6. #include <ideaddon\iscript.h>
  7.  
  8. #include "project3.h"
  9.  
  10.  
  11. //
  12. // Used to call OutStr to display dependencies in 
  13. // MyProjClient::DependencyQueryResponder;
  14. //
  15. ProjectTestC* thisTest;
  16.  
  17. ////////////////////////////////
  18. // ProjectTestC Implementation
  19. ////////////////////////////////
  20.  
  21.  
  22. ProjectTestC::ProjectTestC()
  23.              : prjServer( 0 ), prjClient( 0 )
  24. {
  25.    
  26. }
  27.  
  28.  
  29. ProjectTestC::~ProjectTestC()
  30. {
  31.   if( prjClient )  {
  32.       prjClient->AddRef();
  33.       prjServer->UnregisterProjectClient( prjClient );
  34.       prjClient->Release();
  35.   }
  36.   
  37.   if( prjServer )
  38.       prjServer->Release();
  39.       
  40. }
  41.  
  42.  
  43. BOOL ProjectTestC::Init()
  44. {
  45.   OutStr( "ProjectTestC::Init()" );
  46.   thisTest = this;
  47.   IProjectServer* _prjServer = GET_INTERFACE( IProjectServer );
  48.   prjServer = QUERY_INTERFACE( _prjServer, IProjectServer3 );
  49.   _prjServer->Release();
  50.   if( !prjServer )  {
  51.     OutStr( "Couldn't get IProjectServer3 interface" );
  52.     return FALSE;
  53.   }
  54.  
  55.   prjClient = new MyProjClient();
  56.   prjClient->AddRef();
  57.   prjServer->RegisterProjectClient( prjClient );
  58.   
  59.   return TRUE;
  60. }
  61.  
  62.  
  63. void ProjectTestC::UnInit()
  64. {
  65.   OutStr( "ProjectTestC::UnInit()" );
  66. }
  67.  
  68.  
  69. const char* ProjectTestC::GetName()
  70. {
  71.    return "Project Test C";
  72. }
  73.  
  74.  
  75. const char* ProjectTestC::GetTestDescription(int testNum)
  76. {
  77.     switch(testNum)  {
  78.       case 1:
  79.         return "Display dependencies for selected node";
  80.       default: 
  81.         return "Test Not Implemented";
  82.     }
  83. }
  84.  
  85.  
  86. void ProjectTestC::DoTest(int testNum)
  87. {
  88.     switch(testNum)  {
  89.       case 1:  
  90.         ShowDeps();
  91.         break;
  92.       default:
  93.         OutStr( "Test Not Implemented" );
  94.     }
  95. }
  96.  
  97.  
  98. void ProjectTestC::ShowDeps()
  99. {
  100.   int num = 0;
  101.   ProjectNode* node = prjServer->QuerySelectedNodes( &num );
  102.   if( num == 0 )  {
  103.     OutStr( "No nodes selected" );
  104.     return;
  105.   }
  106.  
  107.   IProjectNodeInfo* info = prjServer->QueryNodeInfo( *node );
  108.   IPolyString* name = info->GetName();
  109.   OutStr( FormatStr("Dependencies for: %s", name->GetCstr()) );
  110.   info->Release();
  111.   name->Release();
  112.  
  113.   prjServer->QueryAutoDependencies( *node, prjClient );
  114. }
  115.  
  116.  
  117. /*-----------------------------------------------------------------------*/
  118.  
  119.  
  120. void MyProjClient::DependencyQueryResponder( ProjectNode node,
  121.                                              IPolyString* name )
  122. {
  123.    thisTest->OutStr( name->GetCstr() );
  124.    name->Release();
  125. }
  126.  
  127.  
  128. /*-----------------------------------------------------------------------*/
  129.