2015-05-03 22:32:37 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
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-02-12 07:28:29 +03:00
|
|
|
|
|
|
|
#ifndef __nsIContentIterator_h___
|
|
|
|
#define __nsIContentIterator_h___
|
|
|
|
|
|
|
|
#include "nsISupports.h"
|
2012-06-11 03:44:50 +04:00
|
|
|
#include "nsCOMPtr.h"
|
2017-10-02 17:58:31 +03:00
|
|
|
#include "mozilla/RangeBoundary.h"
|
1999-02-12 07:28:29 +03:00
|
|
|
|
2008-10-15 13:40:28 +04:00
|
|
|
class nsINode;
|
2018-05-17 19:01:38 +03:00
|
|
|
class nsRange;
|
1999-02-12 07:28:29 +03:00
|
|
|
|
2008-10-15 13:40:28 +04:00
|
|
|
#define NS_ICONTENTITERATOR_IID \
|
2009-04-06 21:17:37 +04:00
|
|
|
{ 0x2550078e, 0xae87, 0x4914, \
|
|
|
|
{ 0xb3, 0x04, 0xe4, 0xd1, 0x46, 0x19, 0x3d, 0x5f } }
|
1999-02-12 07:28:29 +03:00
|
|
|
|
2004-01-24 03:46:17 +03:00
|
|
|
class nsIContentIterator : public nsISupports
|
|
|
|
{
|
1999-02-12 07:28:29 +03:00
|
|
|
public:
|
2008-10-15 13:40:28 +04:00
|
|
|
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ICONTENTITERATOR_IID)
|
1999-02-12 07:28:29 +03:00
|
|
|
|
|
|
|
/* Initializes an iterator for the subtree rooted by the node aRoot
|
|
|
|
*/
|
2008-10-15 13:40:28 +04:00
|
|
|
virtual nsresult Init(nsINode* aRoot) = 0;
|
1999-02-12 07:28:29 +03:00
|
|
|
|
|
|
|
/* Initializes an iterator for the subtree defined by the range aRange
|
2009-04-06 21:17:37 +04:00
|
|
|
Subclasses should make sure they implement both of these!
|
1999-02-12 07:28:29 +03:00
|
|
|
*/
|
2018-05-17 19:01:38 +03:00
|
|
|
virtual nsresult Init(nsRange* aRange) = 0;
|
2004-01-24 03:46:17 +03:00
|
|
|
|
2017-06-26 11:26:27 +03:00
|
|
|
/* Initializes an iterator for the subtree between
|
|
|
|
aStartContainer/aStartOffset and aEndContainer/aEndOffset
|
|
|
|
Callers should guarantee that the start point and end point are in
|
|
|
|
document order.
|
|
|
|
*/
|
|
|
|
virtual nsresult Init(nsINode* aStartContainer, uint32_t aStartOffset,
|
|
|
|
nsINode* aEndContainer, uint32_t aEndOffset) = 0;
|
|
|
|
|
2017-10-02 17:58:31 +03:00
|
|
|
/* Initializes an iterator for the subtree between aStart and aEnd.
|
|
|
|
Callers should guarantee that the start point and end point are in
|
|
|
|
document order.
|
|
|
|
*/
|
|
|
|
virtual nsresult Init(const mozilla::RawRangeBoundary& aStart,
|
|
|
|
const mozilla::RawRangeBoundary& aEnd) = 0;
|
|
|
|
|
2004-01-24 03:46:17 +03:00
|
|
|
/** First will reset the list.
|
1999-02-12 07:28:29 +03:00
|
|
|
*/
|
2004-01-24 03:46:17 +03:00
|
|
|
virtual void First() = 0;
|
1999-02-12 07:28:29 +03:00
|
|
|
|
2004-01-24 03:46:17 +03:00
|
|
|
/** Last will reset the list to the end.
|
1999-02-12 07:28:29 +03:00
|
|
|
*/
|
2004-01-24 03:46:17 +03:00
|
|
|
virtual void Last() = 0;
|
|
|
|
|
|
|
|
/** Next will advance the list.
|
1999-02-12 07:28:29 +03:00
|
|
|
*/
|
2004-01-24 03:46:17 +03:00
|
|
|
virtual void Next() = 0;
|
1999-02-12 07:28:29 +03:00
|
|
|
|
2004-01-24 03:46:17 +03:00
|
|
|
/** Prev will decrement the list.
|
1999-02-12 07:28:29 +03:00
|
|
|
*/
|
2004-01-24 03:46:17 +03:00
|
|
|
virtual void Prev() = 0;
|
1999-02-12 07:28:29 +03:00
|
|
|
|
2004-01-24 03:46:17 +03:00
|
|
|
/** CurrentItem will return the current item, or null if the list is empty
|
|
|
|
* @return the current node
|
1999-02-12 07:28:29 +03:00
|
|
|
*/
|
2008-10-15 13:40:28 +04:00
|
|
|
virtual nsINode *GetCurrentNode() = 0;
|
1999-02-12 07:28:29 +03:00
|
|
|
|
2004-01-24 03:46:17 +03:00
|
|
|
/** return if the collection is at the end. that is the beginning following a call to Prev
|
1999-02-12 07:28:29 +03:00
|
|
|
* and it is the end of the list following a call to next
|
2004-01-24 03:46:17 +03:00
|
|
|
* @return if the iterator is done.
|
1999-02-12 07:28:29 +03:00
|
|
|
*/
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual bool IsDone() = 0;
|
1999-02-12 07:28:29 +03:00
|
|
|
|
1999-03-23 14:54:52 +03:00
|
|
|
/** PositionAt will position the iterator to the supplied node
|
|
|
|
*/
|
2008-10-15 13:40:28 +04:00
|
|
|
virtual nsresult PositionAt(nsINode* aCurNode) = 0;
|
1999-02-12 07:28:29 +03:00
|
|
|
};
|
|
|
|
|
2008-10-15 13:40:28 +04:00
|
|
|
NS_DEFINE_STATIC_IID_ACCESSOR(nsIContentIterator, NS_ICONTENTITERATOR_IID)
|
2005-11-11 17:36:26 +03:00
|
|
|
|
2012-06-11 03:44:50 +04:00
|
|
|
already_AddRefed<nsIContentIterator> NS_NewContentIterator();
|
|
|
|
already_AddRefed<nsIContentIterator> NS_NewPreContentIterator();
|
|
|
|
already_AddRefed<nsIContentIterator> NS_NewContentSubtreeIterator();
|
2012-06-11 03:37:47 +04:00
|
|
|
|
2012-06-11 03:44:50 +04:00
|
|
|
#endif // __nsIContentIterator_h___
|