Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

122 lines
2.6 KiB

  1. /******************************************************************************
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. Index.cpp
  5. Abstract:
  6. This file contains the implementation of the JetBlueCOM::Index class.
  7. Revision History:
  8. Davide Massarenti (Dmassare) 05/20/2000
  9. created
  10. ******************************************************************************/
  11. #include <stdafx.h>
  12. #ifndef NOJETBLUECOM
  13. ////////////////////////////////////////////////////////////////////////////////
  14. JetBlueCOM::Index::Index()
  15. {
  16. m_idx = NULL; // JetBlue::Index* m_idx;
  17. // BaseObjectWithChildren<Index,Column> m_Columns;
  18. }
  19. JetBlueCOM::Index::~Index()
  20. {
  21. Passivate();
  22. }
  23. ////////////////////////////////////////
  24. HRESULT JetBlueCOM::Index::Initialize( /*[in]*/ JetBlue::Index& idx )
  25. {
  26. __HCP_FUNC_ENTRY( "JetBlueCOM::Index::Initialize" );
  27. HRESULT hr;
  28. int iCol = idx.NumOfColumns();
  29. int i;
  30. m_idx = &idx;
  31. for(i=0; i<iCol; i++)
  32. {
  33. CComPtr<Column> child;
  34. __MPC_EXIT_IF_METHOD_FAILS(hr, m_Columns.CreateChild( this, &child ));
  35. __MPC_EXIT_IF_METHOD_FAILS(hr, child->Initialize( idx.GetCol( i ) ));
  36. }
  37. hr = S_OK;
  38. __HCP_FUNC_CLEANUP;
  39. __HCP_FUNC_EXIT(hr);
  40. }
  41. void JetBlueCOM::Index::Passivate()
  42. {
  43. MPC::SmartLock<_ThreadModel> lock( this );
  44. m_idx = NULL;
  45. m_Columns.Passivate();
  46. }
  47. ////////////////////////////////////////
  48. STDMETHODIMP JetBlueCOM::Index::get_Name( /*[out, retval]*/ BSTR *pVal )
  49. {
  50. __HCP_FUNC_ENTRY( "JetBlueCOM::Index::get_Name" );
  51. USES_CONVERSION;
  52. HRESULT hr;
  53. MPC::SmartLock<_ThreadModel> lock( this );
  54. __MPC_PARAMCHECK_BEGIN(hr)
  55. __MPC_PARAMCHECK_POINTER_AND_SET(pVal,NULL);
  56. __MPC_PARAMCHECK_END();
  57. __MPC_JET_CHECKHANDLE(hr,m_idx,NULL);
  58. {
  59. const MPC::string& str = *m_idx;
  60. hr = MPC::GetBSTR( A2W(str.c_str()), pVal );
  61. }
  62. __HCP_FUNC_CLEANUP;
  63. __HCP_FUNC_EXIT(hr);
  64. }
  65. STDMETHODIMP JetBlueCOM::Index::get_Columns( /*[out, retval]*/ IPCHDBCollection* *pVal )
  66. {
  67. __HCP_FUNC_ENTRY( "JetBlueCOM::Index::get_Columns" );
  68. HRESULT hr;
  69. MPC::SmartLock<_ThreadModel> lock( this );
  70. __MPC_PARAMCHECK_BEGIN(hr)
  71. __MPC_PARAMCHECK_POINTER_AND_SET(pVal,NULL);
  72. __MPC_PARAMCHECK_END();
  73. __MPC_JET_CHECKHANDLE(hr,m_idx,NULL);
  74. hr = m_Columns.GetEnumerator( pVal );
  75. __HCP_FUNC_CLEANUP;
  76. __HCP_FUNC_EXIT(hr);
  77. }
  78. #endif