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.

164 lines
3.5 KiB

  1. //////////////////////////////////////////////////////////////////////
  2. // Query.cpp: implementation of the CQuery class.
  3. //
  4. // Created by JOEM 03-2000
  5. // Copyright (C) 2000 Microsoft Corporation
  6. // All Rights Reserved
  7. //
  8. /////////////////////////////////////////////////////// JOEM 3-2000 //
  9. #include "stdafx.h"
  10. #include "Query.h"
  11. #include "common.h"
  12. //////////////////////////////////////////////////////////////////////
  13. // Construction/Destruction
  14. //////////////////////////////////////////////////////////////////////
  15. CQuery::CQuery()
  16. {
  17. m_fXML = NOT_XML;
  18. m_fTTS = false;
  19. m_fFragType = SAPI_FRAG;
  20. m_fSpeak = true;
  21. m_pszExpandedText = NULL;
  22. m_pszDbName = NULL;
  23. m_pszDbPath = NULL;
  24. m_pszDbIdSet = NULL;
  25. m_pszId = NULL;
  26. m_unDbAction = 0;
  27. m_unDbIndex = 0;
  28. m_pTextFrag = NULL;
  29. m_paTagList = NULL;
  30. m_ulTextOffset = 0;
  31. m_ulTextLen = 0;
  32. }
  33. CQuery::CQuery(const CQuery& old)
  34. {
  35. USHORT i = 0;
  36. if ( old.m_pszExpandedText )
  37. {
  38. m_pszExpandedText = wcsdup(old.m_pszExpandedText);
  39. }
  40. else
  41. {
  42. m_pszExpandedText = NULL;
  43. }
  44. if ( old.m_pszDbName )
  45. {
  46. m_pszDbName = wcsdup(old.m_pszDbName);
  47. }
  48. else
  49. {
  50. m_pszDbName = NULL;
  51. }
  52. if ( old.m_pszDbPath )
  53. {
  54. m_pszDbPath = wcsdup(old.m_pszDbPath);
  55. }
  56. else
  57. {
  58. m_pszDbPath = NULL;
  59. }
  60. if ( old.m_pszDbIdSet )
  61. {
  62. m_pszDbIdSet = wcsdup(old.m_pszDbIdSet);
  63. }
  64. else
  65. {
  66. m_pszDbIdSet = NULL;
  67. }
  68. m_fXML = old.m_fXML;
  69. m_fTTS = old.m_fTTS;
  70. m_fFragType = old.m_fFragType;
  71. m_fSpeak = old.m_fSpeak;
  72. m_unDbAction = old.m_unDbAction;
  73. m_unDbIndex = old.m_unDbIndex;
  74. m_ulTextOffset = old.m_ulTextOffset;
  75. m_ulTextLen = old.m_ulTextLen;
  76. m_pTextFrag = new SPVTEXTFRAG(*old.m_pTextFrag);
  77. m_pszId = wcsdup (old.m_pszId);
  78. for (i=0; i<old.m_apEntry.GetSize(); i++)
  79. {
  80. m_apEntry.Add(old.m_apEntry[i]);
  81. m_apEntry[i]->AddRef();
  82. }
  83. for (i=0; i<old.m_afEntryMatch.GetSize(); i++)
  84. {
  85. m_afEntryMatch.Add(old.m_afEntryMatch[i]);
  86. }
  87. if ( old.m_paTagList )
  88. {
  89. m_paTagList = new CSPArray<CDynStr,CDynStr>;
  90. m_paTagList->Copy(*old.m_paTagList);
  91. }
  92. else
  93. {
  94. m_paTagList = NULL;
  95. }
  96. }
  97. CQuery::~CQuery()
  98. {
  99. USHORT i = 0;
  100. if ( m_pszDbName )
  101. {
  102. free (m_pszDbName);
  103. m_pszDbName = NULL;
  104. }
  105. if ( m_pszDbPath )
  106. {
  107. free (m_pszDbPath);
  108. m_pszDbPath = NULL;
  109. }
  110. if ( m_pszDbIdSet )
  111. {
  112. free (m_pszDbIdSet);
  113. m_pszDbIdSet = NULL;
  114. }
  115. if ( m_pszExpandedText )
  116. {
  117. free ( m_pszExpandedText );
  118. m_pszExpandedText = NULL;
  119. }
  120. if ( m_pszId )
  121. {
  122. free ( m_pszId );
  123. m_pszId = NULL;
  124. }
  125. if ( m_paTagList )
  126. {
  127. for ( i=0; i<m_paTagList->GetSize(); i++ )
  128. {
  129. (*m_paTagList)[i].dstr.Clear();
  130. }
  131. m_paTagList->RemoveAll();
  132. delete m_paTagList;
  133. m_paTagList = NULL;
  134. }
  135. if ( m_pTextFrag )
  136. {
  137. delete m_pTextFrag;
  138. m_pTextFrag = NULL;
  139. }
  140. for ( i=0; i<m_apEntry.GetSize(); i++ )
  141. {
  142. m_apEntry[i]->Release();
  143. m_apEntry[i] = NULL;
  144. }
  145. m_apEntry.RemoveAll();
  146. m_afEntryMatch.RemoveAll();
  147. }