The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
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.

62 lines
2.6KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2016 - ROLI Ltd.
  5. Permission is granted to use this software under the terms of the ISC license
  6. http://www.isc.org/downloads/software-support-policy/isc-license/
  7. Permission to use, copy, modify, and/or distribute this software for any
  8. purpose with or without fee is hereby granted, provided that the above
  9. copyright notice and this permission notice appear in all copies.
  10. THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD
  11. TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
  12. FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT,
  13. OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
  14. USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  15. TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
  16. OF THIS SOFTWARE.
  17. -----------------------------------------------------------------------------
  18. To release a closed-source product which uses other parts of JUCE not
  19. licensed under the ISC terms, commercial licenses are available: visit
  20. www.juce.com for more information.
  21. ==============================================================================
  22. */
  23. #ifndef JUCE_BASE64_H_INCLUDED
  24. #define JUCE_BASE64_H_INCLUDED
  25. /**
  26. Contains some static methods for converting between binary and the
  27. standard base-64 encoding format.
  28. */
  29. struct JUCE_API Base64
  30. {
  31. /** Converts a binary block of data into a base-64 string.
  32. This will write the resulting string data to the given stream.
  33. If a write error occurs with the stream, the method will terminate and return false.
  34. */
  35. static bool convertToBase64 (OutputStream& base64Result, const void* sourceData, size_t sourceDataSize);
  36. /** Converts a base-64 string back to its binary representation.
  37. This will write the decoded binary data to the given stream.
  38. If the string is not valid base-64, the method will terminate and return false.
  39. */
  40. static bool convertFromBase64 (OutputStream& binaryOutput, StringRef base64TextInput);
  41. /** Converts a block of binary data to a base-64 string. */
  42. static String toBase64 (const void* sourceData, size_t sourceDataSize);
  43. /** Converts a string's UTF-8 representation to a base-64 string. */
  44. static String toBase64 (const String& textToEncode);
  45. };
  46. #endif // JUCE_BASE64_H_INCLUDED