summaryrefslogtreecommitdiffstats
path: root/comm/calendar/base/public/calIIcsParser.idl
diff options
context:
space:
mode:
Diffstat (limited to 'comm/calendar/base/public/calIIcsParser.idl')
-rw-r--r--comm/calendar/base/public/calIIcsParser.idl81
1 files changed, 81 insertions, 0 deletions
diff --git a/comm/calendar/base/public/calIIcsParser.idl b/comm/calendar/base/public/calIIcsParser.idl
new file mode 100644
index 0000000000..9d27edfa4b
--- /dev/null
+++ b/comm/calendar/base/public/calIIcsParser.idl
@@ -0,0 +1,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();
+};