LICENSE
The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at "http://www.mozilla.org/MPL/"
Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.
The Original Code is "AutoListUtils.pas".
The Initial Developer of the Original Code is Dieter Köhler (Heidelberg, Germany, "http://www.philo.de/"). Portions created by the Initial Developer are Copyright (C) 2003-2008 Dieter Köhler. All Rights Reserved.
Alternatively, the contents of this file may be used under the terms of the GNU General Public License Version 2 or later (the "GPL"), in which case the provisions of the GPL are applicable instead of those above. If you wish to allow use of your version of this file only under the terms of the GPL, and not to allow others to use your version of this file under the terms of the MPL, indicate your decision by deleting the provisions above and replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under the terms of any one of the MPL or the GPL.
The Auto List Utilities Library contains various components for working with lists of different kind. The speciality of these components is that they interact via notification messages similar to Delphi's data base components. The latest version of this software is available at <http://www.philo.de/xml/>.
These strings are used for the error messages of exceptions.
The bookmark classes are internally used in the TUtilsCustomIterator class to bookmark the iterator's position.
TUtilsCustomIteratorList is the base class for all automated lists. It introduces a lot of protected methods and properties which can be modified or published in derived components.
'True' if the list is currently active; 'False' otherwise.
Creates a new TUtilsCustomIteratorList component.
Parameters:
Destroys the TUtilsCustomIteratorList instance and frees its memory. Do not call Destroy directly in an application. Call Free instead, which checks for a nil reference before calling Destroy.
TUtilsCustomIterator is the base class for all iterators of automated lists.
If FollowItem is true, operations behave has follows:
Exchange: If the item at the current position is involved,
the position follows the item.
Delete: If an item before the current position is deleted,
the position is decremented.
If the item at the current position is deleted,
the position is set offleft.
InsertBefore: If an item is inserted somewhere before the current
position, the position is incremented.
If FollowItem is false, operations behave has follows:
Exchange: If the item at the current position is involved,
the position nevertheless remains the same.
Delete: If the position is offright, it remains offright
while the position is decremented.
If the position is not offright and an item before
or at the current position is deleted,
the position nevertheless remains the same.
InsertBefore: If an item is inserted somewhere before the current
position, the position nevertheless remains the same.
If an operation triggers more than one event, they are called in the following sequence:
Event calls can be suppressed by calling BeginUpdate which increases UpdateCount by one. As long as UpdateCount is not 0, no event is triggered. If UpdateCount is set to 0 by calling EndUpdate, an OnListModified event is triggered if an item in the list was added, deleted or modified since the last time UpdateCount was 0. Likewise, an OnPositionChanged event is triggered if the Position has changed since the last time UpdateCount was 0. And an OnItemChanged event is triggered, when the item was at least changed once since the last time UpdateCount was 0 (no matter whether the item was changed back to its original state if it was repeatedly changed, i.e. an OnItemChanged event is triggered anyway in this case.)
Triggered whenever Position has changed.
Triggered whenever the value or the item itself has changed.
Triggered whenever an item in the list was added, deleted or modified.
Counts the number of times BeginUpdate was called without a corresponding call to EndUpdate.
Creates a new TUtilsCustomIterator component.
Parameters:
Destroys the TUtilsCustomIterator instance and frees its memory. Do not call Destroy directly in an application. Call Free instead, which checks for a nil reference before calling Destroy.
Sets the iterator's position to the first item of the associated list.
Sets the iterator's position to the last item of the associated list.
Sets the iterator's position to the privious item of the associated list.
Sets the iterator's position to the next item of the associated list.
Sets the iterator's position to the specified value.
Parameters:
Exceptions:
Sets a bookmark by putting the current position on the internal bookmark stack.
Resets the position to the value stored at the top of the internal bookmark stack and removes the value from the stack.
Exceptions:
Event calls can be suppressed by calling BeginUpdate which increases UpdateCount by one. As long as UpdateCount is not 0, no event is triggered. If UpdateCount is set to 0 by calling EndUpdate, an OnListModified event is triggered if an item in the list was added, deleted or modified since the last time UpdateCount was 0. Likewise, an OnPositionChanged event is triggered if the Position has changed since the last time UpdateCount was 0. And an OnItemChanged event is triggered, when the item was at least changed once since the last time UpdateCount was 0 (no matter whether the item was changed back to its original state if it was repeatedly changed, i.e. an OnItemChanged event is triggered anyway in this case.)
Prevents event calls until the EndUpdate method is called.
Reenables event calls that were turned off with the BeginUpdate method.
Returns the current position of the iterator.
Return Value:
Determines whether the iterator is currently positioned on the first item of the associated list.
Return Value:
Determines whether the iterator is currently positioned on the last item of the associated list.
Return Value:
Determines whether the iterator is currently positioned off the left edge of the associated list.
Return Value:
Determines whether the iterator is currently positioned off the right edge of the associated list.
Return Value:
Determines whether the iterator is currently positioned off the left or right edge of the associated list.
Return Value:
Returns the number of items in the associated list.
Return Value:
Returns whether the associated list is empty.
Return Value:
TUtilsCustomObjectIteratorList is the base class for all automated object lists. It modifies some of the protected methods inherited from TUtilsCustomIteratorList to work with object and introduces some additional protected methods and properties.
'True' if the list can be modified; 'False' otherwise.
TUtilsCustomStringIteratorList is the base class for all automated string lists. It modifies some of the protected methods inherited from TUtilsCustomIteratorList to work with strings and introduces some additional protected methods and properties.
'True' if the list can be modified; 'False' otherwise.
TUtilsCustomAliasedStrings is the base class for all automated string lists which are connected with a TUtilsCustomIteratorAliases component. It modifies some of the protected methods inherited from TUtilsCustomStringIteratorList and introduces some additional protected methods and properties.
TUtilsAutoStrings hold an automated string lists which are connected with a TUtilsCustomIteratorAliases component.
Specifies how aliases from an object holding alias definition, referenced by the Aliases property, are applied. Possible values are:
Specifies the TUtilsCustomIteratorAliases object holding alias definition, which are used to calculated the aliased value of each string from its literal value according to the value of the AliasOpt property.
Specifies whether duplicate strings can be added to sorted lists.
Determines whether the iterators associated with the automated string list component are active.
Specifies whether the strings in the list should be automatically sorted.
'True' if the list can be modified; 'False' otherwise.
Indicates the number of strings the string list has allocated memory to hold.
Controls whether strings are located, sorted, and identified as duplicates in a case-sensitive or case-insensitive manner.
Indicates the number of strings in the list.
Lists the literal (non-aliased) value of the strings, referenced by a 0-based index.
Lists a set of objects associated one with each of the strings in the Strings/Literal property.
Lists the aliased value of the strings, referenced by a 0-based index.
Adds the specified string to the list according to the alias settings.
Parameters:
Return Value:
Adds the specified string and an associated object to the list according to the alias settings.
Parameters:
Return Value:
Deletes all the strings from the list.
Removes the string specified by the Index parameter.
Parameters:
Deletes all occurences of the specified string from the list according to the alias settings.
Parameters:
Inserts a string into an unsorted list at the specified position according to the alias settings.
Parameters:
Return Value:
Inserts a string and an associated object into an unsorted list at the specified position according to the alias settings.
Parameters:
Return Value:
Adds the specified string to the list treating it as the literal (non-aliased) string value.
Parameters:
Return Value:
Adds the specified string, treating it as the literal (non-aliased) string value, and an associated object to the list.
Parameters:
Return Value:
Deletes all occurences of the specified string, treating it as the literal (non-aliased) string value, from the list.
Parameters:
Inserts a string, treating it as the literal (non-aliased) string value, into an unsorted list at the specified position.
Parameters:
Return Value:
Inserts a string, treating it as the literal (non-aliased) string value, and an associated object into an unsorted list at the specified position.
Parameters:
Return Value:
Sorts the strings in the list in a customized order using the specified comparison function.
Parameters:
Swaps the position of two strings in the list.
Parameters:
Sorts the strings in the list in ascending order. Call Sort to sort the strings in a list that has the Sorted property set to false. String lists with the Sorted property set to true are automatically sorted. Sort uses AnsiCompareStr to sort the strings when CaseSensitive is true and AnsiCompareText when CaseSensitive is false. To provide your own comparison operator instead, use the CustomSort method.
Test whether the specifed string, according to the alias settings, is in the list.
Parameters:
Return Value:
Returns the list index of the specifed string, according to the alias settings.
Parameters:
Return Value:
Test whether the specifed string, treating it as the literal (non-aliased) string value, is in the list.
Parameters:
Return Value:
Returns the list index of the specifed string, treating it as the literal (non-aliased) string value.
Parameters:
Return Value:
Disables list-aware controls associated with this automated string list.
Enables list-aware controls associated with this automated string list.
TUtilsStringIterator components are used to iterate an associated TUtilsCustomAliasedStrings list.
The associated TUtilsCustomAliasedStrings list.
The literal value of the string at the iterator's position.
The aliased value of the string at the iterator's position.
'True' if the list can be modified; 'False' otherwise.
The adapter classes are used to link an iterator with an auto-updated view component for its associated list data.
Indicates whether the Iterator property can be set.
Triggered if the active status of the associated iterator changed.
Triggered if the position of the associated iterator changed.
Triggered if the focused item of the associated iterator changed.
Triggered if the automated list associated with the associated iterator was modified.
Destroys the TUtilsIteratorAdapter instance and frees its memory. Do not call Destroy directly in an application. Call Free instead, which checks for a nil reference before calling Destroy.
ExecuteAction is called automatically when the user invokes an action with the Owner as a target. The Action parameter specifies the action that was invoked. ExecuteAction checks whether the associated iterator can handle the action, and if so, forwards the action to the iterator.
Parameters:
Return Value:
UpdateAction is called automatically when the application is idle to give the iterator adapter an opportunity to update associated actions.
Parameters:
Return Value:
TUtilsStandardIteratorAdapter is a TUtilsIteratorAdapter descendant which publishes the Iterator property which is protected in TUtilsIteratorAdapter.
The iterator associated with this iterator adapter.
TUtilsStringIteratorAdapter is a TUtilsIteratorAdapter descendant which publishes a specialized Iterator property.
The string iterator associated with this iterator adapter.
Alias lists hold the alias definitions, each consisting of a key-alias-pair, used for automatic aliasing of strings in iterator lists.
TUtilsCustomAliases is the base class of all alias lists.
Lists the aliases referenced by a 0-based index.
The number of definitions in the alias list.
Lists the keys referenced by a 0-based index.
Creates a new TUtilsCustomAliases component.
Parameters:
Destroys the TUtilsCustomAliases instance and frees its memory. Do not call Destroy directly in an application. Call Free instead, which checks for a nil reference before calling Destroy.
Determines whether an alias for the specified key exists.
Parameters:
Return Value:
Determines whether a key for the specified alias exists.
Parameters:
Return Value:
Returns the list index of the first occurrence of the specified string as alias part in an alias definition.
Parameters:
Return Value:
Returns the list index of the first occurrence of the specified string as key part in an alias definition.
Parameters:
Return Value:
Escapes the specified string according to the specified option.
Parameters:
Return Value:
Unescapes the specified string according to the specified option.
Parameters:
Return Value:
TUtilsCustomIteratorAliases is a TUtilsCustomAliases descendant which introduces some private und protected methods to automatically interact with a TUtilsCustomIteratorList component.
TUtilsAutoAliases makes some of TUtilsCustomIteratorAliases' methods and properties public or published.
Triggered after the alias list was changed.
Triggered when the alias list is about to be changed.
Prevents event calls until the EndUpdate method is called.
Deletes all the definitions from the alias list.
Defines a key-alias pair.
Parameters:
Reenables event calls that were turned off with the BeginUpdate method.
Fills the alias list with the definitions stored in the specified file. LoadFromFile first clears any strings already in the alias list.
Parameters:
Fills the alias list with the definitions stored in the specified stream. LoadFromStream first clears any strings already in the alias list.
Parameters:
Removes the first key-alias pair with the specified alias from the alias list.
Parameters:
Return Value:
Removes the first key-alias pair with the specified key from the alias list.
Parameters:
Return Value:
Saves the defintions in the alias list to the specified file.
Parameters:
Saves the defintions in the alias list to the specified stream.
Parameters: