Navigation: ABC Library Reference > ConstantClass > ConstantClass Methods >====== Next (load all constant items to file or queue) ====== | |
Next | ( | file | ) | |
queue |
Next | Loads all the constant items to a file or queue. |
File | The label of the FILE to which to ADD each constant item. |
Queue | The label of the QUEUE to which to ADD each constant item. |
The Next method processes all of the constant items and executes an ADD(file) or ADD(queue) for each item.
Prior calls to the AddItem method determine the makeup of the item as well as the target variables that receive the item. The target variables should be within the file or queue structure to make the corresponding ADD meaningful.
The Init method determines what constitutes the end of the constant data.
Implementation:
The Next(FILE) and Next(QUEUE) methods call the Next() method for each constant item, then execute an ADD(file) or ADD(queue) for each item.
Example:
Spanish GROUP !declare constant data
Items BYTE(50) !item count
PSTRING('One') !begin first item
PSTRING('Uno')
PSTRING('Two') !begin second item
PSTRING('Dos')
!48 more PSTRING pairs
END
LangQ QUEUE
Text CSTRING(50)
Repl CSTRING(50)
END
Const ConstantClass !declare & instantiate Const object
Text CSTRING(255),AUTO !a variable to receive a constant value
Repl CSTRING(255),AUTO !a variable to receive a constant value
CODE
!process all items at a time
Const.Init(Term:BYTE) !Initialize the Const object,
!the first BYTE contains item count
Const.AddItem(ConstType:PString, LangQ.Text) !Describe constant structure and
Const.AddItem(ConstType:PString, LangQ.Repl) ! variables to accept the values
Const.Set(Spanish) !pass the constant data to Const object
Const.Next(LangQ) !copy all constant items to the LangQ
Const.Kill !shut down Const object