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.

119 lines
3.1 KiB

  1. // AZipValue.h -- interface declaration for the CAbstractZipValue
  2. // (c) Copyright Schlumberger Technology Corp., unpublished work, created
  3. // 1999. This computer program includes Confidential, Proprietary
  4. // Information and is a Trade Secret of Schlumberger Technology Corp. All
  5. // use, disclosure, and/or reproduction is prohibited unless authorized
  6. // in writing. All Rights Reserved.
  7. #include <string>
  8. #include "ProtCrypt.h"
  9. #include "ArchivedValue.h"
  10. #if !defined(SLBCCI_AZIPVALUE_H)
  11. #define SLBCCI_AZIPVALUE_H
  12. namespace cci
  13. {
  14. class CAbstractZipValue
  15. : public CProtectableCrypt
  16. {
  17. public:
  18. // Types
  19. typedef std::string ValueType;
  20. // C'tors/D'tors
  21. virtual
  22. ~CAbstractZipValue() throw() = 0;
  23. // Operators
  24. // Operations
  25. void
  26. Value(ValueType const &rData);
  27. // Access
  28. ValueType
  29. Value();
  30. // Predicates
  31. // Variables
  32. protected:
  33. // Types
  34. class ZipCapsule
  35. {
  36. public:
  37. ZipCapsule(std::string sData,
  38. bool fIsCompressed)
  39. : m_sData(sData),
  40. m_fIsCompressed(fIsCompressed)
  41. {};
  42. explicit
  43. ZipCapsule()
  44. : m_sData(),
  45. m_fIsCompressed(false)
  46. {};
  47. std::string
  48. Data() const
  49. {
  50. return m_sData;
  51. }
  52. bool
  53. IsCompressed() const
  54. {
  55. return m_fIsCompressed;
  56. }
  57. private:
  58. std::string m_sData;
  59. bool m_fIsCompressed;
  60. };
  61. // C'tors/D'tors
  62. explicit
  63. CAbstractZipValue(CAbstractCard const &racard,
  64. ObjectAccess oa,
  65. bool fAlwaysZip);
  66. // Operators
  67. // Operations
  68. virtual void
  69. DoValue(ZipCapsule const &rzc) = 0;
  70. // Access
  71. virtual ZipCapsule
  72. DoValue() = 0;
  73. // Predicates
  74. // Variables
  75. private:
  76. // Types
  77. // C'tors/D'tors
  78. // Operators
  79. // Operations
  80. static ZipCapsule
  81. Zip(std::string const &rsData,
  82. bool fAlwaysZip);
  83. static std::string
  84. UnZip(ZipCapsule const &rzc);
  85. // Access
  86. // Predicates
  87. // Variables
  88. bool const m_fAlwaysZip;
  89. CArchivedValue<ValueType> m_avData;
  90. };
  91. } // namespace cci
  92. #endif // SLBCCI_AZIPVALUE_H