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.

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