Navigation: ABC Library Reference > ConstantClass > ConstantClass Methods >====== Set (set the constant data to process) ====== | |
Set( datasource )
Set | Sets the GROUP structure to process. |
datasource | The label of the GROUP structure the ConstantClass object processes. |
The Set method sets the GROUP structure to process.
Implementation:
The Set method takes a copy of datasource and calls the Reset method to reset internal counters to process datasource copy from the beginning.
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
CODE
!process all items at a time
Const.Init(Term:BYTE) !re 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
See Also: Reset