I like to use reflection to make save game files with serialization. does this exist for pascal?
I like to use reflection to make save game files with serialization. does this exist for pascal?
In a way it does. You have RTTI for published properties of persistent objects(classes inheriting from TPersistent). Normal component streaming with the TStream makes serialization possible, but it's somewhat rigid. It'll do a lot, but not everything, and you have to be very careful about your design
So in conclusion; I wouldn't use it for anything complicated
Peregrinus, expectavi pedes meos in cymbalis
Nullus norvegicorum sole urinat
thanks I found this http://wiki.freepascal.org/tiOPF
I may try to save objects in CSV format
If I had a Type called Car and some other types that extend it e.g. (ford ,honda,chevy)
could I use RTTI to get the names of the types(ford, honda etc.)
then create buttons with the names
then when the user clicks on a button use RTTI to create an instance of the selected car (ford, honda)?
thanks, could i get a list of all the types that extend car?
I want to put a menu on the screen to let the player choose a car to drive
then when the player chooses a car, could i use the text (e.g. Ford, Honda) to create an instance of that type of car?
can I create an object with a text string of its name?
if not, could i have a little example program of turning an object into a stream and vice-versa?
Last edited by slenkar; 24-11-2010 at 04:40 AM.
Bookmarks