ServiceRequest.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * Copyright 2009-2017 Alibaba Cloud All rights reserved.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #pragma once
  17. #include <memory>
  18. #include <iostream>
  19. #include <alibabacloud/oss/Export.h>
  20. #include <alibabacloud/oss/Types.h>
  21. namespace AlibabaCloud
  22. {
  23. namespace OSS
  24. {
  25. const int REQUEST_FLAG_CONTENTMD5 = (1 << 0);
  26. const int REQUEST_FLAG_PARAM_IN_PATH = (1 << 1);
  27. const int REQUEST_FLAG_CHECK_CRC64 = (1 << 2);
  28. const int REQUEST_FLAG_SAVE_CLIENT_CRC64 = (1 << 3);
  29. class ALIBABACLOUD_OSS_EXPORT ServiceRequest
  30. {
  31. public:
  32. virtual ~ServiceRequest() = default;
  33. std::string Path() const;
  34. virtual HeaderCollection Headers() const = 0;
  35. virtual ParameterCollection Parameters() const = 0;
  36. virtual std::shared_ptr<std::iostream> Body() const = 0;
  37. int Flags() const;
  38. void setFlags(int flags);
  39. const IOStreamFactory& ResponseStreamFactory() const;
  40. void setResponseStreamFactory(const IOStreamFactory& factory);
  41. const AlibabaCloud::OSS::TransferProgress& TransferProgress() const;
  42. void setTransferProgress(const AlibabaCloud::OSS::TransferProgress& arg);
  43. protected:
  44. ServiceRequest();
  45. void setPath(const std::string &path);
  46. private:
  47. int flags_;
  48. std::string path_;
  49. IOStreamFactory responseStreamFactory_;
  50. AlibabaCloud::OSS::TransferProgress transferProgress_;
  51. };
  52. }
  53. }