How do you read this?

D

Dan Aldean

Hello,

I have a small project and it's hard to understand what the requirements
are.
Basically I need to read a text file and identify titles and attributes with
their values.
I have to remove leading and trailing spaces in the titles and attribute
lines. That is OK as
I found a way of using only stringbuilder objects.
But I find it difficult to understand the following:
The class should support:
- Get an integer value associated with a given title and attribute names.
- Set an integer value for a given title and attribute names, writing the
new file to disk.

Here is the structure of the input file.

<title1>
attribute1:value1
attribute2:value2

<title2>
attribute3:value3
attribute4:value4
attribute5:value5
attribute6:value6

I created a class GetText which has a method for parsing the text:
ParseText. It reads a whole line and after processing it, it writes to the
output file.
GetText myParser;
myParser.ParseText();

But I do not understand the purpose of the Get and Set in this context.

Thanks
 
G

Guest

The requirements leads to the following functions:

- Get an integer value associated with a given title and attribute names

public int GetIntValue(string Title, string attribute); //return the int
value of attribute

- Set an integer value for a given title and attribute names, writing the
new file to disk.

public bool SetIntValue(string Title, string attribute, int valuetoSet)
 
D

Dan Aldean

Hi Altaf, thanks for the reply.
I would read the "get an integer... and set an integer..." as GET and SET
used for building properties.
But even not using properties, I understand setting an integer value for a
title and writing it on disk.
But why getting the integer associated with a title? The file is not a
database to retrieve the title based on a number.
And the class is supposed to be a parser, not a retriever. It says: build a
class that can parse the input file.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top