Skip to content

CList

CList

CList Class is a class of dynamic list of instances of the CObject class and its derived classes.

Description

Class CList provides the ability to work with a list of instances of CObject and its derived classes. The class allows adding/inserting/deleting array elements, performing an array sorting, and searching in a sorted array. In addition, methods of working with files have been implemented.

There are some subtleties of working with the CList class. The class has a mechanism to control dynamic memory, so be careful when working with elements of the list.

Subtleties of the mechanism of memory management similar to those described in CArrayObj.

Declaration

class CList : public CObject

Title

#include <Arrays\List.mqh>

Inheritance hierarchy

CObject

CList

Class Methods by Groups

Attributes
FreeModeGets the flag of memory management when deleting list elements
FreeModeSets the flag of memory management when deleting list elements
TotalGets the number of elements in the list
IsSortedGets sorted list flag
SortModeGets the sorting mode
Create methods
CreateElementCreates a new list element
Add methods
AddAdds an element to the end of the list
InsertInserts an element to the specified position of the list
Delete methods
DetachCurrentRemoves an element from the current position in the list without deleting it “physically”
DeleteCurrentRemoves the element from the current position in the list
DeleteRemoves the element from the specified position in the list
ClearRemoves all list elements
Navigation
IndexOfGets the index of the specified list element
GetNodeAtIndexGets an item with the specified index of the list
GetFirstNodeGets the first element of the list
GetPrevNodeGets the previous element of the list
GetCurrentNodeGets the current list element
GetNextNodeGets the next element in the list
GetLastNodeGets the last element in the list
Ordering methods
SortSorts the list
MoveToIndexMoves the current element in the list to the specified position
ExchangeSwaps two elements in the list
Compare methods
CompareListCompares the list with another one
Search methods
SearchSearches for an element equal to the sample in sorted list
Input/output
virtual SaveSaves list data in the file
virtual LoadLoads list data from the file
virtual TypeGets the list type identifier

Methods inherited from class CObject

: Prev, Prev, Next, Next, Compare

Last updated on