@@ -31,31 +31,30 @@ namespace app {
31
31
// /
32
32
// / - Start iterating by creating an iteration state
33
33
// /
34
- // / mPosition = AttributePathExpandIterator::Position::StartIterating(path);
34
+ // / AttributePathExpandIterator::Position position = AttributePathExpandIterator::Position::StartIterating(path);
35
35
// /
36
36
// / - Use the iteration state in a for loop:
37
37
// /
38
38
// / ConcreteAttributePath path;
39
- // / for (AttributePathExpandIterator iterator(mPosition ); iterator->Next(path);) {
39
+ // / for (AttributePathExpandIterator iterator(position ); iterator->Next(path);) {
40
40
// / // use `path` here`
41
41
// / }
42
42
// /
43
43
// / OR:
44
44
// /
45
45
// / ConcreteAttributePath path;
46
- // / AttributePathExpandIterator iterator(mPosition );
46
+ // / AttributePathExpandIterator iterator(position );
47
47
// /
48
48
// / while (iterator.Next(path)) {
49
49
// / // use `path` here`
50
50
// / }
51
51
// /
52
- // / USAGE requirements and assumptions:
52
+ // / Usage requirements and assumptions:
53
53
// /
54
- // / - There should be only one single AttributePathExpandIterator for a state at a time.
55
- // /
56
- // / - `Position` is automatically updated by the AttributePathExpandIterator, so
57
- // / calling `Next` on the iterator will update the state variable.
54
+ // / - An ` AttributePathExpandIterator::Position` can only be used by a single AttributePathExpandIterator at a time.
58
55
// /
56
+ // / - `position` is automatically updated by the AttributePathExpandIterator, so
57
+ // / calling `Next` on the iterator will update the position cursor variable.
59
58
// /
60
59
class AttributePathExpandIterator
61
60
{
@@ -65,7 +64,7 @@ class AttributePathExpandIterator
65
64
public:
66
65
// Position is treated as a direct member access by the AttributePathExpandIterator, however it is opaque (except copying)
67
66
// for external code. We allow friendship here to not have specific get/set for methods (clearer interface and less
68
- // likelyhood of extra code usage).
67
+ // likelihood of extra code usage).
69
68
friend class AttributePathExpandIterator ;
70
69
71
70
// / External callers can only ever start iterating on a new path from the beginning
@@ -100,7 +99,7 @@ class AttributePathExpandIterator
100
99
ConcreteAttributePath mOutputPath ;
101
100
};
102
101
103
- AttributePathExpandIterator (DataModel::Provider * dataModel, Position & state ) : mDataModelProvider (dataModel), mPosition (state )
102
+ AttributePathExpandIterator (DataModel::Provider * dataModel, Position & position ) : mDataModelProvider (dataModel), mPosition (position )
104
103
{}
105
104
106
105
// This class may not be copied. A new one should be created when needed and they
@@ -151,8 +150,10 @@ class AttributePathExpandIterator
151
150
bool IsValidAttributeId (AttributeId attributeId);
152
151
};
153
152
154
- // / Wraps around an AttributePathExpandIterator however it rolls back Next() to one
155
- // / step back whenever Next() is not run to completion (until it returns false)
153
+ // / PeekAttributePathExpandIterator is an AttributePathExpandIterator wrapper that rolls back the Next()
154
+ // / call whenever a new `MarkCompleted()` method is not called (until Next() returns false). This is useful
155
+ // / to allow pausing iteration in cases the next path was not ready to be used yet and iteration needs to
156
+ // / continue later.
156
157
// /
157
158
// / Example use cases:
158
159
// /
0 commit comments