summaryrefslogtreecommitdiffstats
path: root/comm/calendar/base/public/calIIcsParser.idl
blob: 9d27edfa4b19da83ea9da7431eddaa9a746b86b9 (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
74
75
76
77
78
79
80
81
/* -*- 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 nsIInputStream;
interface calIIcsParser;

/**
 * Listener being called once asynchronous parsing is done.
 */
[scriptable, uuid(d22527da-b0e2-41b7-b6f4-ee9c243cd285)]
interface calIIcsParsingListener : nsISupports
{
    void onParsingComplete(in nsresult rc, in calIIcsParser parser);
};

/**
 * An interface for parsing an ics string or stream into its items.
 * Note that this is not a service. A new instance must be created for every new
 * string or stream to be parsed.
 */
[scriptable, uuid(83e9befe-5e9e-49de-8bc2-d882f464f7e7)]
interface calIIcsParser : nsISupports
{
  /**
   * Parse an ics string into its items, and store top-level properties and
   * components that are not interpreted.
   *
   * @param aICSString
   *    The ICS string to parse
   * @param optional aAsyncParsing
   *    If non-null, parsing will be performed on a worker thread,
   *    and the passed listener is called when it's done
   */
  void parseString(in AString aICSString,
                   [optional] in calIIcsParsingListener aAsyncParsing);

  /**
   * Parse an input stream.
   *
   * @see parseString
   * @param aICSString
   *    The stream to parse
   * @param optional aAsyncParsing
   *    If non-null, parsing will be performed on a worker thread,
   *    and the passed listener is called when it's done
   */
  void parseFromStream(in nsIInputStream aStream,
                       [optional] in calIIcsParsingListener aAsyncParsing);

  /**
   * Get the items that were in the string or stream. In case an item represents a
   * recurring series, the (unexpanded) parent item is returned only.
   * Please keep in mind that any parentless items (see below) are not contained
   * in the returned set of items.
   */
  Array<calIItemBase> getItems();

  /**
   * Get the parentless items that may have occurred, i.e. overridden items of a
   * recurring series (having a RECURRENCE-ID) missing their parent item in the
   * parsed content.
   */
  Array<calIItemBase> getParentlessItems();

  /**
   * Get the top-level properties that were not interpreted as anything special
   */
  Array<calIIcalProperty> getProperties();

  /**
   * Get the top-level components that were not interpreted as anything special
   */
  Array<calIIcalComponent> getComponents();
};