Url.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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 <string>
  18. #include <alibabacloud/oss/Export.h>
  19. namespace AlibabaCloud
  20. {
  21. namespace OSS
  22. {
  23. class ALIBABACLOUD_OSS_EXPORT Url
  24. {
  25. public:
  26. explicit Url(const std::string &url = "");
  27. ~Url();
  28. bool operator==(const Url &url) const;
  29. bool operator!=(const Url &url) const;
  30. std::string authority() const;
  31. void clear();
  32. std::string fragment() const;
  33. void fromString(const std::string &url);
  34. bool hasFragment() const;
  35. bool hasQuery() const;
  36. std::string host()const;
  37. bool isEmpty() const;
  38. bool isValid() const;
  39. int port()const;
  40. std::string password() const;
  41. std::string path() const;
  42. std::string query() const;
  43. std::string scheme() const;
  44. void setAuthority(const std::string &authority);
  45. void setFragment(const std::string &fragment);
  46. void setHost(const std::string &host);
  47. void setPassword(const std::string &password);
  48. void setPath(const std::string &path);
  49. void setPort(int port);
  50. void setQuery(const std::string &query);
  51. void setScheme(const std::string &scheme);
  52. void setUserInfo(const std::string &userInfo);
  53. void setUserName(const std::string &userName);
  54. std::string toString()const;
  55. std::string userInfo() const;
  56. std::string userName() const;
  57. private:
  58. std::string scheme_;
  59. std::string userName_;
  60. std::string password_;
  61. std::string host_;
  62. std::string path_;
  63. int port_;
  64. std::string query_;
  65. std::string fragment_;
  66. };
  67. }
  68. }