Clear
procedure Clear;
Example
procedure ResetBoundaries(const BoundaryStack: TIdMIMEBoundary);
begin
BoundaryStack.Clear;
end;
Usage
Clear removes every tracked boundary and parent-part value. After the call, Count is zero and Boundary is an empty string.
Additional Technical Info
Clear removes every entry from the internal boundary list and then every entry from the parallel parent-part list. On normal completion, Count returns 0 and Boundary returns ''.
The method is safe on an already-empty stack. It does not free the TIdMIMEBoundary object, and the same message-owned instance can be used again.
Clearing a message's live MIME boundary stack changes parser/encoder working state and cannot be undone from this object. Use it only when deliberately resetting that state, not merely to discard a borrowed reference.
The operation is non-transactional: the boundary list is cleared before the parent list. An exceptional failure or concurrent access between those operations could expose mismatched internal state. Cost is O(depth) for releasing the stored strings, and the object is not thread-safe. The source-reviewed example was not runtime-tested.
External references
- Embarcadero DocWiki:
System.Classes.TStringList.Clear- core operation invoked for both lists. - Free Pascal:
TStringList.Clear- compatible core reference; Velox uses Delphi.