Intrange

  • LXsTYPE_INTRANGE

ILxIntRange

class ILxIntRange

The ILxIntRange interface is used by the IntRange ExoType. Ranges are entered as strings, and are inclusive: “1-5” matches 1, 2, 3, 4 and 5. A dash is used to specify ranges, such as “1-20”, commas add more ranges or specific integers, such as “1-20,30,45-55”, leading and trailing ellipses to mark all before and all after, such as “…1-10,20-30”, and can be used to specify an exclusive range with something like “…0,11…”. “…” by itself matches everything. Negative numbers are supported, such as “-1”, “-1–30” or “-1-1”. Whites space is automatically skipped, making negative numbers easier to read as “-1 - -30” or “-1 - 1”, for example. Numbers can be in reverse order, such as “10-20,5-10” or “20-10”. The range can be read in lowest to highest numerical order or in the order the of the string. A range that does not follow the rules, such as an ellipses in the middle of the string, a dash without a number on the left side, no dash or comma between nubmers, or any illegal characters, is considered failed and will return false to all requests.

Public Functions

LxResult AllBefore(LXtObjectID self)

These return true LXe_TRUE if there are leading or trailing ellipses, and LXe_FALSE if not.

LxResult AllAfter(LXtObjectID self)
LxResult Next(LXtObjectID self, int *i)

These functions allow the integer range to be walked. The basic walking functions are Next() and Prev() and increment the current position. What is considered “next” and “previous” is determined by if the list is being walked in numerical or user order. When there are no more integers left, the methods fail.

LxResult Prev(LXtObjectID self, int *i)
LxResult Min(LXtObjectID self, int *min)

Numerical order starts at lowest integer in the range and goes to the highest integer. Example uses are print ranges, where you always want to print from the first page to the last page. User order starts from the first integer the user specified to the last, including reversed ranges. This is useful for things such as rendering sequences backward. In both cases, each integer will be returned only once. Note that these functions will fail if the range consists entirely of “…”, as there is no meaningful beginning or end to the range. Min() and Max() are used to get the lowest or highest integer and set the mode to numerical order.

LxResult Max(LXtObjectID self, int *max)
LxResult First(LXtObjectID self, int *first)

First() and Last() are used to get the first or last integer and set the mode to user order.

LxResult Last(LXtObjectID self, int *last)
LxResult Current(LXtObjectID self, int *current)

This gets the current integer.

LxResult Test(LXtObjectID self, int i)

It is often useful to be able to simply test to see if an integer is within the range. This returns LXe_TRUE if in range. This does not affect the current position used to walk the range.