NodeList.h
1 //////////////////////////////////////////////////////////////////////////
2 // Copyright 2001-2019 Aspose Pty Ltd. All Rights Reserved.
3 //
4 // This file is part of Aspose.Words. The source code in this file
5 // is only intended as a supplement to the documentation, and is provided
6 // "as is", without warranty of any kind, either expressed or implied.
7 //////////////////////////////////////////////////////////////////////////
8 
9 
10 #pragma once
11 
12 #include <system/shared_ptr.h>
13 #include <system/collections/ienumerator.h>
14 #include <system/collections/ienumerable.h>
15 
16 #include "Aspose.Words.Cpp/Model/Nodes/Node.h"
17 
18 namespace Aspose { namespace Words { class NodeCollection; } }
19 
20 namespace Aspose {
21 
22 namespace Words {
23 
24 
25 
26 
27 /// <summary>
28 /// Represents a collection of nodes matching an XPath query executed using the <see cref="Aspose::Words::CompositeNode::SelectNodes(System::String)" /> method.
29 /// </summary>
30 /// <remarks>
31 /// <p>
32 /// <b>NodeList</b> is returned by <see cref="Aspose::Words::CompositeNode::SelectNodes(System::String)" /> and contains a collection
33 /// of nodes matching the XPath query.</p>
34 /// <p>
35 /// <b>NodeList</b> supports indexed access and iteration.</p>
36 /// \note
37 /// Treat the <b>NodeList</b> collection as a "snapshot" collection. <b>NodeList</b> starts
38 /// as a "live" collection because the nodes are not actually retrieved when the XPath query is run.
39 /// The nodes are only retrieved upon access and at this time the node and all nodes that precede
40 /// it are cached forming a "snapshot" collection.
41 /// </remarks>
42 class NodeList : public System::Collections::Generic::IEnumerable<System::SharedPtr<Aspose::Words::Node>>
43 {
44  typedef NodeList ThisType;
45  typedef System::Collections::Generic::IEnumerable<System::SharedPtr<Aspose::Words::Node>> BaseType;
46 
47  typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
48  ASPOSE_WORDS_SHARED_RTTI_INFO_DECL();
49 
50 public:
51 
52 
53 
54  /// <summary>
55  /// Gets the number of nodes in the list.
56  /// </summary>
57  ASPOSE_WORDS_SHARED_API int32_t get_Count() const;
58 
59  ASPOSE_WORDS_SHARED_API NodeList(const System::SharedPtr<Aspose::Words::NodeCollection>& nodes);
60 
61 
62 
63 
64  /// <summary>
65  /// Provides a simple "foreach" style iteration over the collection of nodes.
66  /// </summary>
67  /// <returns>An IEnumerator.</returns>
68  ASPOSE_WORDS_SHARED_API System::SharedPtr<System::Collections::Generic::IEnumerator<System::SharedPtr<Aspose::Words::Node>>> GetEnumerator() override;
69 
70 
71 
72 
73  /// <summary>
74  /// Retrieves a node at the given index.
75  /// </summary>
76  /// <remarks>
77  /// <p>The index is zero-based.</p>
78  /// <p>Negative indexes are allowed and indicate access from the back of the collection.
79  /// For example -1 means the last item, -2 means the second before last and so on.</p>
80  /// <p>If index is greater than or equal to the number of items in the list, this returns a null reference.</p>
81  /// <p>If index is negative and its absolute value is greater than the number of items in the list, this returns a null reference.</p>
82  /// </remarks>
83  /// <param name="index">An index into the list of nodes.</param>
84  ASPOSE_WORDS_SHARED_API System::SharedPtr<Aspose::Words::Node> idx_get(int32_t index) const;
85 protected:
86 
87  ASPOSE_WORDS_SHARED_API System::Object::shared_members_type GetSharedMembers() override;
88 
89 private:
90 
91  System::SharedPtr<Aspose::Words::NodeCollection> mNodes;
92 
93 };
94 
95 }
96 }
Represents a collection of nodes matching an XPath query executed using the Aspose::Words::CompositeN...
Definition: NodeList.h:42
Definition: IFontData.h:19
Represents a collection of nodes of a specific type.
Definition: NodeCollection.h:75