nsSerializationHelper.h 934 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /* This Source Code Form is subject to the terms of the Mozilla Public
  2. * License, v. 2.0. If a copy of the MPL was not distributed with this
  3. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  4. /** @file
  5. * Helper functions for (de)serializing objects to/from ASCII strings.
  6. */
  7. #ifndef NSSERIALIZATIONHELPER_H_
  8. #define NSSERIALIZATIONHELPER_H_
  9. #include "nsStringFwd.h"
  10. #include "nsISerializationHelper.h"
  11. #include "mozilla/Attributes.h"
  12. class nsISerializable;
  13. /**
  14. * Serialize an object to an ASCII string.
  15. */
  16. nsresult NS_SerializeToString(nsISerializable* obj,
  17. nsCSubstring& str);
  18. /**
  19. * Deserialize an object.
  20. */
  21. nsresult NS_DeserializeObject(const nsCSubstring& str,
  22. nsISupports** obj);
  23. class nsSerializationHelper final : public nsISerializationHelper
  24. {
  25. ~nsSerializationHelper() {}
  26. NS_DECL_ISUPPORTS
  27. NS_DECL_NSISERIALIZATIONHELPER
  28. };
  29. #endif