2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2007-11-30 21:05:54 +03:00
|
|
|
|
|
|
|
/** @file
|
|
|
|
* Helper functions for (de)serializing objects to/from ASCII strings.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef NSSERIALIZATIONHELPER_H_
|
|
|
|
#define NSSERIALIZATIONHELPER_H_
|
|
|
|
|
|
|
|
#include "nsStringFwd.h"
|
2010-10-26 15:57:18 +04:00
|
|
|
#include "nsISerializationHelper.h"
|
2012-06-06 07:18:25 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2007-11-30 21:05:54 +03:00
|
|
|
|
|
|
|
class nsISerializable;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Serialize an object to an ASCII string.
|
|
|
|
*/
|
|
|
|
nsresult NS_SerializeToString(nsISerializable* obj,
|
2017-06-20 12:19:52 +03:00
|
|
|
nsACString& str);
|
2007-11-30 21:05:54 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Deserialize an object.
|
|
|
|
*/
|
2017-06-20 12:19:52 +03:00
|
|
|
nsresult NS_DeserializeObject(const nsACString& str,
|
2007-11-30 21:05:54 +03:00
|
|
|
nsISupports** obj);
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class nsSerializationHelper final : public nsISerializationHelper
|
2010-10-26 15:57:18 +04:00
|
|
|
{
|
2018-04-30 19:46:04 +03:00
|
|
|
~nsSerializationHelper() = default;
|
2014-06-24 20:36:44 +04:00
|
|
|
|
2010-10-26 15:57:18 +04:00
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSISERIALIZATIONHELPER
|
|
|
|
};
|
|
|
|
|
2007-11-30 21:05:54 +03:00
|
|
|
#endif
|