诸暨麻将添加redis
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 
 

94 行
4.0 KiB

  1. // Protocol Buffers - Google's data interchange format
  2. // Copyright 2008 Google Inc. All rights reserved.
  3. // https://developers.google.com/protocol-buffers/
  4. //
  5. // Redistribution and use in source and binary forms, with or without
  6. // modification, are permitted provided that the following conditions are
  7. // met:
  8. //
  9. // * Redistributions of source code must retain the above copyright
  10. // notice, this list of conditions and the following disclaimer.
  11. // * Redistributions in binary form must reproduce the above
  12. // copyright notice, this list of conditions and the following disclaimer
  13. // in the documentation and/or other materials provided with the
  14. // distribution.
  15. // * Neither the name of Google Inc. nor the names of its
  16. // contributors may be used to endorse or promote products derived from
  17. // this software without specific prior written permission.
  18. //
  19. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  20. // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  21. // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  22. // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  23. // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  24. // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  25. // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  26. // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  27. // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  28. // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  29. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  30. // Protocol Buffers - Google's data interchange format
  31. // Copyright 2008 Google Inc. All rights reserved.
  32. // https://developers.google.com/protocol-buffers/
  33. //
  34. // Redistribution and use in source and binary forms, with or without
  35. // modification, are permitted provided that the following conditions are
  36. // met:
  37. //
  38. // * Redistributions of source code must retain the above copyright
  39. // notice, this list of conditions and the following disclaimer.
  40. // * Redistributions in binary form must reproduce the above
  41. // copyright notice, this list of conditions and the following disclaimer
  42. // in the documentation and/or other materials provided with the
  43. // distribution.
  44. // * Neither the name of Google Inc. nor the names of its
  45. // contributors may be used to endorse or promote products derived from
  46. // this software without specific prior written permission.
  47. //
  48. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  49. // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  50. // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  51. // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  52. // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  53. // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  54. // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  55. // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  56. // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  57. // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  58. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  59. // Author: kenton@google.com (Kenton Varda)
  60. #include <vector>
  61. #include <google/protobuf/stubs/common.h>
  62. #include <google/protobuf/io/zero_copy_stream.h>
  63. namespace google {
  64. namespace protobuf {
  65. namespace compiler {
  66. class ZipWriter {
  67. public:
  68. ZipWriter(io::ZeroCopyOutputStream* raw_output);
  69. ~ZipWriter();
  70. bool Write(const std::string& filename, const std::string& contents);
  71. bool WriteDirectory();
  72. private:
  73. struct FileInfo {
  74. std::string name;
  75. uint32 offset;
  76. uint32 size;
  77. uint32 crc32;
  78. };
  79. io::ZeroCopyOutputStream* raw_output_;
  80. std::vector<FileInfo> files_;
  81. };
  82. } // namespace compiler
  83. } // namespace protobuf
  84. } // namespace google