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.

797 lines
22 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1994 - 2000.
  5. //
  6. // File: catstate.CXX
  7. //
  8. // Contents: CCatState implementation
  9. //
  10. // History: 19-May-94 t-jeffc Created.
  11. //
  12. //----------------------------------------------------------------------------
  13. #include <pch.cxx>
  14. #pragma hdrstop
  15. #include <catstate.hxx>
  16. #include <doquery.hxx>
  17. //+---------------------------------------------------------------------------
  18. //
  19. // Member: CCatState::CCatState, public
  20. //
  21. // Synopsis: Initializes global state info.
  22. //
  23. // History: 06-May-92 AmyA Created
  24. //
  25. //----------------------------------------------------------------------------
  26. CCatState::CCatState()
  27. : _wcsProperty( 0 ), _propType( CONTENTS ),
  28. _prstLast( 0 ),
  29. _ulMethod( VECTOR_RANK_JACCARD ),
  30. _isDeep( FALSE ),
  31. _isVirtual( FALSE ),
  32. _eType( CiNormal ),
  33. _pwcsColumns( 0 ), _nColumns( 0 ),
  34. _nSort( 0 ), _psi( 0 ),
  35. _lcid( GetSystemDefaultLCID() ),
  36. _fIsSC( FALSE ),
  37. _fUseCI( FALSE ),
  38. _cCategories( 0 ),
  39. _aCategories( 0 ),
  40. _iCategorizationRow( 0 ),
  41. _cMaxResults( 0 ),
  42. _cFirstRows( 0 ),
  43. _wcsCDOld (MAX_PATH ),
  44. _wcsCD (MAX_PATH)
  45. {
  46. // set default output format
  47. SetColumn( L"path", 0 );
  48. SetColumn( L"filename", 1 );
  49. SetNumberOfColumns( 2 );
  50. SetDefaultProperty ( L"contents" );
  51. SetDeep (TRUE);
  52. _cCatSets = 0;
  53. DWORD rc = GetCurrentDirectory( _wcsCDOld.Count(), _wcsCDOld.Get() );
  54. if( 0 == rc )
  55. {
  56. THROW( CQueryException( QUERY_GET_CD_FAILED ) );
  57. }
  58. }
  59. //+---------------------------------------------------------------------------
  60. //
  61. // Member: CCatState::~CCatState, public
  62. //
  63. // Synopsis: Frees memory used by CCatState
  64. //
  65. // History: 25-May-94 t-jeffc Created
  66. //
  67. //----------------------------------------------------------------------------
  68. CCatState::~CCatState()
  69. {
  70. // free current propery name
  71. delete [] _wcsProperty;
  72. // free output column names
  73. if( _pwcsColumns )
  74. {
  75. unsigned int cColumns;
  76. for( cColumns = 0; cColumns < _nColumns; cColumns++ )
  77. {
  78. delete [] _pwcsColumns[ cColumns ];
  79. }
  80. delete [] _pwcsColumns;
  81. }
  82. // free sort info
  83. if( _psi )
  84. {
  85. unsigned int cProp;
  86. for( cProp = 0; cProp < _nSort; cProp++ )
  87. {
  88. delete [] _psi[ cProp ].wcsProp;
  89. }
  90. delete [] _psi;
  91. }
  92. // restore current directory
  93. if( _wcsCDOld.Get() )
  94. SetCurrentDirectory( _wcsCDOld.Get() );
  95. delete _prstLast;
  96. }
  97. //+---------------------------------------------------------------------------
  98. //
  99. // Member: CCatState::AddCatSetWithDefaults, public
  100. //
  101. // Synopsis: Adds a row with default <machine, catalog, scope, depth> values
  102. //
  103. // Arguments:
  104. //
  105. // Notes:
  106. //
  107. // History: 21-Jan-97 krishnaN Created
  108. //
  109. //----------------------------------------------------------------------------
  110. SCODE CCatState::AddCatSetWithDefaults()
  111. {
  112. CString *pStr = new CString( L"\\" );
  113. _aCatalogs.Add (pStr, _cCatSets);
  114. pStr = new CString( L"." );
  115. _aMachines.Add (pStr, _cCatSets);
  116. pStr = new CString( L"\\" );
  117. _aCatScopes.Add (pStr, _cCatSets);
  118. _afIsDeep.Add (TRUE, _cCatSets);
  119. _cCatSets++;
  120. return S_OK;
  121. }
  122. //+---------------------------------------------------------------------------
  123. //
  124. // Member: CCatState::SetDefaultProperty, public
  125. //
  126. // Synopsis: Changes the property passed to the parser on initialization
  127. // (the 'global default' property)
  128. //
  129. // Arguments: [wcsProperty] -- friendly name of property
  130. // (can be 0)
  131. //
  132. // Notes: Makes its own copy of the property name
  133. // (unlike GetDefaultProperty, which just returns a pointer)
  134. //
  135. // History: 18-May-94 t-jeffc Created
  136. //
  137. //----------------------------------------------------------------------------
  138. void CCatState::SetDefaultProperty( WCHAR const * wcsProperty )
  139. {
  140. delete [] _wcsProperty;
  141. if( wcsProperty == 0 )
  142. {
  143. _wcsProperty = 0;
  144. }
  145. else
  146. {
  147. int iLength = wcslen( wcsProperty ) + 1;
  148. _wcsProperty = new WCHAR[ iLength ];
  149. memcpy( _wcsProperty, wcsProperty, iLength * sizeof(WCHAR) );
  150. }
  151. }
  152. //+---------------------------------------------------------------------------
  153. //
  154. // Member: CCatState::SetCD, public
  155. //
  156. // Synopsis: Changes the current query directory.
  157. //
  158. // Arguments: [wcsCD] -- new current directory
  159. //
  160. // History: 31-May-94 t-jeffc Created
  161. //
  162. //----------------------------------------------------------------------------
  163. void CCatState::SetCD( WCHAR const * wcsCD )
  164. {
  165. if ( _isVirtual )
  166. {
  167. unsigned cc = wcslen( wcsCD ) + 1;
  168. if ( _wcsCD.Count() < cc )
  169. {
  170. delete [] _wcsCD.Acquire();
  171. _wcsCD.Init( cc );
  172. }
  173. RtlCopyMemory( _wcsCD.Get(), wcsCD, cc * sizeof(WCHAR) );
  174. }
  175. else
  176. {
  177. if( !SetCurrentDirectory( wcsCD ) )
  178. {
  179. THROW( CQueryException( QUERY_GET_CD_FAILED ) );
  180. }
  181. }
  182. }
  183. //+---------------------------------------------------------------------------
  184. //
  185. // Member: CCatState::GetCD, public
  186. //
  187. // Synopsis: Returns the current directory.
  188. //
  189. // History: 31-May-94 t-jeffc Created
  190. //
  191. //----------------------------------------------------------------------------
  192. WCHAR const * CCatState::GetCD()
  193. {
  194. if ( _isVirtual )
  195. return _wcsCD.Get();
  196. DWORD rc = GetCurrentDirectory( _wcsCD.Count(), _wcsCD.Get() );
  197. if( rc == 0 )
  198. {
  199. THROW( CQueryException( QUERY_GET_CD_FAILED ) );
  200. }
  201. return _wcsCD.Get();
  202. }
  203. //+---------------------------------------------------------------------------
  204. //
  205. // Member: CCatState::AddDir, public
  206. //
  207. // Synopsis: Changes the current query directory.
  208. //
  209. // Arguments: [wcsCD] -- new current directory
  210. //
  211. // History: 31-May-94 t-jeffc Created
  212. //
  213. //----------------------------------------------------------------------------
  214. void CCatState::AddDir( XPtrST<WCHAR> & wcsScope )
  215. {
  216. SCODE sc = AddCatSetWithDefaults();
  217. if (sc == S_OK)
  218. {
  219. // Use previous set's machine and catalog, if available.
  220. ChangeCurrentScope(wcsScope.GetPointer());
  221. if (_cCatSets > 1)
  222. {
  223. ChangeCurrentMachine(_aMachines[_cCatSets-2]->GetString());
  224. ChangeCurrentCatalog(_aCatalogs[_cCatSets-2]->GetString());
  225. }
  226. }
  227. }
  228. //+---------------------------------------------------------------------------
  229. //
  230. // Member: CCatState::AddCatalog, public
  231. //
  232. // Synopsis: Changes the current query directory.
  233. //
  234. // Arguments: [wcsCatalog] -- new current directory
  235. //
  236. // History: 21-Jan-97 KrishnaN Created
  237. //
  238. //----------------------------------------------------------------------------
  239. void CCatState::AddCatalog( XPtrST<WCHAR> & wcsCatalog )
  240. {
  241. SCODE sc = AddCatSetWithDefaults();
  242. if (sc == S_OK)
  243. {
  244. // Use previous set's machine, if available, and a default scope
  245. ChangeCurrentCatalog(wcsCatalog.GetPointer());
  246. if (_cCatSets > 1)
  247. {
  248. ChangeCurrentMachine(_aMachines[_cCatSets-2]->GetString());
  249. }
  250. }
  251. }
  252. //+---------------------------------------------------------------------------
  253. //
  254. // Member: CCatState::AddMachine, public
  255. //
  256. // Synopsis: Changes the current query directory.
  257. //
  258. // Arguments: [wcsMachine] -- new current directory
  259. //
  260. // History: 21-Jan-97 KrishnaN Created
  261. //
  262. //----------------------------------------------------------------------------
  263. void CCatState::AddMachine( XPtrST<WCHAR> & wcsMachine )
  264. {
  265. SCODE sc = AddCatSetWithDefaults();
  266. if (sc == S_OK)
  267. ChangeCurrentMachine(wcsMachine.GetPointer());
  268. }
  269. //+---------------------------------------------------------------------------
  270. //
  271. // Member: CCatState::ChangeCurrentCatalog, public
  272. //
  273. // Synopsis: Changes the current catalog.
  274. //
  275. // Arguments: [wcsCatalog] -- new catalog
  276. //
  277. // History: 21-Jan-97 KrishnaN Created
  278. //
  279. //----------------------------------------------------------------------------
  280. void CCatState::ChangeCurrentCatalog (WCHAR const * wcsCatalog)
  281. {
  282. if (_cCatSets == 0) // if we don't have a row to change, add one
  283. AddCatSetWithDefaults();
  284. // replace the current row's catalog value
  285. _aCatalogs[_cCatSets-1]->Replace(wcsCatalog);
  286. }
  287. //+---------------------------------------------------------------------------
  288. //
  289. // Member: CCatState::ChangeCurrentDepth, public
  290. //
  291. // Synopsis: Changes the current catalog.
  292. //
  293. // Arguments: [wcsCatalog] -- new catalog
  294. //
  295. // History: 21-Jan-97 KrishnaN Created
  296. //
  297. //----------------------------------------------------------------------------
  298. void CCatState::ChangeCurrentDepth (BOOL fDepth)
  299. {
  300. if (_cCatSets == 0) // if we don't have a row to change, add one
  301. AddCatSetWithDefaults();
  302. // replace the current row's catalog value
  303. _afIsDeep[_cCatSets-1] = fDepth;
  304. }
  305. //+---------------------------------------------------------------------------
  306. //
  307. // Member: CCatState::ChangeCurrentMachine, public
  308. //
  309. // Synopsis: Changes the current Machine.
  310. //
  311. // Arguments: [wcsMachine] -- new Machine
  312. //
  313. // History: 21-Jan-97 KrishnaN Created
  314. //
  315. //----------------------------------------------------------------------------
  316. void CCatState::ChangeCurrentMachine (WCHAR const * wcsMachine)
  317. {
  318. if (_cCatSets == 0) // if we don't have a row to change, add one
  319. AddCatSetWithDefaults();
  320. // replace the current row's Machine value
  321. _aMachines[_cCatSets-1]->Replace(wcsMachine);
  322. }
  323. //+---------------------------------------------------------------------------
  324. //
  325. // Member: CCatState::ChangeCurrentScope, public
  326. //
  327. // Synopsis: Changes the current scope.
  328. //
  329. // Arguments: [wcsScope] -- new scope
  330. //
  331. // History: 21-Jan-97 KrishnaN Created
  332. //
  333. //----------------------------------------------------------------------------
  334. void CCatState::ChangeCurrentScope (WCHAR const * wcsScope)
  335. {
  336. if (_cCatSets == 0) // if we don't have a row to change, add one
  337. AddCatSetWithDefaults();
  338. // replace the current row's scope value
  339. _aCatScopes[_cCatSets-1]->Replace(wcsScope);
  340. }
  341. //+---------------------------------------------------------------------------
  342. //
  343. // Member: CCatState::AddDepthFlag, public
  344. //
  345. // Synopsis: Changes the current query directory.
  346. //
  347. // Arguments: [wcsCD] -- new current directory
  348. //
  349. // History: 21-Jan-97 KrishnaN Created
  350. //
  351. //----------------------------------------------------------------------------
  352. void CCatState::AddDepthFlag( BOOL fIsDeep )
  353. {
  354. if (_cCatSets == 0) // if we don't have a row to change, add one
  355. AddCatSetWithDefaults();
  356. _afIsDeep[_cCatSets-1] = fIsDeep;
  357. }
  358. //+---------------------------------------------------------------------------
  359. //
  360. // Member: CCatState::SetCatalog, public
  361. //
  362. // Synopsis: Changes the current catalog directory.
  363. //
  364. // Arguments: [wcsCatalog] -- new catalog location
  365. // (0 indicates the catalog is at or above _wcsCD)
  366. //
  367. // Notes: Makes & owns a copy of the path.
  368. //
  369. // History: 21-Jul-94 t-jeffc Created
  370. //
  371. //----------------------------------------------------------------------------
  372. void CCatState::SetCatalog( WCHAR const * wcsCatalog )
  373. {
  374. delete [] _wcsCatalog.Acquire();
  375. if( wcsCatalog != 0 )
  376. {
  377. int iLength = wcslen( wcsCatalog ) + 1;
  378. _wcsCatalog.Init( iLength );
  379. memcpy( _wcsCatalog.Get(), wcsCatalog, iLength * sizeof(WCHAR) );
  380. }
  381. }
  382. //+---------------------------------------------------------------------------
  383. //
  384. // Member: CCatState::SetColumn, public
  385. //
  386. // Synopsis: Sets the property for the specified output column.
  387. //
  388. // Arguments: [wcsColumn] -- friendly property name
  389. // [uPos] -- 0-based column number
  390. //
  391. // Notes: Makes its own copy of the property name.
  392. //
  393. // History: 31-May-94 t-jeffc Created
  394. //
  395. //----------------------------------------------------------------------------
  396. void CCatState::SetColumn( WCHAR const * wcsColumn, unsigned int uPos )
  397. {
  398. // does _pwcsColumns need to be extended?
  399. if( uPos >= _nColumns )
  400. {
  401. WCHAR ** pwcsTemp = new WCHAR *[ uPos + 1 ];
  402. unsigned int cCol;
  403. // copy the old pointers and 0 any new ones
  404. for( cCol = 0; cCol < uPos + 1; cCol++ )
  405. {
  406. if( cCol < _nColumns )
  407. pwcsTemp[ cCol ] = _pwcsColumns[ cCol ];
  408. else
  409. pwcsTemp[ cCol ] = 0;
  410. }
  411. delete [] _pwcsColumns;
  412. _nColumns = uPos + 1;
  413. _pwcsColumns = pwcsTemp;
  414. }
  415. // free any previous column string
  416. delete [] _pwcsColumns[ uPos ];
  417. // copy & set the column
  418. if( wcsColumn == 0 )
  419. {
  420. _pwcsColumns[ uPos ] = 0;
  421. }
  422. else
  423. {
  424. int iLength = wcslen( wcsColumn ) + 1;
  425. _pwcsColumns[ uPos ] = new WCHAR[ iLength ];
  426. memcpy( _pwcsColumns[ uPos ], wcsColumn, iLength * sizeof(WCHAR) );
  427. }
  428. }
  429. //+---------------------------------------------------------------------------
  430. //
  431. // Member: CCatState::GetColumn, public
  432. //
  433. // Synopsis: Gets the property for the specified output column.
  434. //
  435. // Arguments: [uPos] -- 0-based column number
  436. //
  437. // Notes: Returns 0 if the column number is out of range.
  438. // Only returns a pointer the string; does not copy it.
  439. //
  440. // History: 31-May-94 t-jeffc Created
  441. //
  442. //----------------------------------------------------------------------------
  443. WCHAR const * CCatState::GetColumn( unsigned int uPos ) const
  444. {
  445. if( uPos >= _nColumns )
  446. return 0;
  447. return _pwcsColumns[ uPos ];
  448. }
  449. //+---------------------------------------------------------------------------
  450. //
  451. // Member: CCatState::SetNumberOfColumns, public
  452. //
  453. // Synopsis: sets the number of columns in the output
  454. //
  455. // Arguments: [cCol] -- number of output columns
  456. //
  457. // Notes: Used after all columns have been set with
  458. // SetColumn().
  459. //
  460. // History: 31-May-94 t-jeffc Created
  461. //
  462. //----------------------------------------------------------------------------
  463. void CCatState::SetNumberOfColumns( unsigned int cCol )
  464. {
  465. if( cCol < _nColumns )
  466. {
  467. for( ; cCol < _nColumns; cCol++ )
  468. {
  469. delete [] _pwcsColumns[ cCol ];
  470. _pwcsColumns[ cCol ] = 0;
  471. }
  472. }
  473. }
  474. //+---------------------------------------------------------------------------
  475. //
  476. // Member: CCatState::NumberOfColumns, public
  477. //
  478. // Synopsis: Returns the number of output columns
  479. //
  480. // History: 31-May-94 t-jeffc Created
  481. //
  482. //----------------------------------------------------------------------------
  483. unsigned int CCatState::NumberOfColumns() const
  484. {
  485. unsigned int cCol;
  486. for( cCol = 0; cCol < _nColumns; cCol++ )
  487. {
  488. if( _pwcsColumns[ cCol ] == 0 )
  489. break;
  490. }
  491. return cCol;
  492. }
  493. //+---------------------------------------------------------------------------
  494. //
  495. // Member: CCatState::SetSortProp, public
  496. //
  497. // Synopsis: Sets a property for sorting
  498. //
  499. // Arguments: [wcsProp] -- friendly property name
  500. // [sd] -- sort direction
  501. // [uPos] -- 0-based sort order
  502. //
  503. // Notes: Makes its own copy of the property name.
  504. //
  505. // History: 17-Jun-94 t-jeffc Created
  506. //
  507. //----------------------------------------------------------------------------
  508. void CCatState::SetSortProp( WCHAR const * wcsProp, SORTDIR sd, unsigned int uPos )
  509. {
  510. // does _psi need to be extended?
  511. if( uPos >= _nSort )
  512. {
  513. SSortInfo * psiTemp = new SSortInfo[ uPos + 1 ];
  514. unsigned int cProp;
  515. // copy the old entries and 0 any new ones
  516. for( cProp = 0; cProp < uPos + 1; cProp++ )
  517. {
  518. if( cProp < _nSort )
  519. psiTemp[ cProp ] = _psi[ cProp ];
  520. else
  521. psiTemp[ cProp ].wcsProp = 0;
  522. }
  523. delete [] _psi;
  524. _nSort = uPos + 1;
  525. _psi = psiTemp;
  526. }
  527. // free any previous property string
  528. delete [] _psi[ uPos ].wcsProp;
  529. // copy & set the column
  530. if( wcsProp == 0 )
  531. {
  532. _psi[ uPos ].wcsProp = 0;
  533. }
  534. else
  535. {
  536. int iLength = wcslen( wcsProp ) + 1;
  537. _psi[ uPos ].wcsProp = new WCHAR[ iLength ];
  538. memcpy( _psi[ uPos ].wcsProp, wcsProp, iLength * sizeof(WCHAR) );
  539. }
  540. _psi[ uPos ].sd = sd;
  541. }
  542. //+---------------------------------------------------------------------------
  543. //
  544. // Member: CCatState::SetNumberOfSortProps, public
  545. //
  546. // Synopsis: sets the number of sort keys
  547. //
  548. // Arguments: [cProp] -- number of sort keys
  549. //
  550. // History: 17-Jun-94 t-jeffc Created
  551. //
  552. //----------------------------------------------------------------------------
  553. void CCatState::SetNumberOfSortProps( unsigned int cProp )
  554. {
  555. if( cProp < _nSort )
  556. {
  557. for( ; cProp < _nSort; cProp++ )
  558. {
  559. delete [] _psi[ cProp ].wcsProp;
  560. _psi[ cProp ].wcsProp = 0;
  561. }
  562. }
  563. }
  564. //+---------------------------------------------------------------------------
  565. //
  566. // Member: CCatState::GetSortProp, public
  567. //
  568. // Synopsis: Returns sort information about a specific key
  569. //
  570. // Arguments: [uPos] -- 0-based sort ordinal (ie uPos=0 gives the primary sort key)
  571. // [*pwcsName] -- friendly name of the property
  572. // [*psd] -- sort order for this property
  573. //
  574. // Notes: Only returns a pointer the string; does not copy it.
  575. // Returns 0 in *pwcsName if uPos is out of range.
  576. //
  577. // History: 17-Jun-94 t-jeffc Created
  578. //
  579. //----------------------------------------------------------------------------
  580. void CCatState::GetSortProp( unsigned int uPos,
  581. WCHAR const ** pwcsName,
  582. SORTDIR * psd ) const
  583. {
  584. if( uPos >= _nColumns )
  585. {
  586. if( pwcsName )
  587. *pwcsName = 0;
  588. }
  589. else
  590. {
  591. if( pwcsName )
  592. *pwcsName = _psi[ uPos ].wcsProp;
  593. if( psd )
  594. *psd = _psi[ uPos ].sd;
  595. }
  596. }
  597. //+---------------------------------------------------------------------------
  598. //
  599. // Member: CCatState::NumberOfSortProps, public
  600. //
  601. // Synopsis: Returns the number of sort keys
  602. //
  603. // History: 17-Jun-94 t-jeffc Created
  604. //
  605. //----------------------------------------------------------------------------
  606. unsigned int CCatState::NumberOfSortProps() const
  607. {
  608. unsigned int cProp;
  609. for( cProp = 0; cProp < _nSort; cProp++ )
  610. {
  611. if( _psi[ cProp ].wcsProp == 0 )
  612. break;
  613. }
  614. return cProp;
  615. }
  616. //+---------------------------------------------------------------------------
  617. //
  618. // Member: CCatState::SetLocale, public
  619. //
  620. // Synopsis: Sets the new locale
  621. //
  622. // Arguments: [wcsLocale] -- Three letter abbreviation of locale
  623. //
  624. // History: 29-Nov-94 SitaramR Created
  625. //
  626. //----------------------------------------------------------------------------
  627. void CCatState::SetLocale(WCHAR const *wcsLocale )
  628. {
  629. WCHAR wszAbbrev[6];
  630. LCID lcid;
  631. // check for neutral langauge and neutral sub language
  632. if ( _wcsicmp( wcsLocale, L"neutral" ) == 0 )
  633. {
  634. _lcid = 0;
  635. return;
  636. }
  637. // decreasing for-loops, because we want to match LANG_NEUTRAL and
  638. // SUBLANG_NEUTRAL, which are 0, last
  639. for ( INT lang=0x20; lang>-1; lang-- )
  640. for ( INT subLang=7; subLang>-1; subLang-- )
  641. for ( unsigned sort=0; sort<2; sort++ )
  642. {
  643. lcid = MAKELCID( MAKELANGID( lang, subLang), sort );
  644. if ( GetLocaleInfoW( lcid, LOCALE_SABBREVLANGNAME, wszAbbrev, 6) )
  645. {
  646. if ( _wcsicmp( wcsLocale, wszAbbrev ) == 0 )
  647. {
  648. _lcid = lcid;
  649. return;
  650. }
  651. }
  652. }
  653. THROW( CException( STATUS_INVALID_PARAMETER ) );
  654. }
  655. //+---------------------------------------------------------------------------
  656. //
  657. // Member: CCatState::SetCategory, public
  658. //
  659. // Synopsis: Sets the new category
  660. //
  661. // Arguments: [wcsCategory] -- friendly category name
  662. // [uPos] -- position of category
  663. //
  664. // History: 21-Aug-95 SitaramR Created
  665. //
  666. //----------------------------------------------------------------------------
  667. void CCatState::SetCategory( WCHAR const *pwcsCategory, unsigned uPos )
  668. {
  669. Win4Assert( pwcsCategory );
  670. CString *pString = new CString( pwcsCategory );
  671. _aCategories.Add( pString, uPos );
  672. }
  673. //+---------------------------------------------------------------------------
  674. //
  675. // Member: CCatState::GetCategory, public
  676. //
  677. // Synopsis: Returns the required category
  678. //
  679. // Arguments: [uPos] -- position of category
  680. //
  681. // History: 21-Aug-95 SitaramR Created
  682. //
  683. //----------------------------------------------------------------------------
  684. WCHAR const *CCatState::GetCategory( unsigned uPos ) const
  685. {
  686. Win4Assert( uPos < _cCategories );
  687. CString *pString = _aCategories.Get( uPos );
  688. if ( pString )
  689. return pString->GetString();
  690. else
  691. return 0;
  692. }