urlencoder.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. Copyright 2017 Herik Lima de Castro and Marcelo Medeiros Eler
  3. Distributed under MIT license, or public domain if desired and
  4. recognized in your jurisdiction.
  5. See file LICENSE for detail.
  6. */
  7. #ifndef URLENCODER_H
  8. #define URLENCODER_H
  9. #include "cppwebframework_global.h"
  10. #include <QByteArray>
  11. #include <QUrl>
  12. CWF_BEGIN_NAMESPACE
  13. /**
  14. * @brief The URLEncoder class
  15. */
  16. class CPPWEBFRAMEWORKSHARED_EXPORT URLEncoder
  17. {
  18. public:
  19. /**
  20. * @brief decode
  21. * @param url
  22. * @return
  23. */
  24. static QString decode(QByteArray url, bool replacePlusForSpace = true);
  25. /**
  26. * @brief encode
  27. * @param url
  28. * @return
  29. */
  30. static QString encode(const QByteArray &url);
  31. /**
  32. * @brief paramEncode
  33. * @param param
  34. * @return
  35. */
  36. static QString paramEncode(const QByteArray &param);
  37. /**
  38. * @brief paramDecode
  39. * @param param
  40. * @return
  41. */
  42. static QString paramDecode(QByteArray param, bool replacePlusForSpace = true);
  43. };
  44. CWF_END_NAMESPACE
  45. #endif // URLENCODER_H