|
-
May 8th, 2009, 07:19 AM
#1
Text parser
Hi Guys,
Just a quick question. I need to write a text parser which basically reads in data from the file.. The would basically define all the objects on my screen. and will have elements like mass , gravity , name and more importantly a array of vertices that build up the object et c.
The name of the object is a string .. the vertices are a 3d vector gravity is a 3d vector and mass is a float .
But not all the variables are required for all the objects on screen.For example some values are left to be initialized in the code while others are over ridden by values in the file.
This means that the data is nt regular in the input file. Also I need to parse in various data types from the text file and do it for all the objects on the screen.
This process needs to be repeated for the "n" objects on my screen.
Currently I have writtern a parser which can loop a file and find out the particular key for the value and retrieve the value associated with the key. Say if there is a Mass : 10 my parser can retrieve 10 if i provide a string "Mass" as a input . But then repeated looping the file is cumbersome and I felt this isnt the best way to do this sort of thing . does anyone have a good way to do this??
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|