summaryrefslogtreecommitdiffstats
path: root/comm/calendar/base/public/calIIcsSerializer.idl
blob: 2d81c8387c93fed4581c00395fc6ab15a7eb605e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/* -*- Mode: idl; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* 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/. */

#include "nsISupports.idl"

interface calIIcalProperty;
interface calIIcalComponent;
interface calIItemBase;
interface nsIOutputStream;
interface nsIInputStream;

/**
 * An interface for serializing calendar items into an ICS string.
 * Note that this is not a service. A new instance must be created for every new
 * set of items to be serialized.
 */
[scriptable, uuid(4dcf6b4e-7322-4a61-a191-8d8cc1aea42e)]
interface calIIcsSerializer : nsISupports
{
  /**
   * Add some items to the items that are to be serialized. Can be called
   * multiple times, and appends to the set on every call.
   *
   * @param aItems
   *    The items to be added
   */
  void addItems(in Array<calIItemBase> aItems);

  /**
   * Add a property to the top-level properties to be added on serializing. Can
   * be called multiple times, and appends to the set on every call.
   *
   * @param aProperty
   *    The property to be added
   */
  void addProperty(in calIIcalProperty aProperty);

  /**
   * Add a component to the top-level components to be added on serializing. Can
   * be called multiple times, and appends to the set on every call.
   *
   * @param aComponent
   *    The component to be added
   */
  void addComponent(in calIIcalComponent aComponent);

  /**
   * Serialize the added items, properties and components into an ICS string
   *
   * @returns
   *    A string containing the serialized items, properties and components.
   */
  AString serializeToString();

  /**
   * Serialize the added items, properties and components into an ICS stream
   *
   * @returns
   *    A stream containing the serialized items, properties and components.
   */
  nsIInputStream serializeToInputStream();

  /**
   * Serialize the added items, properties and components into an ICS stream
   *
   * @param aStream
   *    A stream into which the serialized items, properties and components
   *    will be written.
   */
  void serializeToStream(in nsIOutputStream aStream);
};