Source code of Windows XP (NT5)
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.

2555 lines
81 KiB

  1. /****************************************************************************
  2. Copyright information : Copyright (c) 1998-1999 Microsoft Corporation
  3. File Name : CommandSwitches.cpp
  4. Project Name : WMI Command Line
  5. Author Name : Ch. Sriramachandramurthy
  6. Date of Creation (dd/mm/yy) : 27th-September-2000
  7. Version Number : 1.0
  8. Brief Description : This class encapsulates the functionality needed
  9. for accessing and storing the command switches
  10. information, which will be used by Parsing,
  11. Execution and Format Engines depending upon the
  12. applicability.
  13. Revision History :
  14. Last Modified By : Ch. Sriramachandramurthy
  15. Last Modified Date : 20th-March-2001
  16. ****************************************************************************/
  17. #include "Precomp.h"
  18. #include "CommandSwitches.h"
  19. /////////////////////////////////////////////////////////////////////////////
  20. /*------------------------------------------------------------------------
  21. Name :CCommandSwitches
  22. Synopsis :This function initializes the member variables when
  23. an object of the class type is instantiated
  24. Type :Constructor
  25. Input parameter :None
  26. Output parameters :None
  27. Return Type :None
  28. Global Variables :None
  29. Calling Syntax :None
  30. Notes :None
  31. ------------------------------------------------------------------------*/
  32. CCommandSwitches::CCommandSwitches()
  33. {
  34. m_pszCommandInput = NULL;
  35. m_pszAliasName = NULL;
  36. m_pszAliasDesc = NULL;
  37. m_pszClassPath = NULL;
  38. m_pszPathExpr = NULL;
  39. m_pszWhereExpr = NULL;
  40. m_pszVerb = NULL;
  41. m_pszMethodName = NULL;
  42. m_pszAliasTarget = NULL;
  43. m_bstrXML = NULL;
  44. m_hResult = S_OK;
  45. m_bSuccess = TRUE;
  46. m_ulInterval = 0;
  47. m_pszTransTableName = NULL;
  48. m_nInteractiveMode = DEFAULTMODE;
  49. m_pComError = NULL;
  50. m_pszListFormat = NULL;
  51. m_pszPWhereExpr = NULL;
  52. m_uInformationCode = 0;
  53. m_pIMethOutParam = NULL;
  54. m_pszUser = NULL;
  55. m_pszPassword = NULL;
  56. m_pszNamespace = NULL;
  57. m_pszNode = NULL;
  58. m_pszLocale = NULL;
  59. m_pszVerbDerivation = NULL;
  60. m_vtVerbType = NONALIAS;
  61. m_bCredFlag = FALSE;
  62. m_bExplicitWhereExpr = FALSE;
  63. m_uErrataCode = 0;
  64. m_bTranslateFirst = TRUE;
  65. m_pszResultClassName = NULL;
  66. m_pszResultRoleName = NULL;
  67. m_pszAssocClassName = NULL;
  68. m_ulRepeatCount = 0;
  69. m_bMethAvail = FALSE;
  70. m_bWritePropsAvail = FALSE;
  71. m_bLISTFrmsAvail = FALSE;
  72. m_bNamedParamList = FALSE;
  73. m_bEverySwitch = FALSE;
  74. m_bOutputSwitch = FALSE;
  75. m_bstrFormedQuery = NULL;
  76. m_bSysProp = FALSE;
  77. ClearXSLTDetailsVector();
  78. }
  79. /*------------------------------------------------------------------------
  80. Name :~CCommandSwitches
  81. Synopsis :This function Uninitializes the member variables when
  82. an object of the class type is destructed.
  83. Type :Destructor
  84. Input parameter :None
  85. Output parameters :None
  86. Return Type :None
  87. Global Variables :None
  88. Calling Syntax :None
  89. Notes :None
  90. ------------------------------------------------------------------------*/
  91. CCommandSwitches::~CCommandSwitches()
  92. {
  93. Uninitialize();
  94. }
  95. /*------------------------------------------------------------------------
  96. Name :SetCommandInput
  97. Synopsis :This function Assigns the parameter passed to m_psz
  98. CommandInput
  99. Type :Member Function
  100. Input parameter :
  101. pszCommandinput -String type, Contains the command string
  102. Output parameters :None
  103. Return Type :BOOL
  104. Global Variables :None
  105. Calling Syntax :SetCommandInput (pszCommandInput)
  106. Notes :None
  107. ------------------------------------------------------------------------*/
  108. BOOL CCommandSwitches::SetCommandInput(const _TCHAR* pszCommandInput)
  109. {
  110. BOOL bResult = TRUE;
  111. SAFEDELETE(m_pszCommandInput);
  112. if (pszCommandInput)
  113. {
  114. m_pszCommandInput = new _TCHAR [lstrlen(pszCommandInput)+1];
  115. if(m_pszCommandInput)
  116. lstrcpy(m_pszCommandInput, pszCommandInput);
  117. else
  118. bResult=FALSE;
  119. }
  120. return bResult;
  121. };
  122. /*------------------------------------------------------------------------
  123. Name :SetAliasName
  124. Synopsis :This function assigns the parameters
  125. passed to m_pszAliasName.
  126. Type :Member Function
  127. Input parameter :
  128. pszAliasName -String type,Contains the alias name
  129. Output parameters :None
  130. Return Type :BOOL
  131. Global Variables :None
  132. Calling Syntax :SetAliasName(pszAliasName)
  133. Notes :None
  134. ------------------------------------------------------------------------*/
  135. BOOL CCommandSwitches::SetAliasName(const _TCHAR* pszAliasName)
  136. {
  137. BOOL bResult = TRUE;
  138. SAFEDELETE(m_pszAliasName);
  139. if (pszAliasName)
  140. {
  141. m_pszAliasName = new _TCHAR [lstrlen(pszAliasName)+1];
  142. if(m_pszAliasName)
  143. lstrcpy(m_pszAliasName, pszAliasName);
  144. else
  145. bResult = FALSE;
  146. }
  147. return bResult;
  148. };
  149. /*------------------------------------------------------------------------
  150. Name :SetAliasDesc
  151. Synopsis :This function sets the alias description
  152. Type :Member Function
  153. Input parameter :
  154. pszAliasName -String type,Contains the alias description
  155. Output parameters :None
  156. Return Type :BOOL
  157. Global Variables :None
  158. Calling Syntax :SetAliasDesc(pszAliasDesc)
  159. Notes :None
  160. ------------------------------------------------------------------------*/
  161. BOOL CCommandSwitches::SetAliasDesc(const _TCHAR* pszAliasDesc)
  162. {
  163. BOOL bResult = TRUE;
  164. SAFEDELETE(m_pszAliasDesc);
  165. if (pszAliasDesc)
  166. {
  167. m_pszAliasDesc = new _TCHAR [lstrlen(pszAliasDesc)+1];
  168. if(m_pszAliasDesc)
  169. lstrcpy(m_pszAliasDesc, pszAliasDesc);
  170. else
  171. bResult = FALSE;
  172. }
  173. return bResult;
  174. };
  175. /*------------------------------------------------------------------------
  176. Name :SetClassPath
  177. Synopsis :This function Assigns the parameter passed to
  178. m_pszClassPath.
  179. Type :Member Function
  180. Input parameter :
  181. pszClassPath -String type,Contains the class path in the command.
  182. Output parameters :None
  183. Return Type :BOOL
  184. Global Variables :None
  185. Calling Syntax :SetClassPath(pszClassPath)
  186. Notes :None
  187. ------------------------------------------------------------------------*/
  188. BOOL CCommandSwitches::SetClassPath(const _TCHAR* pszClassPath)
  189. {
  190. BOOL bResult = TRUE;
  191. SAFEDELETE(m_pszClassPath);
  192. if (pszClassPath)
  193. {
  194. m_pszClassPath = new _TCHAR [lstrlen(pszClassPath)+1];
  195. if(m_pszClassPath)
  196. lstrcpy(m_pszClassPath, pszClassPath);
  197. else
  198. bResult = FALSE;
  199. }
  200. return bResult;
  201. }
  202. /*------------------------------------------------------------------------
  203. Name :SetPathExpression
  204. Synopsis :This function Assigns the parameter passed to m_psz
  205. PathExpr.
  206. Type :Member Function
  207. Input parameter :
  208. pszPathExpr -String type, Contains the path value in the command.
  209. Output parameters :None
  210. Return Type :BOOL
  211. Global Variables :None
  212. Calling Syntax :SetPathExpression(pszPathExpr)
  213. Notes :None
  214. ------------------------------------------------------------------------*/
  215. BOOL CCommandSwitches::SetPathExpression(const _TCHAR* pszPathExpr)
  216. {
  217. BOOL bResult = TRUE;
  218. SAFEDELETE(m_pszPathExpr);
  219. if (pszPathExpr)
  220. {
  221. m_pszPathExpr = new _TCHAR [lstrlen(pszPathExpr)+1];
  222. if(m_pszPathExpr)
  223. lstrcpy(m_pszPathExpr, pszPathExpr);
  224. else
  225. bResult = FALSE;
  226. }
  227. return bResult;
  228. }
  229. /*------------------------------------------------------------------------
  230. Name :SetWhereExpression
  231. Synopsis :This function Assigns the parameter passed to
  232. m_pszWhereExpr.
  233. Type :Member Function
  234. Input parameter :
  235. pszWhereExpr -String type,Contains the where value in the command.
  236. Output parameters :None
  237. Return Type :BOOL
  238. Global Variables :None
  239. Calling Syntax :SetWhereExpression(pszWhereExpr)
  240. Notes :None
  241. ------------------------------------------------------------------------*/
  242. BOOL CCommandSwitches::SetWhereExpression(const _TCHAR* pszWhereExpr)
  243. {
  244. BOOL bResult = TRUE;
  245. SAFEDELETE(m_pszWhereExpr);
  246. if (pszWhereExpr)
  247. {
  248. m_pszWhereExpr = new _TCHAR [lstrlen(pszWhereExpr)+1];
  249. if(m_pszWhereExpr)
  250. lstrcpy(m_pszWhereExpr, pszWhereExpr);
  251. else
  252. bResult = FALSE;
  253. }
  254. return bResult;
  255. }
  256. /*------------------------------------------------------------------------
  257. Name :SetMethodName
  258. Synopsis :This function Assigns the parameter passed to
  259. m_pszMethodName.
  260. Type :Member Function
  261. Input parameter :
  262. pszMethodName -String type,Contains the method specified for the
  263. class
  264. Output parameters :None
  265. Return Type :BOOL
  266. Global Variables :None
  267. Calling Syntax :SetMethodName(pszMethodName)
  268. Notes :None
  269. ------------------------------------------------------------------------*/
  270. BOOL CCommandSwitches::SetMethodName(const _TCHAR* pszMethodName)
  271. {
  272. BOOL bResult = TRUE;
  273. SAFEDELETE(m_pszMethodName);
  274. if (pszMethodName)
  275. {
  276. m_pszMethodName = new _TCHAR [lstrlen(pszMethodName)+1];
  277. if(m_pszMethodName)
  278. lstrcpy(m_pszMethodName, pszMethodName);
  279. else
  280. bResult = FALSE;
  281. }
  282. return bResult;
  283. }
  284. /*------------------------------------------------------------------------
  285. Name :AddToXSLTDetailsVector
  286. Synopsis :This function adds a XSLTDET structure to
  287. m_xdvXSLTDetVec vector.
  288. Type :Member Function
  289. Input parameter :
  290. xdXSLTDet - XSLTDET type specifies the details of XSL transform.
  291. Output parameters :None
  292. Return Type :void
  293. Global Variables :None
  294. Calling Syntax :AddToXSLTDetailsVector(xdXSLTDet)
  295. Notes :None
  296. ------------------------------------------------------------------------*/
  297. void CCommandSwitches::AddToXSLTDetailsVector(XSLTDET xdXSLTDet)
  298. {
  299. try
  300. {
  301. CHString sTemp(LPWSTR(xdXSLTDet.FileName));
  302. CHString sLastFour = sTemp.Right(4);
  303. CHString sXslExt(_T(".xsl"));
  304. WMICLIINT nPos = sLastFour.CompareNoCase(sXslExt);
  305. if (nPos != 0)
  306. {
  307. xdXSLTDet.FileName += _T(".xsl");
  308. }
  309. }
  310. catch(CHeap_Exception)
  311. {
  312. throw OUT_OF_MEMORY;
  313. }
  314. catch(...)
  315. {
  316. _com_issue_error(WBEM_E_OUT_OF_MEMORY);
  317. }
  318. m_xdvXSLTDetVec.push_back(xdXSLTDet);
  319. }
  320. /*------------------------------------------------------------------------
  321. Name :SetVerbName
  322. Synopsis :This function Assigns the parameter passed to
  323. m_pszVerbName.
  324. Type :Member Function
  325. Input parameter :
  326. pszVerbName -String type,Contains the Verbname in the command
  327. Output parameters :None
  328. Return Type :BOOL
  329. Global Variables :None
  330. Calling Syntax :SetVerbName( pszVerbName)
  331. Notes :None
  332. ------------------------------------------------------------------------*/
  333. BOOL CCommandSwitches::SetVerbName(const _TCHAR* pszVerbName)
  334. {
  335. BOOL bResult = TRUE;
  336. SAFEDELETE(m_pszVerb);
  337. if (pszVerbName)
  338. {
  339. m_pszVerb = new _TCHAR [lstrlen(pszVerbName)+1];
  340. if(m_pszVerb)
  341. lstrcpy(m_pszVerb, pszVerbName);
  342. else
  343. bResult = FALSE;
  344. }
  345. return bResult;
  346. };
  347. /*------------------------------------------------------------------------
  348. Name :SetAliasTarget
  349. Synopsis :This function Assigns the parameter passed to
  350. m_pszAliasTarget.
  351. Type :Member Function
  352. Input parameters :
  353. pszAliasTarget -String type,the namespace where alias to
  354. operate against
  355. are available.
  356. Output parameters :None
  357. Return Type :BOOL
  358. Global Variables :None
  359. Calling Syntax :SetAliasTarget(pszAliasTarget)
  360. Notes :None
  361. ------------------------------------------------------------------------*/
  362. BOOL CCommandSwitches::SetAliasTarget(const _TCHAR* pszAliasTarget)
  363. {
  364. BOOL bResult = TRUE;
  365. SAFEDELETE(m_pszAliasTarget);
  366. if (pszAliasTarget)
  367. {
  368. m_pszAliasTarget = new _TCHAR [lstrlen(pszAliasTarget)+1];
  369. if(m_pszAliasTarget)
  370. lstrcpy(m_pszAliasTarget, pszAliasTarget);
  371. else
  372. bResult = FALSE;
  373. }
  374. return bResult;
  375. }
  376. /*------------------------------------------------------------------------
  377. Name :AddToPropertyList
  378. Synopsis :This function Adds string that is passed
  379. through parameter to m_cvproperties, which
  380. is a data member of type BSTRMAP.
  381. Type :Member Function
  382. Input parameter :
  383. pszProperty -String type,Used for storing properties
  384. associated with an alias object.
  385. Output parameters :None
  386. Return Type :BOOL
  387. Global Variables :None
  388. Calling Syntax :AddToPropertyList(pszProperty)
  389. Notes :None
  390. ------------------------------------------------------------------------*/
  391. BOOL CCommandSwitches::AddToPropertyList(_TCHAR* const pszProperty)
  392. {
  393. BOOL bRet = TRUE;
  394. if (pszProperty)
  395. {
  396. try
  397. {
  398. _TCHAR* pszTemp = NULL;
  399. pszTemp = new _TCHAR [lstrlen(pszProperty)+1];
  400. if ( pszTemp != NULL )
  401. {
  402. lstrcpy(pszTemp, pszProperty);
  403. m_cvProperties.push_back(pszTemp);
  404. }
  405. else
  406. bRet = FALSE;
  407. }
  408. catch(...)
  409. {
  410. bRet = FALSE;
  411. }
  412. }
  413. return bRet;
  414. }
  415. /*------------------------------------------------------------------------
  416. Name :AddToPWhereParamsList
  417. Synopsis :This function Stores the parameter passed into
  418. m_cvPWhereParams map array.
  419. Type :Member Function
  420. Input parameter :
  421. pszParameter -string type, Used to store parameters associated
  422. with the verbs
  423. Output parameters :None
  424. Return Type :BOOL
  425. Global Variables :None
  426. Calling Syntax :AddToPWhereParamsList(pszParameter)
  427. Notes :None
  428. ------------------------------------------------------------------------*/
  429. BOOL CCommandSwitches::AddToPWhereParamsList(_TCHAR* const pszParameter)
  430. {
  431. BOOL bRet= TRUE;
  432. if (pszParameter)
  433. {
  434. try
  435. {
  436. _TCHAR* pszTemp = new _TCHAR [lstrlen(pszParameter)+1];
  437. if ( pszTemp != NULL )
  438. {
  439. lstrcpy(pszTemp, pszParameter);
  440. m_cvPWhereParams.push_back(pszTemp);
  441. }
  442. else
  443. bRet = FALSE;
  444. }
  445. catch(...)
  446. {
  447. bRet = FALSE;
  448. }
  449. }
  450. return bRet;
  451. }
  452. /*------------------------------------------------------------------------
  453. Name :AddToParameterMap
  454. Synopsis :This function Adds bstrKey and bstrValue passed as
  455. parameters to m_bmParameters, which is type of
  456. BSTRMAP data structure.
  457. Type :Member Function
  458. Input parameter :
  459. bstrKey -bstr type contains a key value used in MAP file
  460. bstrValue -bstr type contains a value associated with the key
  461. Output parameters :None
  462. Return Type :BOOL
  463. Global Variables :None
  464. Calling Syntax :AddToParameterMap(bstrKey,bstrValue)
  465. Notes :None
  466. ------------------------------------------------------------------------*/
  467. BOOL CCommandSwitches::AddToParameterMap(_bstr_t bstrKey, _bstr_t bstrValue)
  468. {
  469. BOOL bResult = TRUE;
  470. try
  471. {
  472. m_bmParameters.insert(BSTRMAP::value_type(bstrKey, bstrValue));
  473. }
  474. catch(...)
  475. {
  476. bResult = FALSE;
  477. }
  478. return bResult;
  479. }
  480. /*------------------------------------------------------------------------
  481. Name :AddToAliasFormatDetMap
  482. Synopsis :This function Adds bstrKey and bstrValue passed as
  483. parameters to m_bmAliasForamt, which is type of
  484. BSTRMAP data structure.
  485. Type :Member Function
  486. Input parameter :
  487. bstrKey -bstr type contains a key value used in MAP file
  488. bstrValue -bstr type contains a value associated with the key
  489. Output parameters :None
  490. Return Type :BOOL
  491. Global Variables :None
  492. Calling Syntax :AddToAliasFormatDetMap(bstrKey,bvProps)
  493. Notes :None
  494. ------------------------------------------------------------------------*/
  495. BOOL CCommandSwitches::AddToAliasFormatDetMap(_bstr_t bstrKey, BSTRVECTOR bvProps)
  496. {
  497. BOOL bResult = TRUE;
  498. try
  499. {
  500. m_afdAlsFmtDet.insert(ALSFMTDETMAP::value_type(bstrKey, bvProps));
  501. }
  502. catch(...)
  503. {
  504. bResult = FALSE;
  505. }
  506. return bResult;
  507. }
  508. /*------------------------------------------------------------------------
  509. Name :UpdateParameterValue
  510. Synopsis :This function Updates bstrKey and bstrValue
  511. passed as parameters to m_bmParameters, which
  512. is type of BSTRMAP data structure.
  513. Type :Member Function
  514. Input parameter :
  515. bstrKey -bstr type contains a key value used in MAP file
  516. bstrValue -bstr type contains a value associated with the key
  517. Output parameters :None
  518. Return Type :BOOL
  519. Global Variables :None
  520. Calling Syntax :UpdateParameterValue(bstrKey,bstrValue)
  521. Notes :None
  522. ------------------------------------------------------------------------*/
  523. BOOL CCommandSwitches::UpdateParameterValue(_bstr_t bstrKey, _bstr_t bstrValue)
  524. {
  525. BOOL bResult = TRUE;
  526. try
  527. {
  528. m_bmParameters[bstrKey] = bstrValue;
  529. }
  530. catch(...)
  531. {
  532. bResult = FALSE;
  533. }
  534. return bResult;
  535. }
  536. /*------------------------------------------------------------------------
  537. Name :AddToAlsFrnNmsOrTrnsTblMap
  538. Synopsis :This function Adds bstrKey and bstrValue passed
  539. as parameters to m_bmAlsFrnNmsDesOrTrnsTblEntrs,
  540. which is type of BSTRMAP.
  541. Type :Member Function
  542. Input parameter :
  543. bstrKey -bstr type contains a key value used in MAP file
  544. bstrValue -bstr type contains a value associated with the key
  545. Output parameters :None
  546. Return Type :BOOL
  547. Global Variables :None
  548. Calling Syntax :AddToAlsFrnNmsOrTrnsTblMap(bstrKey,bstrValue)
  549. Notes :None
  550. ------------------------------------------------------------------------*/
  551. BOOL CCommandSwitches::AddToAlsFrnNmsOrTrnsTblMap(_bstr_t bstrKey,
  552. _bstr_t bstrValue)
  553. {
  554. BOOL bResult = TRUE;
  555. try
  556. {
  557. m_bmAlsFrnNmsDesOrTrnsTblEntrs.
  558. insert(BSTRMAP::value_type(bstrKey, bstrValue));
  559. }
  560. catch(...)
  561. {
  562. bResult = FALSE;
  563. }
  564. return bResult;
  565. }
  566. /*------------------------------------------------------------------------
  567. Name :AddToMethDetMap
  568. Synopsis :This function Adds bstrKey and mdMethDet passed as
  569. parameters to m_mdmMethDet, which is type of METHDETMAP.
  570. Type :Member Function
  571. Input parameter :
  572. bstrKey -bstr type contains a key value used in MAP file
  573. mdMethDet -METTHODDETAILS type contains the method attributes.
  574. Output parameters :None
  575. Return Type :BOOL
  576. Global Variables :None
  577. Calling Syntax :AddToMethDetMap(bstrKey,mdMethDet)
  578. Notes :None
  579. ------------------------------------------------------------------------*/
  580. BOOL CCommandSwitches::AddToMethDetMap(_bstr_t bstrKey,
  581. METHODDETAILS mdMethDet)
  582. {
  583. BOOL bResult = TRUE;
  584. try
  585. {
  586. m_mdmMethDet.insert(METHDETMAP::value_type(bstrKey, mdMethDet));
  587. }
  588. catch(...)
  589. {
  590. bResult = FALSE;
  591. }
  592. return bResult;
  593. }
  594. /*------------------------------------------------------------------------
  595. Name :AddToPropDetMap
  596. Synopsis :This function Adds bstrKey and pdPropDet passed as
  597. parameters to m_pdmPropDet,
  598. which is type of PROPDETMAP.
  599. Type :Member Function
  600. Input parameter :
  601. bstrKey - bstr type contains a key value used in MAP file
  602. pdPropDet - PROPERTYDETAILS type contains a value associated with
  603. the key
  604. Output parameters :None
  605. Return Type :BOOL
  606. Global Variables :None
  607. Calling Syntax :AddToPropDetMap(bstrKey,pdPropDet)
  608. Notes :None
  609. ------------------------------------------------------------------------*/
  610. BOOL CCommandSwitches::AddToPropDetMap(_bstr_t bstrKey,
  611. PROPERTYDETAILS pdPropDet)
  612. {
  613. BOOL bResult = TRUE;
  614. try
  615. {
  616. m_pdmPropDet.insert(PROPDETMAP::value_type(bstrKey, pdPropDet));
  617. }
  618. catch(...)
  619. {
  620. bResult = FALSE;
  621. }
  622. return bResult;
  623. }
  624. /*------------------------------------------------------------------------
  625. Name :SetXMLResultSet
  626. Synopsis :This function Assigns the parameter passed to
  627. m_bstrXML.
  628. Type :Member Function
  629. Input parameter :
  630. bstrXMLResultSet -BSTR type,XML file name containing result set.
  631. Output parameters :None
  632. Return Type :BOOL
  633. Global Variables :None
  634. Calling Syntax :SetXMLResultSet(bstrXMLResultSet)
  635. Notes :None
  636. ------------------------------------------------------------------------*/
  637. BOOL CCommandSwitches::SetXMLResultSet(const BSTR bstrXMLResultSet)
  638. {
  639. BOOL bResult = TRUE;
  640. SAFEBSTRFREE(m_bstrXML);
  641. if (bstrXMLResultSet != NULL)
  642. {
  643. try
  644. {
  645. m_bstrXML = SysAllocString(bstrXMLResultSet);
  646. }
  647. catch(...)
  648. {
  649. bResult = FALSE;
  650. }
  651. }
  652. return bResult;
  653. }
  654. /*------------------------------------------------------------------------
  655. Name :SetSuccessFlag
  656. Synopsis :This function Assigns the Boolean variable to
  657. m_bSuccess.
  658. Type :Member Function
  659. Input parameter :
  660. bSuccess -Boolean type,Specifies whether success or failure
  661. Output parameters :None
  662. Return Type :BOOL
  663. Global Variables :None
  664. Calling Syntax :SetSuccessFlag(bSuccess)
  665. Notes :None
  666. ------------------------------------------------------------------------*/
  667. void CCommandSwitches::SetSuccessFlag(BOOL bSuccess)
  668. {
  669. m_bSuccess = bSuccess;
  670. }
  671. /*------------------------------------------------------------------------
  672. Name :SetRetrievalInterval
  673. Synopsis :This function Assigns the integer value to m_nInterval.
  674. Type :Member Function
  675. Input parameter :
  676. ulInterval - unsigned long type,Specifies the time interval
  677. given by the EVERY switch in GET verb.
  678. Output parameters :None
  679. Return Type :BOOL
  680. Global Variables :None
  681. Calling Syntax :SetRetrievalInterval(lInterval)
  682. Notes :None
  683. ------------------------------------------------------------------------*/
  684. BOOL CCommandSwitches::SetRetrievalInterval(const ULONG ulInterval)
  685. {
  686. m_ulInterval = ulInterval;
  687. // Reset the repeat count
  688. m_ulRepeatCount = 0;
  689. return TRUE;
  690. }
  691. /*------------------------------------------------------------------------
  692. Name :SetTranslateTableName
  693. Synopsis :This function Assigns the string variable to
  694. m_pszTransTableName.
  695. Type :Member Function
  696. Input parameter :
  697. pszTransTableName - String type,Specifies the occurrence of
  698. TRANSLATE switch and TABLE Name in the command for GET
  699. verb.
  700. Output parameters :None
  701. Return Type :BOOL
  702. Global Variables :None
  703. Calling Syntax :SetTranslateTableName(pszTranstableName)
  704. Notes :None
  705. ------------------------------------------------------------------------*/
  706. BOOL CCommandSwitches::SetTranslateTableName(const _TCHAR* pszTransTableName)
  707. {
  708. BOOL bResult = TRUE;
  709. SAFEDELETE(m_pszTransTableName);
  710. if (pszTransTableName)
  711. {
  712. m_pszTransTableName = new _TCHAR [lstrlen(pszTransTableName)+1];
  713. if(m_pszTransTableName)
  714. lstrcpy(m_pszTransTableName,pszTransTableName);
  715. else
  716. bResult = FALSE;
  717. }
  718. return bResult;
  719. }
  720. /*------------------------------------------------------------------------
  721. Name :SetListFormat
  722. Synopsis :This function Assigns the parameter value to
  723. m_pszListFormat.
  724. Type :Member Function
  725. Input parameter :
  726. pszListFormat -LISTFORMAT type, Specifies the list format
  727. specified in the command.
  728. Output parameters :None
  729. Return Type :BOOL
  730. Global Variables :None
  731. Calling Syntax :SetListFormat(pszListFormat)
  732. Notes :None
  733. ------------------------------------------------------------------------*/
  734. BOOL CCommandSwitches::SetListFormat(const _TCHAR *pszListFormat)
  735. {
  736. BOOL bResult = TRUE;
  737. SAFEDELETE(m_pszListFormat);
  738. if (pszListFormat)
  739. {
  740. m_pszListFormat = new _TCHAR [lstrlen(pszListFormat)+1];
  741. if(m_pszListFormat)
  742. lstrcpy(m_pszListFormat,pszListFormat);
  743. else
  744. bResult = FALSE;
  745. }
  746. return bResult;
  747. }
  748. /*------------------------------------------------------------------------
  749. Name :SetInteractiveMode
  750. Synopsis :This function sets the verb execution interactive mode
  751. Type :Member Function
  752. Input parameter :
  753. bInteractiveMode -integer, sets or resets the verb execution interactive
  754. mode
  755. Output parameters :None
  756. Return Type :void
  757. Global Variables :None
  758. Calling Syntax :SetInteractiveMode(nInteractiveMode)
  759. Notes :None
  760. ------------------------------------------------------------------------*/
  761. void CCommandSwitches::SetInteractiveMode(WMICLIINT nInteractiveMode)
  762. {
  763. m_nInteractiveMode = nInteractiveMode;
  764. }
  765. /*------------------------------------------------------------------------
  766. Name :SetErrataCode
  767. Synopsis :This function sets the error code.
  768. Type :Member Function
  769. Input parameter :
  770. uErrataCode -Unsignedinttype, specifies the error code.
  771. Output parameters :None
  772. Return Type :None
  773. Global Variables :None
  774. Calling Syntax :SetErrataCode(uErrataCode)
  775. Notes :None
  776. ------------------------------------------------------------------------*/
  777. void CCommandSwitches::SetErrataCode(const UINT uErrataCode)
  778. {
  779. m_uErrataCode = uErrataCode;
  780. }
  781. /*------------------------------------------------------------------------
  782. Name :SetRepeatCount
  783. Synopsis :This function sets the repeat count.
  784. Type :Member Function
  785. Input parameter :
  786. uRepCount - Unsigned inttype, specifies the repeat count.
  787. Output parameters :None
  788. Return Type :BOOL
  789. Global Variables :None
  790. Calling Syntax :SetRepeatCount(uRepCount)
  791. Notes :None
  792. ------------------------------------------------------------------------*/
  793. BOOL CCommandSwitches::SetRepeatCount(const ULONG ulRepCount)
  794. {
  795. m_ulRepeatCount = ulRepCount;
  796. return TRUE;
  797. }
  798. /*------------------------------------------------------------------------
  799. Name :SetInformationCode
  800. Synopsis :This function sets the message code.
  801. Type :Member Function
  802. Input parameter :
  803. uInformationCode -Unsignedinttype, specifies the information code.
  804. Output parameters :None
  805. Return Type :BOOL
  806. Global Variables :None
  807. Calling Syntax :SetInformationCode(uInformationCode)
  808. Notes :None
  809. ------------------------------------------------------------------------*/
  810. void CCommandSwitches::SetInformationCode(const UINT uInformationCode)
  811. {
  812. m_uInformationCode = uInformationCode;
  813. }
  814. /*------------------------------------------------------------------------
  815. Name :SetPWhereExpr
  816. Synopsis :This function Assigns the parameter passed to
  817. m_pszPWhereExpr that represents Alias's PWhere string
  818. Type :Member Function
  819. Input parameter :
  820. pszPWhereExpr -String type,Contains the PWhere expr.
  821. Output parameters :None
  822. Return Type :BOOL
  823. Global Variables :None
  824. Calling Syntax :SetPWhereExpr(pszPWhereExpr)
  825. Notes :None
  826. ------------------------------------------------------------------------*/
  827. BOOL CCommandSwitches::SetPWhereExpr(const _TCHAR* pszPWhereExpr)
  828. {
  829. BOOL bResult = TRUE;
  830. SAFEDELETE(m_pszPWhereExpr);
  831. if (pszPWhereExpr)
  832. {
  833. m_pszPWhereExpr = new _TCHAR [lstrlen(pszPWhereExpr)+1];
  834. if(m_pszPWhereExpr)
  835. lstrcpy(m_pszPWhereExpr, pszPWhereExpr);
  836. else
  837. bResult = FALSE;
  838. }
  839. return bResult;
  840. }
  841. /*------------------------------------------------------------------------
  842. Name :SetCOMError
  843. Synopsis :This function Assigns the parameter passed to
  844. m_pComError that consist of error info
  845. Type :Member Function
  846. Input parameter :
  847. rComError -object of _com_error which consist of error info
  848. Output parameters :None
  849. Return Type :void
  850. Global Variables :None
  851. Calling Syntax :SetCOMError(rComError)
  852. Notes :None
  853. ------------------------------------------------------------------------*/
  854. void CCommandSwitches::SetCOMError(_com_error& rComError)
  855. {
  856. BOOL bResult = TRUE;
  857. FreeCOMError();
  858. m_pComError = new _com_error(rComError);
  859. // memory allocation failed.
  860. if (m_pComError == NULL)
  861. _com_issue_error(WBEM_E_OUT_OF_MEMORY);
  862. }
  863. /*------------------------------------------------------------------------
  864. Name :SetAliasUser
  865. Synopsis :This function sets the alias user
  866. Type :Member Function
  867. Input parameter :
  868. pszUser - user name.
  869. Output parameters :None
  870. Return Type :BOOL
  871. Global Variables :None
  872. Calling Syntax :SetAliasUser()
  873. ------------------------------------------------------------------------*/
  874. BOOL CCommandSwitches::SetAliasUser(const _TCHAR* pszUser)
  875. {
  876. BOOL bResult = TRUE;
  877. SAFEDELETE(m_pszUser);
  878. if (pszUser)
  879. {
  880. m_pszUser = new _TCHAR [lstrlen(pszUser)+1];
  881. if(m_pszUser)
  882. lstrcpy(m_pszUser, pszUser);
  883. else
  884. bResult = FALSE;
  885. }
  886. return bResult;
  887. }
  888. /*------------------------------------------------------------------------
  889. Name :SetAliasNode
  890. Synopsis :This function sets the alias node
  891. Type :Member Function
  892. Input parameter :
  893. pszNode - node name.
  894. Output parameters :None
  895. Return Type :BOOL
  896. Global Variables :None
  897. Calling Syntax :SetAliasNode()
  898. ------------------------------------------------------------------------*/
  899. BOOL CCommandSwitches::SetAliasNode(const _TCHAR* pszNode)
  900. {
  901. BOOL bResult = TRUE;
  902. SAFEDELETE(m_pszNode);
  903. if (pszNode)
  904. {
  905. m_pszNode = new _TCHAR [lstrlen(pszNode)+1];
  906. if(m_pszNode)
  907. lstrcpy(m_pszNode, pszNode);
  908. else
  909. bResult = FALSE;
  910. }
  911. return bResult;
  912. }
  913. /*------------------------------------------------------------------------
  914. Name :SetAliasPassword
  915. Synopsis :This function sets the alias password
  916. Type :Member Function
  917. Input parameter :
  918. pszPassword - password
  919. Output parameters :None
  920. Return Type :BOOL
  921. Global Variables :None
  922. Calling Syntax :SetAliasPassword()
  923. ------------------------------------------------------------------------*/
  924. BOOL CCommandSwitches::SetAliasPassword(const _TCHAR* pszPassword)
  925. {
  926. BOOL bResult = TRUE;
  927. SAFEDELETE(m_pszPassword);
  928. if (pszPassword)
  929. {
  930. m_pszPassword = new _TCHAR [lstrlen(pszPassword)+1];
  931. if(m_pszPassword)
  932. lstrcpy(m_pszPassword, pszPassword);
  933. else
  934. bResult = FALSE;
  935. }
  936. return bResult;
  937. }
  938. /*------------------------------------------------------------------------
  939. Name :SetAliasLocale
  940. Synopsis :This function sets the alias locale
  941. Type :Member Function
  942. Input parameter :
  943. pszLocale - locale value
  944. Output parameters :None
  945. Return Type :BOOL
  946. Global Variables :None
  947. Calling Syntax :SetAliasLocale()
  948. ------------------------------------------------------------------------*/
  949. BOOL CCommandSwitches::SetAliasLocale(const _TCHAR* pszLocale)
  950. {
  951. BOOL bResult = TRUE;
  952. SAFEDELETE(m_pszLocale);
  953. if (pszLocale)
  954. {
  955. m_pszLocale = new _TCHAR [lstrlen(pszLocale)+1];
  956. if(m_pszLocale)
  957. lstrcpy(m_pszLocale, pszLocale);
  958. else
  959. bResult = FALSE;
  960. }
  961. return bResult;
  962. }
  963. /*------------------------------------------------------------------------
  964. Name :SetAliasNamespace
  965. Synopsis :This function sets the alias namespace
  966. Type :Member Function
  967. Input parameter :
  968. pszNamespace - namespace
  969. Output parameters :None
  970. Return Type :BOOL
  971. Global Variables :None
  972. Calling Syntax :SetAliasNamespace()
  973. ------------------------------------------------------------------------*/
  974. BOOL CCommandSwitches::SetAliasNamespace(const _TCHAR* pszNamespace)
  975. {
  976. BOOL bResult = TRUE;
  977. SAFEDELETE(m_pszNamespace);
  978. if (pszNamespace)
  979. {
  980. m_pszNamespace = new _TCHAR [lstrlen(pszNamespace)+1];
  981. if(m_pszNamespace)
  982. lstrcpy(m_pszNamespace, pszNamespace);
  983. else
  984. bResult = FALSE;
  985. }
  986. return bResult;
  987. }
  988. /*------------------------------------------------------------------------
  989. Name :SetMethExecOutParam
  990. Synopsis :This function sets the parameter
  991. m_pIMethExecOutParam.
  992. Type :Member Function
  993. Input parameter :
  994. IWbemClassObject*-pIMethOutputParam
  995. Output parameters :None
  996. Return Type :BOOL
  997. Global Variables :None
  998. Calling Syntax :SetMethExecOutParam(pIMethOutParam)
  999. Notes :None
  1000. ------------------------------------------------------------------------*/
  1001. BOOL CCommandSwitches::SetMethExecOutParam(IWbemClassObject* pIMethOutParam)
  1002. {
  1003. BOOL bSuccess = TRUE;
  1004. SAFEIRELEASE(m_pIMethOutParam);
  1005. if (pIMethOutParam)
  1006. {
  1007. try
  1008. {
  1009. m_pIMethOutParam = pIMethOutParam;
  1010. m_pIMethOutParam->AddRef();
  1011. }
  1012. catch(...)
  1013. {
  1014. bSuccess = FALSE;
  1015. }
  1016. }
  1017. return bSuccess;
  1018. }
  1019. /*------------------------------------------------------------------------
  1020. Name :SetVerbType
  1021. Synopsis :This function sets the parameter
  1022. m_vtVerbType.
  1023. Type :Member Function
  1024. Input parameter :
  1025. vtVerbType - vtVerbType
  1026. Output parameters :None
  1027. Return Type :void
  1028. Global Variables :None
  1029. Calling Syntax :SetVerbType(vtVerbType)
  1030. Notes :None
  1031. ------------------------------------------------------------------------*/
  1032. void CCommandSwitches::SetVerbType(VERBTYPE vtVerbType)
  1033. {
  1034. m_vtVerbType = vtVerbType;
  1035. }
  1036. /*------------------------------------------------------------------------
  1037. Name :SetVerbDerivation
  1038. Synopsis :This function sets the verb derivation
  1039. Type :Member Function
  1040. Input parameter :
  1041. pszVerbDerivation - Derivation associated with the verb.
  1042. Output parameters :None
  1043. Return Type :BOOL
  1044. Global Variables :None
  1045. Calling Syntax :CCmdAlias::ObtainAliasVerbDetails()
  1046. ------------------------------------------------------------------------*/
  1047. BOOL CCommandSwitches::SetVerbDerivation(const _TCHAR* pszVerbDerivation)
  1048. {
  1049. BOOL bResult = TRUE;
  1050. SAFEDELETE(m_pszVerbDerivation);
  1051. if (pszVerbDerivation)
  1052. {
  1053. m_pszVerbDerivation = new _TCHAR [lstrlen(pszVerbDerivation)+1];
  1054. if(m_pszVerbDerivation)
  1055. lstrcpy(m_pszVerbDerivation, pszVerbDerivation);
  1056. else
  1057. bResult = FALSE;
  1058. }
  1059. return bResult;
  1060. }
  1061. /*------------------------------------------------------------------------
  1062. Name :GetCommandInput
  1063. Synopsis :This function Returns the command input held by
  1064. the Command Switches object
  1065. Type :Member Function
  1066. Input parameter :None
  1067. Output parameters :None
  1068. Return Type :_TCHAR*
  1069. Global Variables :None
  1070. Calling Syntax :GetCommandInput()
  1071. Notes :None
  1072. ------------------------------------------------------------------------*/
  1073. _TCHAR* CCommandSwitches::GetCommandInput()
  1074. {
  1075. return m_pszCommandInput;
  1076. }
  1077. /*------------------------------------------------------------------------
  1078. Name :GetAliasName()
  1079. Synopsis :This function Returns the alias name held by the
  1080. command switches object
  1081. Type :Member Function
  1082. Input parameter :None
  1083. Output parameters :None
  1084. Return Type :_TCHAR*
  1085. Global Variables :None
  1086. Calling Syntax :GetAliasName()
  1087. Notes :None
  1088. ------------------------------------------------------------------------*/
  1089. _TCHAR* CCommandSwitches::GetAliasName()
  1090. {
  1091. return m_pszAliasName;
  1092. }
  1093. /*------------------------------------------------------------------------
  1094. Name :GetAliasDesc()
  1095. Synopsis :This function Returns the alias description
  1096. Type :Member Function
  1097. Input parameter :None
  1098. Output parameters :None
  1099. Return Type :_TCHAR*
  1100. Global Variables :None
  1101. Calling Syntax :GetAliasDesc()
  1102. Notes :None
  1103. ------------------------------------------------------------------------*/
  1104. _TCHAR* CCommandSwitches::GetAliasDesc()
  1105. {
  1106. return m_pszAliasDesc;
  1107. }
  1108. /*------------------------------------------------------------------------
  1109. Name :GetClassPath
  1110. Synopsis :This function Returns the class path held by the
  1111. command switches object
  1112. Type :Member Function
  1113. Input parameter :None
  1114. Output parameters :None
  1115. Return Type :_TCHAR*
  1116. Global Variables :None
  1117. Calling Syntax :GetClassPath()
  1118. Notes :None
  1119. ------------------------------------------------------------------------*/
  1120. _TCHAR* CCommandSwitches::GetClassPath()
  1121. {
  1122. return m_pszClassPath;
  1123. }
  1124. /*------------------------------------------------------------------------
  1125. Name :GetPathExpression
  1126. Synopsis :This function Returns the path expression held
  1127. by the command switches object
  1128. Type :Member Function
  1129. Input parameter :None
  1130. Output parameters :None
  1131. Return Type :_TCHAR*
  1132. Global Variables :None
  1133. Calling Syntax :GetPathExpression()
  1134. Notes :None
  1135. ------------------------------------------------------------------------*/
  1136. _TCHAR* CCommandSwitches::GetPathExpression()
  1137. {
  1138. return m_pszPathExpr;
  1139. }
  1140. /*------------------------------------------------------------------------
  1141. Name :GetWhereExpression
  1142. Synopsis :This function Returns the where expression
  1143. held by the command switches object
  1144. Type :Member Function
  1145. Input parameter :None
  1146. Output parameters :None
  1147. Return Type :_TCHAR*
  1148. Global Variables :None
  1149. Calling Syntax :GetWhereExpression()
  1150. Notes :None
  1151. ------------------------------------------------------------------------*/
  1152. _TCHAR* CCommandSwitches::GetWhereExpression()
  1153. {
  1154. return m_pszWhereExpr;
  1155. }
  1156. /*------------------------------------------------------------------------
  1157. Name :GetMethodName()
  1158. Synopsis :This function Returns the method name held by the
  1159. command switches object
  1160. Type :Member Function
  1161. Input parameter :None
  1162. Output parameters :None
  1163. Return Type :_TCHAR*
  1164. Global Variables :None
  1165. Calling Syntax :GetMethodName()
  1166. Notes :None
  1167. ------------------------------------------------------------------------*/
  1168. _TCHAR* CCommandSwitches::GetMethodName()
  1169. {
  1170. return m_pszMethodName;
  1171. }
  1172. /*------------------------------------------------------------------------
  1173. Name :GetXSLTDetailsVector
  1174. Synopsis :This function Returns the XSLTDETVECTOR held by
  1175. the command switches object.
  1176. Type :Member Function
  1177. Input parameter :None
  1178. Output parameters :None
  1179. Return Type :XSLTDETVECTOR
  1180. Global Variables :None
  1181. Calling Syntax :GetXSLTDetailsVector()
  1182. Notes :None
  1183. ------------------------------------------------------------------------*/
  1184. XSLTDETVECTOR& CCommandSwitches::GetXSLTDetailsVector()
  1185. {
  1186. return m_xdvXSLTDetVec;
  1187. }
  1188. /*------------------------------------------------------------------------
  1189. Name :GetVerbName
  1190. Synopsis :This function Returns the verb name held by the
  1191. command switches object
  1192. Type :Member Function
  1193. Input parameter :None
  1194. Output parameters :None
  1195. Return Type :_TCHAR*
  1196. Global Variables :None
  1197. Calling Syntax :GetVerbName()
  1198. Notes :None
  1199. ------------------------------------------------------------------------*/
  1200. _TCHAR* CCommandSwitches::GetVerbName()
  1201. {
  1202. return m_pszVerb;
  1203. }
  1204. /*------------------------------------------------------------------------
  1205. Name :GetAliasTarget
  1206. Synopsis :This function Returns the alias target held by
  1207. the command switches object
  1208. Type :Member Function
  1209. Input parameter :None
  1210. Output parameters :None
  1211. Return Type :_TCHAR*
  1212. Global Variables :None
  1213. Calling Syntax :GetAliasTarget()
  1214. Notes :None
  1215. ------------------------------------------------------------------------*/
  1216. _TCHAR* CCommandSwitches::GetAliasTarget()
  1217. {
  1218. return m_pszAliasTarget;
  1219. }
  1220. /*------------------------------------------------------------------------
  1221. Name :GetXMLResultSet
  1222. Synopsis :This function Returns the XML result set
  1223. held by the command switches object.
  1224. Type :Member Function
  1225. Input parameter :None
  1226. Output parameters :None
  1227. Return Type :BSTR
  1228. Global Variables :None
  1229. Calling Syntax :GetXMLResultSet()
  1230. Notes :None
  1231. ------------------------------------------------------------------------*/
  1232. BSTR CCommandSwitches::GetXMLResultSet()
  1233. {
  1234. return m_bstrXML;
  1235. }
  1236. /*------------------------------------------------------------------------
  1237. Name :GetPropertyList
  1238. Synopsis :This function Returns the property held by the
  1239. command switches object.
  1240. Type :Member Function
  1241. Input parameter :None
  1242. Output parameters :None
  1243. Return Type :CHARVECTOR&
  1244. Global Variables :None
  1245. Calling Syntax :GetPropertyList()
  1246. Notes :None
  1247. ------------------------------------------------------------------------*/
  1248. CHARVECTOR& CCommandSwitches::GetPropertyList()
  1249. {
  1250. return m_cvProperties;
  1251. }
  1252. /*------------------------------------------------------------------------
  1253. Name :GetPWhereParamsList
  1254. Synopsis :This function Returns the PWhereParameters list held
  1255. by the command switches object.
  1256. Type :Member Function
  1257. Input parameter :None
  1258. Output parameters :None
  1259. Return Type :CHARVECTOR&
  1260. Global Variables :None
  1261. Calling Syntax :GetPWhereParamsList()
  1262. Notes :None
  1263. ------------------------------------------------------------------------*/
  1264. CHARVECTOR& CCommandSwitches::GetPWhereParamsList()
  1265. {
  1266. return m_cvPWhereParams;
  1267. }
  1268. /*------------------------------------------------------------------------
  1269. Name :GetAlsFrnNmsOrTrnsTblMap
  1270. Synopsis :This function Returns the alias friendly names map
  1271. held by the command switches object
  1272. Type :Member Function
  1273. Input parameter :None
  1274. Output parameters :None
  1275. Return Type :BSTRMAP&
  1276. Global Variables :None
  1277. Calling Syntax :GetAlsFrnNmsOrTrnsTblMap()
  1278. Notes :None
  1279. ------------------------------------------------------------------------*/
  1280. BSTRMAP& CCommandSwitches::GetAlsFrnNmsOrTrnsTblMap()
  1281. {
  1282. return m_bmAlsFrnNmsDesOrTrnsTblEntrs;
  1283. }
  1284. /*------------------------------------------------------------------------
  1285. Name :GetMethDetMap
  1286. Synopsis :This function Returns the method or verb details
  1287. map held by the command switches object
  1288. Type :Member Function
  1289. Input parameter :None
  1290. Output parameters :None
  1291. Return Type :METHDETMAP&
  1292. Global Variables :None
  1293. Calling Syntax :GetMethDetMap()
  1294. Notes :None
  1295. ------------------------------------------------------------------------*/
  1296. METHDETMAP& CCommandSwitches::GetMethDetMap()
  1297. {
  1298. return m_mdmMethDet;
  1299. }
  1300. /*------------------------------------------------------------------------
  1301. Name :GetPropDetMap
  1302. Synopsis :This function Returns the prop details map held by
  1303. the command switches object.
  1304. Type :Member Function
  1305. Input parameter :None
  1306. Output parameters :None
  1307. Return Type :PROPDETMAP&
  1308. Global Variables :None
  1309. Calling Syntax :GetPropDetMap()
  1310. Notes :None
  1311. ------------------------------------------------------------------------*/
  1312. PROPDETMAP& CCommandSwitches::GetPropDetMap()
  1313. {
  1314. return m_pdmPropDet;
  1315. }
  1316. /*------------------------------------------------------------------------
  1317. Name :GetParameterMap
  1318. Synopsis :This function Returns the parameter map containing
  1319. both key and value held by the command switches object
  1320. Type :Member Function
  1321. Input parameter :None
  1322. Output parameters :None
  1323. Return Type :BSTRMAP&
  1324. Global Variables :None
  1325. Calling Syntax :GetParameterMap()
  1326. Notes :None
  1327. ------------------------------------------------------------------------*/
  1328. BSTRMAP& CCommandSwitches::GetParameterMap()
  1329. {
  1330. return m_bmParameters;
  1331. }
  1332. /*------------------------------------------------------------------------
  1333. Name :GetAliasFormatDetMap
  1334. Synopsis :This function Returns the alias formats available
  1335. Type :Member Function
  1336. Input parameter :None
  1337. Output parameters :None
  1338. Return Type :ALSFMTDETMAP&
  1339. Global Variables :None
  1340. Calling Syntax :GetAliasFormatDetMap()
  1341. Notes :None
  1342. ------------------------------------------------------------------------*/
  1343. ALSFMTDETMAP& CCommandSwitches::GetAliasFormatDetMap()
  1344. {
  1345. return m_afdAlsFmtDet;
  1346. }
  1347. /*------------------------------------------------------------------------
  1348. Name :GetSuccessFlag
  1349. Synopsis :This function Returns the success flag held by
  1350. the command switches object
  1351. Type :Member Function
  1352. Input parameter :None
  1353. Output parameters :None
  1354. Return Type :BOOL
  1355. Global Variables :None
  1356. Calling Syntax :GetSuccessFlag()
  1357. Notes :None
  1358. ------------------------------------------------------------------------*/
  1359. BOOL CCommandSwitches::GetSuccessFlag()
  1360. {
  1361. return m_bSuccess;
  1362. }
  1363. /*------------------------------------------------------------------------
  1364. Name :GetRetrievalInterval
  1365. Synopsis :This function Returns the value of m_ulInterval held
  1366. by the command switches object
  1367. Type :Member Function
  1368. Input parameter :None
  1369. Output parameters :None
  1370. Return Type :ULONG
  1371. Global Variables :None
  1372. Calling Syntax :GetRetrievalInterval()
  1373. Notes :None
  1374. ------------------------------------------------------------------------*/
  1375. ULONG CCommandSwitches::GetRetrievalInterval()
  1376. {
  1377. return m_ulInterval;
  1378. }
  1379. /*------------------------------------------------------------------------
  1380. Name :GetTranslateTableName
  1381. Synopsis :This function Returns the content of m_pszTransTableName
  1382. held by the command switches object.
  1383. Type :Member Function
  1384. Input parameter :None
  1385. Output parameters :None
  1386. Return Type :_TCHAR*
  1387. Global Variables :None
  1388. Calling Syntax :GetTranslateTableName()
  1389. Notes :None
  1390. ------------------------------------------------------------------------*/
  1391. _TCHAR* CCommandSwitches::GetTranslateTableName()
  1392. {
  1393. return m_pszTransTableName;
  1394. }
  1395. /*------------------------------------------------------------------------
  1396. Name :GetListFormat
  1397. Synopsis :This function Returns the list format type
  1398. m_pszListFormat held by the command switches object
  1399. Type :Member Function
  1400. Input parameter :None
  1401. Output parameters :None
  1402. Return Type :_TCHAR*
  1403. Global Variables :None
  1404. Calling Syntax :GetListFormat()
  1405. Notes :None
  1406. ------------------------------------------------------------------------*/
  1407. _TCHAR* CCommandSwitches::GetListFormat()
  1408. {
  1409. return m_pszListFormat;
  1410. }
  1411. /*------------------------------------------------------------------------
  1412. Name :GetInteractiveMode
  1413. Synopsis :This function Returns the interactive mode flag
  1414. m_bInteractiveMode held by the command switches object
  1415. Type :Member Function
  1416. Input parameter :None
  1417. Output parameters :None
  1418. Return Type :WMICLINT
  1419. Global Variables :None
  1420. Calling Syntax :GetInteractiveMode()
  1421. Notes :None
  1422. ------------------------------------------------------------------------*/
  1423. WMICLIINT CCommandSwitches::GetInteractiveMode()
  1424. {
  1425. return m_nInteractiveMode;
  1426. }
  1427. /*------------------------------------------------------------------------
  1428. Name :GetClassOfAliasTarget
  1429. Synopsis :This function gets the class of Alias
  1430. Type :Member Function
  1431. Input parameter :Reference to bstrClassName
  1432. Output parameters :bstrClassName
  1433. Return Type :None
  1434. Global Variables :None
  1435. Calling Syntax :GetClassOfAliasTarget(bstrClassName)
  1436. Notes :None
  1437. ------------------------------------------------------------------------*/
  1438. void CCommandSwitches::GetClassOfAliasTarget(_bstr_t& bstrClassName)
  1439. {
  1440. _TCHAR *pszTemp;
  1441. try
  1442. {
  1443. if (m_pszAliasTarget != NULL )
  1444. {
  1445. pszTemp = new _TCHAR[lstrlen(m_pszAliasTarget)+1];
  1446. if ( pszTemp != NULL )
  1447. {
  1448. lstrcpy(pszTemp, m_pszAliasTarget);
  1449. _TCHAR* pszToken = NULL;
  1450. pszToken = _tcstok(pszTemp, CLI_TOKEN_SPACE);
  1451. while (pszToken != NULL)
  1452. {
  1453. bstrClassName = _bstr_t(pszToken);
  1454. pszToken = _tcstok(NULL, CLI_TOKEN_SPACE);
  1455. if(CompareTokens(pszToken,CLI_TOKEN_FROM))
  1456. {
  1457. bstrClassName = _bstr_t(pszToken);
  1458. pszToken = _tcstok(NULL, CLI_TOKEN_SPACE);
  1459. if (pszToken != NULL)
  1460. {
  1461. bstrClassName = _bstr_t(pszToken);
  1462. break;
  1463. }
  1464. }
  1465. }
  1466. SAFEDELETE(pszTemp);
  1467. }
  1468. else
  1469. _com_issue_error(WBEM_E_OUT_OF_MEMORY);
  1470. }
  1471. }
  1472. catch(_com_error& e)
  1473. {
  1474. SAFEDELETE(pszTemp);
  1475. _com_issue_error(e.Error());
  1476. }
  1477. }
  1478. /*------------------------------------------------------------------------
  1479. Name :GetErrataCode
  1480. Synopsis :This function returns the error code
  1481. Type :Member Function
  1482. Input parameter :None
  1483. Output parameters :None
  1484. Return Type :UINT
  1485. Global Variables :None
  1486. Calling Syntax :GetErrataCode()
  1487. Notes :None
  1488. ------------------------------------------------------------------------*/
  1489. UINT CCommandSwitches::GetErrataCode()
  1490. {
  1491. return m_uErrataCode;
  1492. }
  1493. /*------------------------------------------------------------------------
  1494. Name :GetRepeatCount
  1495. Synopsis :This function returns the repeat count.
  1496. Type :Member Function
  1497. Input parameter :None
  1498. Output parameters :None
  1499. Return Type :ULONG
  1500. Global Variables :None
  1501. Calling Syntax :GetRepeatCount()
  1502. Notes :None
  1503. ------------------------------------------------------------------------*/
  1504. ULONG CCommandSwitches::GetRepeatCount()
  1505. {
  1506. return m_ulRepeatCount;
  1507. }
  1508. /*------------------------------------------------------------------------
  1509. Name :GetInformationCode
  1510. Synopsis :This function returns the message code
  1511. Type :Member Function
  1512. Input parameter :None
  1513. Output parameters :None
  1514. Return Type :UINT
  1515. Global Variables :None
  1516. Calling Syntax :GetInformationCode()
  1517. Notes :None
  1518. ------------------------------------------------------------------------*/
  1519. UINT CCommandSwitches::GetInformationCode()
  1520. {
  1521. return m_uInformationCode;
  1522. }
  1523. /*------------------------------------------------------------------------
  1524. Name :GetPWhereExpr
  1525. Synopsis :This function returns the PWhere string
  1526. Type :Member Function
  1527. Input parameter :None
  1528. Output parameters :None
  1529. Return Type :UINT
  1530. Global Variables :None
  1531. Calling Syntax :GetPWhereExpr()
  1532. Notes :None
  1533. ------------------------------------------------------------------------*/
  1534. _TCHAR* CCommandSwitches::GetPWhereExpr()
  1535. {
  1536. return m_pszPWhereExpr;
  1537. }
  1538. /*------------------------------------------------------------------------
  1539. Name :GetCOMError
  1540. Synopsis :This function returns the COMError object
  1541. Type :Member Function
  1542. Input parameter :None
  1543. Output parameters :None
  1544. Return Type :_com_error*
  1545. Global Variables :None
  1546. Calling Syntax :GetCOMError()
  1547. Notes :None
  1548. ------------------------------------------------------------------------*/
  1549. _com_error* CCommandSwitches::GetCOMError()
  1550. {
  1551. return m_pComError;
  1552. }
  1553. /*------------------------------------------------------------------------
  1554. Name :GetMethExecOutParam
  1555. Synopsis :This function returns the parameter
  1556. m_pIMethExecOutParam.
  1557. Type :Member Function
  1558. Input parameter :None
  1559. Output parameters :None
  1560. Return Type :Pointer to IWbemClassObject
  1561. Global Variables :None
  1562. Calling Syntax :GetMethExecOutParam()
  1563. Notes :None
  1564. ------------------------------------------------------------------------*/
  1565. IWbemClassObject* CCommandSwitches::GetMethExecOutParam()
  1566. {
  1567. return m_pIMethOutParam;
  1568. }
  1569. /*------------------------------------------------------------------------
  1570. Name :GetAliasUser
  1571. Synopsis :This function returns the alias user
  1572. Type :Member Function
  1573. Input parameter :None
  1574. Output parameters :None
  1575. Return Type :_TCHAR*
  1576. Global Variables :None
  1577. Calling Syntax :GetAliasUser()
  1578. ------------------------------------------------------------------------*/
  1579. _TCHAR* CCommandSwitches::GetAliasUser()
  1580. {
  1581. return m_pszUser;
  1582. }
  1583. /*------------------------------------------------------------------------
  1584. Name :GetAliasPassword
  1585. Synopsis :This function returns the alias password
  1586. Type :Member Function
  1587. Input parameter :None
  1588. Output parameters :None
  1589. Return Type :_TCHAR*
  1590. Global Variables :None
  1591. Calling Syntax :GetAliasPassword()
  1592. ------------------------------------------------------------------------*/
  1593. _TCHAR* CCommandSwitches::GetAliasPassword()
  1594. {
  1595. return m_pszPassword;
  1596. }
  1597. /*------------------------------------------------------------------------
  1598. Name :GetAliasNode
  1599. Synopsis :This function returns the alias node
  1600. Type :Member Function
  1601. Input parameter :None
  1602. Output parameters :None
  1603. Return Type :_TCHAR*
  1604. Global Variables :None
  1605. Calling Syntax :GetAliasNode()
  1606. ------------------------------------------------------------------------*/
  1607. _TCHAR* CCommandSwitches::GetAliasNode()
  1608. {
  1609. return m_pszNode;
  1610. }
  1611. /*------------------------------------------------------------------------
  1612. Name :GetAliasLocale
  1613. Synopsis :This function returns the alias locale
  1614. Type :Member Function
  1615. Input parameter :None
  1616. Output parameters :None
  1617. Return Type :_TCHAR*
  1618. Global Variables :None
  1619. Calling Syntax :GetAliasLocale()
  1620. ------------------------------------------------------------------------*/
  1621. _TCHAR* CCommandSwitches::GetAliasLocale()
  1622. {
  1623. return m_pszLocale;
  1624. }
  1625. /*------------------------------------------------------------------------
  1626. Name :GetAliasNamespace
  1627. Synopsis :This function returns the alias namespace
  1628. Type :Member Function
  1629. Input parameter :None
  1630. Output parameters :None
  1631. Return Type :_TCHAR*
  1632. Global Variables :None
  1633. Calling Syntax :GetAliasNamespace()
  1634. ------------------------------------------------------------------------*/
  1635. _TCHAR* CCommandSwitches::GetAliasNamespace()
  1636. {
  1637. return m_pszNamespace;
  1638. }
  1639. /*------------------------------------------------------------------------
  1640. Name :GetVerbType
  1641. Synopsis :This function returns type of the verb
  1642. Type :Member Function
  1643. Input parameter :None
  1644. Output parameters :None
  1645. Return Type :VERBTYPE
  1646. Global Variables :None
  1647. Calling Syntax :CParserEngine::ParseMethodInfo()
  1648. ------------------------------------------------------------------------*/
  1649. VERBTYPE CCommandSwitches::GetVerbType()
  1650. {
  1651. return m_vtVerbType;
  1652. }
  1653. /*------------------------------------------------------------------------
  1654. Name :GetVerbDerivation
  1655. Synopsis :This function Returns the derivation associated with
  1656. the verb.
  1657. Type :Member Function
  1658. Input parameter :None
  1659. Output parameters :None
  1660. Return Type :_TCHAR*
  1661. Global Variables :None
  1662. Calling Syntax :GetVerbDerivation()
  1663. Notes :None
  1664. ------------------------------------------------------------------------*/
  1665. _TCHAR* CCommandSwitches::GetVerbDerivation()
  1666. {
  1667. return m_pszVerbDerivation;
  1668. }
  1669. /*------------------------------------------------------------------------
  1670. Name :Initialize
  1671. Synopsis :This function initializes the necessary member
  1672. variables.
  1673. Type :Member Function
  1674. Input parameter :None
  1675. Output parameters :None
  1676. Return Type :None
  1677. Global Variables :None
  1678. Calling Syntax :Initialize()
  1679. Notes :None
  1680. ------------------------------------------------------------------------*/
  1681. void CCommandSwitches::Initialize() throw(WMICLIINT)
  1682. {
  1683. static BOOL bFirst = TRUE;
  1684. m_uErrataCode = 0;
  1685. m_uInformationCode = 0;
  1686. m_vtVerbType = NONALIAS;
  1687. m_bCredFlag = FALSE;
  1688. m_bExplicitWhereExpr = FALSE;
  1689. m_bTranslateFirst = TRUE;
  1690. if (bFirst)
  1691. {
  1692. // Default list format is assumed as FULL
  1693. m_pszListFormat = new _TCHAR [BUFFER32];
  1694. if (m_pszListFormat == NULL)
  1695. throw OUT_OF_MEMORY;
  1696. lstrcpy(m_pszListFormat, _T("FULL"));
  1697. bFirst = FALSE;
  1698. }
  1699. }
  1700. /*------------------------------------------------------------------------
  1701. Name :Uninitialize
  1702. Synopsis :This function uninitializes the member variables
  1703. when the execution of a command string issued on the
  1704. command line is completed.
  1705. Type :Member Function
  1706. Input parameter :None
  1707. Output parameters :None
  1708. Return Type :None
  1709. Global Variables :None
  1710. Calling Syntax :Uninitialize()
  1711. Notes :None
  1712. ------------------------------------------------------------------------*/
  1713. void CCommandSwitches::Uninitialize()
  1714. {
  1715. SAFEDELETE(m_pszCommandInput);
  1716. SAFEDELETE(m_pszAliasName);
  1717. SAFEDELETE(m_pszAliasDesc);
  1718. SAFEDELETE(m_pszClassPath);
  1719. SAFEDELETE(m_pszPathExpr);
  1720. SAFEDELETE(m_pszWhereExpr);
  1721. SAFEDELETE(m_pszVerb);
  1722. SAFEDELETE(m_pszMethodName);
  1723. ClearXSLTDetailsVector();
  1724. SAFEDELETE(m_pszAliasTarget);
  1725. SAFEDELETE(m_pszUser);
  1726. SAFEDELETE(m_pszLocale);
  1727. SAFEDELETE(m_pszPassword);
  1728. SAFEDELETE(m_pszNamespace);
  1729. SAFEDELETE(m_pszNode);
  1730. SAFEDELETE(m_pszVerbDerivation);
  1731. SAFEDELETE(m_pszListFormat);
  1732. SAFEDELETE(m_pszPWhereExpr);
  1733. FreeCOMError();
  1734. SAFEDELETE(m_pszTransTableName);
  1735. CleanUpCharVector(m_cvProperties);
  1736. CleanUpCharVector(m_cvInteractiveProperties);
  1737. CleanUpCharVector(m_cvPWhereParams);
  1738. CleanUpCharVector(m_cvTrnsTablesList);
  1739. m_bmParameters.clear();
  1740. m_afdAlsFmtDet.clear();
  1741. m_bmAlsFrnNmsDesOrTrnsTblEntrs.clear();
  1742. m_mdmMethDet.clear();
  1743. m_pdmPropDet.clear();
  1744. m_hResult = S_OK;
  1745. m_bSuccess = TRUE;
  1746. m_uInformationCode = 0;
  1747. m_ulInterval = 0;
  1748. m_vtVerbType = NONALIAS;
  1749. m_bCredFlag = FALSE;
  1750. m_bExplicitWhereExpr = FALSE;
  1751. m_nInteractiveMode = DEFAULTMODE;
  1752. m_bTranslateFirst = TRUE;
  1753. SAFEIRELEASE(m_pIMethOutParam);
  1754. SAFEBSTRFREE(m_bstrXML);
  1755. SAFEDELETE(m_pszResultClassName);
  1756. SAFEDELETE(m_pszResultRoleName);
  1757. SAFEDELETE(m_pszAssocClassName);
  1758. m_ulRepeatCount = 0;
  1759. m_bMethAvail = FALSE;
  1760. m_bWritePropsAvail = FALSE;
  1761. m_bLISTFrmsAvail = FALSE;
  1762. m_bNamedParamList = FALSE;
  1763. m_bEverySwitch = FALSE; // do not put m_bOutputSwitch here.
  1764. SAFEBSTRFREE(m_bstrFormedQuery);
  1765. m_bSysProp = FALSE;
  1766. }
  1767. /*------------------------------------------------------------------------
  1768. Name :SetCredentialsFlag
  1769. Synopsis :This function sets the credential flag status
  1770. Type :Member Function
  1771. Input parameter :
  1772. bCredFlag - credential flag value
  1773. Output parameters :None
  1774. Return Type :void
  1775. Global Variables :None
  1776. Calling Syntax :SetCredentialsFlag()
  1777. Notes :None
  1778. ------------------------------------------------------------------------*/
  1779. void CCommandSwitches::SetCredentialsFlag(BOOL bCredFlag)
  1780. {
  1781. m_bCredFlag = bCredFlag;
  1782. }
  1783. /*------------------------------------------------------------------------
  1784. Name :SetExplicitWhereExprFlag
  1785. Synopsis :This function sets the explicit where expression flag
  1786. Type :Member Function
  1787. Input parameter :
  1788. bWhereFlag - explicit where flag
  1789. Output parameters :None
  1790. Return Type :void
  1791. Global Variables :None
  1792. Calling Syntax :SetExplicitWhereExprFlag()
  1793. Notes :None
  1794. ------------------------------------------------------------------------*/
  1795. void CCommandSwitches::SetExplicitWhereExprFlag(BOOL bWhereFlag)
  1796. {
  1797. m_bExplicitWhereExpr = bWhereFlag;
  1798. }
  1799. /*------------------------------------------------------------------------
  1800. Name :GetCredentialsFlagStatus
  1801. Synopsis :This function returns the credential flag status
  1802. Type :Member Function
  1803. Input parameter :None
  1804. Output parameters :None
  1805. Return Type :BOOL
  1806. Global Variables :None
  1807. Calling Syntax :GetCredentialsFlagStatus()
  1808. Notes :None
  1809. ------------------------------------------------------------------------*/
  1810. BOOL CCommandSwitches::GetCredentialsFlagStatus()
  1811. {
  1812. return m_bCredFlag;
  1813. }
  1814. /*------------------------------------------------------------------------
  1815. Name :GetExplicitWhereExprFlag
  1816. Synopsis :This function returns the explicit where flag status
  1817. Type :Member Function
  1818. Input parameter :None
  1819. Output parameters :None
  1820. Return Type :BOOL
  1821. Global Variables :None
  1822. Calling Syntax :GetExplicitWhereExprFlag()
  1823. Notes :None
  1824. ------------------------------------------------------------------------*/
  1825. BOOL CCommandSwitches::GetExplicitWhereExprFlag()
  1826. {
  1827. return m_bExplicitWhereExpr;
  1828. }
  1829. /*------------------------------------------------------------------------
  1830. Name :FreeCOMError
  1831. Synopsis :This function deletes the previously assigned
  1832. error
  1833. Type :Member Function
  1834. Input parameter :None
  1835. Output parameters :None
  1836. Return Type :BOOL
  1837. Global Variables :None
  1838. Calling Syntax :FreeCOMError(rComError)
  1839. Notes :None
  1840. ------------------------------------------------------------------------*/
  1841. void CCommandSwitches::FreeCOMError()
  1842. {
  1843. if (m_pComError != NULL)
  1844. {
  1845. delete m_pComError;
  1846. m_pComError = NULL;
  1847. }
  1848. }
  1849. /*------------------------------------------------------------------------
  1850. Name :GetTrnsTablesList
  1851. Synopsis :This function add the newly specified table name to
  1852. the list of available translate table entries
  1853. Type :Member Function
  1854. Input parameter :
  1855. pszTableName - name of the translate table
  1856. Output parameters :None
  1857. Return Type :BOOL
  1858. Global Variables :None
  1859. Calling Syntax :AddToTrnsTablesList(pszTableName)
  1860. Notes :None
  1861. ------------------------------------------------------------------------*/
  1862. BOOL CCommandSwitches::AddToTrnsTablesList(_TCHAR* const pszTableName)
  1863. {
  1864. BOOL bRet = TRUE;
  1865. if (pszTableName)
  1866. {
  1867. try
  1868. {
  1869. _TCHAR* pszTemp = NULL;
  1870. pszTemp = new _TCHAR [lstrlen(pszTableName)+1];
  1871. if ( pszTemp != NULL )
  1872. {
  1873. lstrcpy(pszTemp, pszTableName);
  1874. m_cvTrnsTablesList.push_back(pszTemp);
  1875. }
  1876. else
  1877. bRet = FALSE;
  1878. }
  1879. catch(...)
  1880. {
  1881. bRet = FALSE;
  1882. }
  1883. }
  1884. return bRet;
  1885. }
  1886. /*------------------------------------------------------------------------
  1887. Name :GetTrnsTablesList
  1888. Synopsis :This function returns the populated translate table
  1889. information.
  1890. Type :Member Function
  1891. Input parameter :None
  1892. Output parameters :None
  1893. Return Type :
  1894. reference to CHARVECTOR
  1895. Global Variables :None
  1896. Calling Syntax :GetTrnslTablesList()
  1897. Notes :None
  1898. ------------------------------------------------------------------------*/
  1899. CHARVECTOR& CCommandSwitches::GetTrnsTablesList()
  1900. {
  1901. return m_cvTrnsTablesList;
  1902. }
  1903. /*------------------------------------------------------------------------
  1904. Name :SetTranslateFirstFlag
  1905. Synopsis :This function sets the the order of the format and
  1906. translate switch flag
  1907. Type :Member Function
  1908. Input parameter :
  1909. bTranslateFirst - order of the format and translate switch flag
  1910. Output parameters :None
  1911. Return Type :void
  1912. Global Variables :None
  1913. Calling Syntax :SetTranslateFirstFlag(bTranslateFirst)
  1914. Notes :None
  1915. ------------------------------------------------------------------------*/
  1916. void CCommandSwitches::SetTranslateFirstFlag(BOOL bTranslateFirst)
  1917. {
  1918. m_bTranslateFirst = bTranslateFirst;
  1919. }
  1920. /*------------------------------------------------------------------------
  1921. Name :GetTranslateFirstFlag
  1922. Synopsis :This function returns the order of the format and
  1923. translate switch flag
  1924. Type :Member Function
  1925. Input parameter :None
  1926. Output parameters :None
  1927. Return Type :BOOL
  1928. Global Variables :None
  1929. Calling Syntax :GetTranslateFirstFlag()
  1930. Notes :None
  1931. ------------------------------------------------------------------------*/
  1932. BOOL CCommandSwitches::GetTranslateFirstFlag()
  1933. {
  1934. return m_bTranslateFirst;
  1935. }
  1936. /*------------------------------------------------------------------------
  1937. Name :ClearPropertyList
  1938. Synopsis :This function clears the property list held by
  1939. m_cvProperties.
  1940. Type :Member Function
  1941. Input parameter :None
  1942. Output parameters :None
  1943. Return Type :void
  1944. Global Variables :None
  1945. Calling Syntax :ClearPropertyList()
  1946. Notes :None
  1947. ------------------------------------------------------------------------*/
  1948. void CCommandSwitches::ClearPropertyList()
  1949. {
  1950. CleanUpCharVector(m_cvProperties);
  1951. }
  1952. /*------------------------------------------------------------------------
  1953. Name :SetResultClassName
  1954. Synopsis :This function Assigns the string variable to
  1955. m_pszTransTableName.
  1956. Type :Member Function
  1957. Input parameter :
  1958. pszTransTableName - String type,Specifies the occurrence of
  1959. TRANSLATE switch and TABLE Name in the command for GET
  1960. verb.
  1961. Output parameters :None
  1962. Return Type :BOOL
  1963. Global Variables :None
  1964. Calling Syntax :SetTranslateTableName(pszTranstableName)
  1965. Notes :None
  1966. ------------------------------------------------------------------------*/
  1967. BOOL CCommandSwitches::SetResultClassName(const _TCHAR* pszResultClassName)
  1968. {
  1969. BOOL bResult = TRUE;
  1970. SAFEDELETE(m_pszResultClassName);
  1971. if (pszResultClassName)
  1972. {
  1973. m_pszResultClassName = new _TCHAR [lstrlen(pszResultClassName)+1];
  1974. if(m_pszResultClassName)
  1975. lstrcpy(m_pszResultClassName,pszResultClassName);
  1976. else
  1977. bResult = FALSE;
  1978. }
  1979. return bResult;
  1980. }
  1981. /*------------------------------------------------------------------------
  1982. Name :SetResultRoleName
  1983. Synopsis :This function Assigns the string variable to
  1984. m_pszTransTableName.
  1985. Type :Member Function
  1986. Input parameter :
  1987. pszTransTableName - String type,Specifies the occurrence of
  1988. TRANSLATE switch and TABLE Name in the command for GET
  1989. verb.
  1990. Output parameters :None
  1991. Return Type :BOOL
  1992. Global Variables :None
  1993. Calling Syntax :SetTranslateTableName(pszTranstableName)
  1994. Notes :None
  1995. ------------------------------------------------------------------------*/
  1996. BOOL CCommandSwitches::SetResultRoleName(const _TCHAR* pszResultRoleName)
  1997. {
  1998. BOOL bResult = TRUE;
  1999. SAFEDELETE(m_pszResultRoleName);
  2000. if (pszResultRoleName)
  2001. {
  2002. m_pszResultRoleName = new _TCHAR [lstrlen(pszResultRoleName)+1];
  2003. if(m_pszResultRoleName)
  2004. lstrcpy(m_pszResultRoleName,pszResultRoleName);
  2005. else
  2006. bResult = FALSE;
  2007. }
  2008. return bResult;
  2009. }
  2010. /*------------------------------------------------------------------------
  2011. Name :SetAssocClassName
  2012. Synopsis :This function Assigns the string variable to
  2013. m_pszAssocClassName.
  2014. Type :Member Function
  2015. Input parameter :
  2016. pszAssocClassName - String type,Specifies the occurrence of
  2017. TRANSLATE switch and TABLE Name in the command for GET
  2018. verb.
  2019. Output parameters :None
  2020. Return Type :BOOL
  2021. Global Variables :None
  2022. Calling Syntax :SetAssocClassName(pszAssocClassName)
  2023. Notes :None
  2024. ------------------------------------------------------------------------*/
  2025. BOOL CCommandSwitches::SetAssocClassName(const _TCHAR* pszAssocClassName)
  2026. {
  2027. BOOL bResult = TRUE;
  2028. SAFEDELETE(m_pszAssocClassName);
  2029. if (pszAssocClassName)
  2030. {
  2031. m_pszAssocClassName = new _TCHAR [lstrlen(pszAssocClassName)+1];
  2032. if(m_pszAssocClassName)
  2033. lstrcpy(m_pszAssocClassName,pszAssocClassName);
  2034. else
  2035. bResult = FALSE;
  2036. }
  2037. return bResult;
  2038. }
  2039. /*------------------------------------------------------------------------
  2040. Name :SetMethodsAvailable
  2041. Synopsis :This function sets the methods available flag
  2042. m_bMethAvail, according to passed parameter.
  2043. Type :Member Function
  2044. Input parameter :None
  2045. Output parameters :None
  2046. Return Type :void
  2047. Global Variables :None
  2048. Calling Syntax :SetMethodsAvailable(bFlag)
  2049. Notes :None
  2050. ------------------------------------------------------------------------*/
  2051. void CCommandSwitches::SetMethodsAvailable(BOOL bFlag)
  2052. {
  2053. m_bMethAvail = bFlag;
  2054. }
  2055. /*------------------------------------------------------------------------
  2056. Name :GetResultClassName
  2057. Synopsis :This function Returns the content of m_pszResultClassName
  2058. held by the command switches object.
  2059. Type :Member Function
  2060. Input parameter :None
  2061. Output parameters :None
  2062. Return Type :_TCHAR*
  2063. Global Variables :None
  2064. Calling Syntax :GetResultClassName()
  2065. Notes :None
  2066. ------------------------------------------------------------------------*/
  2067. _TCHAR* CCommandSwitches::GetResultClassName()
  2068. {
  2069. return m_pszResultClassName;
  2070. }
  2071. /*------------------------------------------------------------------------
  2072. Name :GetResultRoleName
  2073. Synopsis :This function Returns the content of m_pszResultRoleName
  2074. held by the command switches object.
  2075. Type :Member Function
  2076. Input parameter :None
  2077. Output parameters :None
  2078. Return Type :_TCHAR*
  2079. Global Variables :None
  2080. Calling Syntax :GetResultRoleName()
  2081. Notes :None
  2082. ------------------------------------------------------------------------*/
  2083. _TCHAR* CCommandSwitches::GetResultRoleName()
  2084. {
  2085. return m_pszResultRoleName;
  2086. }
  2087. /*------------------------------------------------------------------------
  2088. Name :GetAssocClassName
  2089. Synopsis :This function Returns the content of m_pszAssocClassName
  2090. held by the command switches object.
  2091. Type :Member Function
  2092. Input parameter :None
  2093. Output parameters :None
  2094. Return Type :_TCHAR*
  2095. Global Variables :None
  2096. Calling Syntax :GetAssocClassName()
  2097. Notes :None
  2098. ------------------------------------------------------------------------*/
  2099. _TCHAR* CCommandSwitches::GetAssocClassName()
  2100. {
  2101. return m_pszAssocClassName;
  2102. }
  2103. /*------------------------------------------------------------------------
  2104. Name :GetMethodsAvailable
  2105. Synopsis :This function Returns the boolean value of
  2106. m_bMethAvail.
  2107. Type :Member Function
  2108. Input parameter :None
  2109. Output parameters :None
  2110. Return Type :BOOL
  2111. Global Variables :None
  2112. Calling Syntax :GetMethodsAvailable()
  2113. Notes :None
  2114. ------------------------------------------------------------------------*/
  2115. BOOL CCommandSwitches::GetMethodsAvailable()
  2116. {
  2117. return m_bMethAvail;
  2118. }
  2119. /*------------------------------------------------------------------------
  2120. Name :SetWriteablePropsAvailable
  2121. Synopsis :This function sets writable properties available flag,
  2122. m_bWritePropsAvail.
  2123. Type :Member Function
  2124. Input parameter :None
  2125. Output parameters :None
  2126. Return Type :void
  2127. Global Variables :None
  2128. Calling Syntax :SetWriteablePropsAvailable(bFlag)
  2129. Notes :None
  2130. ------------------------------------------------------------------------*/
  2131. void CCommandSwitches::SetWriteablePropsAvailable(BOOL bFlag)
  2132. {
  2133. m_bWritePropsAvail = bFlag;
  2134. }
  2135. /*------------------------------------------------------------------------
  2136. Name :GetWriteablePropsAvailable
  2137. Synopsis :This function returns writable properties available
  2138. flag, m_bWritePropsAvail.
  2139. Type :Member Function
  2140. Input parameter :None
  2141. Output parameters :None
  2142. Return Type :BOOL
  2143. Global Variables :None
  2144. Calling Syntax :GetWriteablePropsAvailable()
  2145. Notes :None
  2146. ------------------------------------------------------------------------*/
  2147. BOOL CCommandSwitches::GetWriteablePropsAvailable()
  2148. {
  2149. return m_bWritePropsAvail;
  2150. }
  2151. /*------------------------------------------------------------------------
  2152. Name :SetLISTFormatsAvailable
  2153. Synopsis :This function sets LIST Formats available flag,
  2154. m_bLISTFrmsAvail.
  2155. Type :Member Function
  2156. Input parameter :None
  2157. Output parameters :None
  2158. Return Type :void
  2159. Global Variables :None
  2160. Calling Syntax :SetLISTFormatsAvailable(bFlag)
  2161. Notes :None
  2162. ------------------------------------------------------------------------*/
  2163. void CCommandSwitches::SetLISTFormatsAvailable(BOOL bFlag)
  2164. {
  2165. m_bLISTFrmsAvail = bFlag;
  2166. }
  2167. /*------------------------------------------------------------------------
  2168. Name :GetLISTFormatsAvailable
  2169. Synopsis :This function returns LIST Formats available flag,
  2170. m_bLISTFrmsAvail.
  2171. Type :Member Function
  2172. Input parameter :None
  2173. Output parameters :None
  2174. Return Type :BOOL
  2175. Global Variables :None
  2176. Calling Syntax :GetLISTFormatsAvailable()
  2177. Notes :None
  2178. ------------------------------------------------------------------------*/
  2179. BOOL CCommandSwitches::GetLISTFormatsAvailable()
  2180. {
  2181. return m_bLISTFrmsAvail;
  2182. }
  2183. /*------------------------------------------------------------------------
  2184. Name :AddToPropertyList
  2185. Synopsis :This function Adds string that is passed
  2186. through parameter to m_cvInteractiveProperties,
  2187. which is a data member of type BSTRMAP.
  2188. Type :Member Function
  2189. Input parameter :
  2190. pszProperty -String type,Used for storing properties
  2191. associated with an alias object.
  2192. Output parameters :None
  2193. Return Type :BOOL
  2194. Global Variables :None
  2195. Calling Syntax :AddToPropertyList(pszProperty)
  2196. Notes :None
  2197. ------------------------------------------------------------------------*/
  2198. BOOL CCommandSwitches::AddToInteractivePropertyList(_TCHAR* const pszProperty)
  2199. {
  2200. BOOL bRet = TRUE;
  2201. if (pszProperty)
  2202. {
  2203. try
  2204. {
  2205. _TCHAR* pszTemp = NULL;
  2206. pszTemp = new _TCHAR [lstrlen(pszProperty)+1];
  2207. if ( pszTemp != NULL )
  2208. {
  2209. lstrcpy(pszTemp, pszProperty);
  2210. m_cvInteractiveProperties.push_back(pszTemp);
  2211. }
  2212. else
  2213. bRet = FALSE;
  2214. }
  2215. catch(...)
  2216. {
  2217. bRet = FALSE;
  2218. }
  2219. }
  2220. return bRet;
  2221. }
  2222. /*------------------------------------------------------------------------
  2223. Name :GetPropertyList
  2224. Synopsis :This function Returns the interactive property held
  2225. by the command switches object.
  2226. Type :Member Function
  2227. Input parameter :None
  2228. Output parameters :None
  2229. Return Type :CHARVECTOR&
  2230. Global Variables :None
  2231. Calling Syntax :GetPropertyList()
  2232. Notes :None
  2233. ------------------------------------------------------------------------*/
  2234. CHARVECTOR& CCommandSwitches::GetInteractivePropertyList()
  2235. {
  2236. return m_cvInteractiveProperties;
  2237. }
  2238. /*------------------------------------------------------------------------
  2239. Name :SetNamedParamListFlag
  2240. Synopsis :This function sets m_bNamedParamList member variable.
  2241. Type :Member Function
  2242. Input parameter(s):None
  2243. Output parameter(s):
  2244. bFlag - Boolean value.
  2245. Return Type :void
  2246. Global Variables :None
  2247. Calling Syntax :SetNamedParamListFlag(bFlag)
  2248. Notes :None
  2249. ------------------------------------------------------------------------*/
  2250. void CCommandSwitches::SetNamedParamListFlag(BOOL bFlag)
  2251. {
  2252. m_bNamedParamList = bFlag;
  2253. }
  2254. /*------------------------------------------------------------------------
  2255. Name :GetNamedParamListFlag
  2256. Synopsis :This function returns the the boolean value held by
  2257. m_bNamedParamList.
  2258. Type :Member Function
  2259. Input parameter(s):None
  2260. Output parameter(s):None
  2261. Return Type :BOOL
  2262. Global Variables :None
  2263. Calling Syntax :GetNamedParamListFlag()
  2264. Notes :None
  2265. ------------------------------------------------------------------------*/
  2266. BOOL CCommandSwitches::GetNamedParamListFlag()
  2267. {
  2268. return m_bNamedParamList;
  2269. }
  2270. /*------------------------------------------------------------------------
  2271. Name :ClearXSLTDetailsVector
  2272. Synopsis :Clears or nullifies XSL Details vector.
  2273. Type :Member Function
  2274. Input parameter :None
  2275. Output parameters :None
  2276. Return Type :None
  2277. Global Variables :None
  2278. Calling Syntax :ClearXSLTDetailsVector()
  2279. Notes :None
  2280. ------------------------------------------------------------------------*/
  2281. void CCommandSwitches::ClearXSLTDetailsVector()
  2282. {
  2283. m_xdvXSLTDetVec.clear();
  2284. }
  2285. /*------------------------------------------------------------------------
  2286. Name :SetEverySwitchFlag
  2287. Synopsis :This function sets m_bEverySwitch member variable.
  2288. Type :Member Function
  2289. Input parameter(s):None
  2290. Output parameter(s):
  2291. bFlag - Boolean value.
  2292. Return Type :void
  2293. Global Variables :None
  2294. Calling Syntax :SetEverySwitchFlag(bFlag)
  2295. Notes :None
  2296. ------------------------------------------------------------------------*/
  2297. void CCommandSwitches::SetEverySwitchFlag(BOOL bFlag)
  2298. {
  2299. m_bEverySwitch = bFlag;
  2300. }
  2301. /*------------------------------------------------------------------------
  2302. Name :GetEverySwitchFlag
  2303. Synopsis :This function returns the the boolean value held by
  2304. m_bEverySwitch.
  2305. Type :Member Function
  2306. Input parameter(s):None
  2307. Output parameter(s):None
  2308. Return Type :BOOL
  2309. Global Variables :None
  2310. Calling Syntax :GetEverySwitchFlag()
  2311. Notes :None
  2312. ------------------------------------------------------------------------*/
  2313. BOOL CCommandSwitches::GetEverySwitchFlag()
  2314. {
  2315. return m_bEverySwitch;
  2316. }
  2317. /*------------------------------------------------------------------------
  2318. Name :SetOutputSwitchFlag
  2319. Synopsis :This function sets m_bOutputSwitch member variable.
  2320. Type :Member Function
  2321. Input parameter(s):None
  2322. Output parameter(s):
  2323. bFlag - Boolean value.
  2324. Return Type :void
  2325. Global Variables :None
  2326. Calling Syntax :SetOutputSwitchFlag(bFlag)
  2327. Notes :None
  2328. ------------------------------------------------------------------------*/
  2329. void CCommandSwitches::SetOutputSwitchFlag(BOOL bFlag)
  2330. {
  2331. m_bOutputSwitch = bFlag;
  2332. }
  2333. /*------------------------------------------------------------------------
  2334. Name :GetOutputSwitchFlag
  2335. Synopsis :This function returns the the boolean value held by
  2336. m_bOutputSwitch.
  2337. Type :Member Function
  2338. Input parameter(s):None
  2339. Output parameter(s):None
  2340. Return Type :BOOL
  2341. Global Variables :None
  2342. Calling Syntax :GetOutputSwitchFlag()
  2343. Notes :None
  2344. ------------------------------------------------------------------------*/
  2345. BOOL CCommandSwitches::GetOutputSwitchFlag()
  2346. {
  2347. return m_bOutputSwitch;
  2348. }
  2349. /*------------------------------------------------------------------------
  2350. Name :SetFormedQuery
  2351. Synopsis :This function Assigns the parameter passed to
  2352. m_bstrFormedQuery..
  2353. Type :Member Function
  2354. Input parameter :
  2355. bstrFormedQuery -BSTR type,It is the query formed for the given command.
  2356. Output parameters :None
  2357. Return Type :BOOL
  2358. Global Variables :None
  2359. Calling Syntax :SetFormedQuery(bstrFormedQuery)
  2360. Notes :None
  2361. ------------------------------------------------------------------------*/
  2362. BOOL CCommandSwitches::SetFormedQuery(const BSTR bstrFormedQuery)
  2363. {
  2364. BOOL bResult = TRUE;
  2365. SAFEBSTRFREE(m_bstrFormedQuery);
  2366. if (bstrFormedQuery!= NULL)
  2367. {
  2368. try
  2369. {
  2370. m_bstrFormedQuery = SysAllocString(bstrFormedQuery);
  2371. }
  2372. catch(...)
  2373. {
  2374. bResult = FALSE;
  2375. }
  2376. }
  2377. return bResult;
  2378. }
  2379. /*------------------------------------------------------------------------
  2380. Name :GetFormedQuery
  2381. Synopsis :This function Returns query formed for the given
  2382. command.
  2383. Type :Member Function
  2384. Input parameter :None
  2385. Output parameters :None
  2386. Return Type :BSTR
  2387. Global Variables :None
  2388. Calling Syntax :GetFormedQuery()
  2389. Notes :None
  2390. ------------------------------------------------------------------------*/
  2391. BSTR CCommandSwitches::GetFormedQuery()
  2392. {
  2393. return m_bstrFormedQuery;
  2394. }
  2395. /*------------------------------------------------------------------------
  2396. Name :GetSysPropFlag
  2397. Synopsis :This function returns the status of the system
  2398. properties flag
  2399. Type :Member Function
  2400. Input parameter :None
  2401. Output parameters :None
  2402. Return Type :BOOL
  2403. Global Variables :None
  2404. Calling Syntax :GetSysPropFlag()
  2405. Notes :None
  2406. ------------------------------------------------------------------------*/
  2407. BOOL CCommandSwitches::GetSysPropFlag()
  2408. {
  2409. return m_bSysProp;
  2410. }
  2411. /*------------------------------------------------------------------------
  2412. Name :SetSysPropFlag
  2413. Synopsis :This function sets the system properties flag, if
  2414. the GET or LIST property list contains the system
  2415. property(s)
  2416. Type :Member Function
  2417. Input parameter :None
  2418. Output parameters :None
  2419. Return Type :void
  2420. Global Variables :None
  2421. Calling Syntax :SetSysPropFlag(bSysProp)
  2422. Notes :None
  2423. ------------------------------------------------------------------------*/
  2424. void CCommandSwitches::SetSysPropFlag(BOOL bSysProp)
  2425. {
  2426. m_bSysProp = bSysProp;
  2427. }