1999-09-21 04:08:25 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
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/. */
|
1999-09-21 04:08:25 +04:00
|
|
|
|
|
|
|
#ifndef nsPrimitiveHelpers_h___
|
|
|
|
#define nsPrimitiveHelpers_h___
|
|
|
|
|
1999-12-02 06:39:41 +03:00
|
|
|
#include "nsError.h"
|
2000-01-29 23:24:50 +03:00
|
|
|
#include "nscore.h"
|
2017-08-24 18:18:00 +03:00
|
|
|
#include "nsString.h"
|
1999-09-21 04:08:25 +04:00
|
|
|
|
|
|
|
class nsISupports;
|
|
|
|
|
|
|
|
class nsPrimitiveHelpers {
|
|
|
|
public:
|
1999-12-01 01:07:29 +03:00
|
|
|
// Given some data and the flavor it corresponds to, creates the appropriate
|
|
|
|
// nsISupports* wrapper for passing across IDL boundaries. The length
|
|
|
|
// parameter should not include the null if the data is null terminated.
|
2017-08-21 13:01:27 +03:00
|
|
|
static void CreatePrimitiveForData(const nsACString& aFlavor,
|
|
|
|
const void* aDataBuff, uint32_t aDataLen,
|
2012-08-22 19:56:38 +04:00
|
|
|
nsISupports** aPrimitive);
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2015-07-22 09:56:57 +03:00
|
|
|
// A specific case of CreatePrimitive for windows CF_HTML handling in
|
|
|
|
// DataTransfer
|
|
|
|
static void CreatePrimitiveForCFHTML(const void* aDataBuff,
|
|
|
|
uint32_t* aDataLen,
|
|
|
|
nsISupports** aPrimitive);
|
2018-11-30 13:46:48 +03:00
|
|
|
|
1999-12-01 01:07:29 +03:00
|
|
|
// Given a nsISupports* primitive and the flavor it represents, creates a new
|
|
|
|
// data buffer with the data in it. This data will be null terminated, but the
|
|
|
|
// length parameter does not reflect that.
|
2018-11-09 16:24:28 +03:00
|
|
|
static void CreateDataFromPrimitive(const nsACString& aFlavor,
|
|
|
|
nsISupports* aPrimitive, void** aDataBuff,
|
|
|
|
uint32_t* aDataLen);
|
2018-11-30 13:46:48 +03:00
|
|
|
|
1999-09-21 04:08:25 +04:00
|
|
|
}; // class nsPrimitiveHelpers
|
2018-11-30 13:46:48 +03:00
|
|
|
|
1999-12-02 06:39:41 +03:00
|
|
|
class nsLinebreakHelpers {
|
|
|
|
public:
|
|
|
|
// Given some data, convert from the platform linebreaks into the LF expected
|
|
|
|
// by the DOM. This will attempt to convert the data in place, but the buffer
|
|
|
|
// may still need to be reallocated regardless (disposing the old buffer is
|
|
|
|
// taken care of internally, see the note below).
|
|
|
|
//
|
2015-05-01 18:01:06 +03:00
|
|
|
// NOTE: this assumes that it can use 'free' to dispose of the old buffer.
|
2017-08-21 13:01:27 +03:00
|
|
|
static nsresult ConvertPlatformToDOMLinebreaks(const nsACString& inFlavor,
|
|
|
|
void** ioData,
|
|
|
|
int32_t* ioLengthInBytes);
|
2018-11-30 13:46:48 +03:00
|
|
|
|
1999-12-02 06:39:41 +03:00
|
|
|
}; // class nsLinebreakHelpers
|
2018-11-30 13:46:48 +03:00
|
|
|
|
1999-09-21 04:08:25 +04:00
|
|
|
#endif // nsPrimitiveHelpers_h___
|