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.

129 lines
4.0 KiB

  1. //
  2. // MODULE: APGTSLSTREAD.H
  3. //
  4. // PURPOSE: APGTS LST file reading classes
  5. //
  6. // COMPANY: Saltmine Creative, Inc. (206)-284-7511 [email protected]
  7. //
  8. // AUTHOR: Oleg Kalosha
  9. //
  10. // ORIGINAL DATE: 7-29-98
  11. //
  12. // NOTES:
  13. //
  14. // Version Date By Comments
  15. //--------------------------------------------------------------------
  16. // V3.0 08-04-98 OK
  17. //
  18. #ifndef __APGTSLSTREAD_H_
  19. #define __APGTSLSTREAD_H_
  20. #define APGTSLSTREAD_DSC _T(".dsc")
  21. #define APGTSLSTREAD_HTI _T(".hti")
  22. #define APGTSLSTREAD_BES _T(".bes")
  23. #define APGTSLSTREAD_TSM _T(".tsm")
  24. #ifdef LOCAL_TROUBLESHOOTER
  25. #define APGTSLSTREAD_TSC _T(".tsc")
  26. #endif
  27. #include "iniread.h"
  28. #include "SafeTime.h"
  29. ////////////////////////////////////////////////////////////////////////////////////
  30. // static function(s)
  31. ////////////////////////////////////////////////////////////////////////////////////
  32. CString FormFullPath(const CString& just_path, const CString& just_name);
  33. ////////////////////////////////////////////////////////////////////////////////////
  34. // CTopicInfo
  35. ////////////////////////////////////////////////////////////////////////////////////
  36. class CTopicInfo
  37. { // each CTopicInfo contains data about one topic (belief network & associated files).
  38. protected:
  39. CString m_NetworkName; // symbolic name of network
  40. CString m_DscFilePath; // full path of DSC file
  41. CString m_HtiFilePath; // full path of HTI file
  42. CString m_BesFilePath; // full path of BES file
  43. CString m_TscFilePath; // full path of TSC file
  44. time_t m_DscFileCreated;
  45. time_t m_HtiFileCreated;
  46. time_t m_BesFileCreated;
  47. public:
  48. CTopicInfo() : m_DscFileCreated(0), m_HtiFileCreated(0), m_BesFileCreated(0) {}
  49. public:
  50. virtual bool Init(CString & strResourcePath, vector<CString> & vecstrWords);
  51. public:
  52. // The following 4 functions are guaranteed to return lower case strings.
  53. const CString & GetNetworkName() const {return m_NetworkName;}
  54. const CString & GetDscFilePath() const {return m_DscFilePath;}
  55. const CString & GetHtiFilePath() const {return m_HtiFilePath;}
  56. const CString & GetBesFilePath() const {return m_BesFilePath;}
  57. const CString & GetTscFilePath() const {return m_TscFilePath;}
  58. CString GetStrDscFileCreated()
  59. {return CSafeTime(m_DscFileCreated).StrLocalTime();}
  60. CString GetStrHtiFileCreated()
  61. {return CSafeTime(m_HtiFileCreated).StrLocalTime();}
  62. CString GetStrBesFileCreated()
  63. {return CSafeTime(m_BesFileCreated).StrLocalTime();}
  64. inline BOOL __stdcall operator ==(const CTopicInfo& t2) const
  65. {
  66. return m_NetworkName == t2.m_NetworkName
  67. && m_DscFilePath == t2.m_DscFilePath
  68. && m_HtiFilePath == t2.m_HtiFilePath
  69. && m_BesFilePath == t2.m_BesFilePath
  70. && m_TscFilePath == t2.m_TscFilePath
  71. ;
  72. }
  73. // this function exists solely to keep STL happy.
  74. inline BOOL __stdcall operator < (const CTopicInfo& t2) const
  75. {
  76. return m_NetworkName < t2.m_NetworkName;
  77. }
  78. };
  79. typedef vector<CTopicInfo> CTopicInfoVector;
  80. ////////////////////////////////////////////////////////////////////////////////////
  81. // CAPGTSLSTReader
  82. ////////////////////////////////////////////////////////////////////////////////////
  83. class CAPGTSLSTReader : public CINIReader
  84. {
  85. protected:
  86. CTopicInfoVector m_arrTopicInfo; // Symbolic name & file name for each topic
  87. public:
  88. CAPGTSLSTReader(CPhysicalFileReader * pPhysicalFileReader);
  89. ~CAPGTSLSTReader();
  90. public:
  91. ////////////////////////////////////////////////////////
  92. // If multiple threads may access this object,
  93. // these functions should be wrapped by
  94. // LOCKOBJECT() - UNLOCKOBJECT()
  95. // to secure consistency of container
  96. // if used in conjunction
  97. long GetInfoCount();
  98. bool GetInfo(long index, CTopicInfo& out);
  99. bool GetInfo(const CString & network_name, CTopicInfo & out);
  100. ////////////////////////////////////////////////////////
  101. void GetInfo(CTopicInfoVector& arrOut);
  102. public:
  103. void GetDifference(const CAPGTSLSTReader * pOld, CTopicInfoVector & what_is_new);
  104. protected:
  105. virtual void Parse();
  106. virtual bool ParseString(const CString& source, CTopicInfo& out);
  107. virtual CTopicInfo* GenerateTopicInfo();
  108. };
  109. #endif __APGTSLSTREAD_H_