[question] Class structure
Hello again,
I need to create a program that'll compare 2 files, what i wish to do is something like this :
Code:
/--------------------------------------------------------------------\
| Header | Info | Info | Info .... |
\--------------------------------------------------------------------/
File 1
/--------------------------------------------------------------------\
| Header | Info2 | Info2 | Info2 .... |
\--------------------------------------------------------------------/
Info
_________________________________________________________________________
Class tree
_________________________________________________________________________
Compare Functions
|
|
V
File
/\
/ \
/ \
/ \
Header Info
/\
/ \
/ \
/ \
Header2 Info2
Where i would instanciate 1 Comp class and 2 files. I wish to store the data of each files in a series of classes.
1) Will I be able to say for example (pseudo code)
File(1).Info(2).Info2(1) == File(2).Info(7).Info2(2) ?
2) How can I access the set of functions I created in a separate class Function (may include some global variables). I mean, if i do something like this Function f = new Function() and Info2 do f.SetAVariable(myValue)
can Header do f.GetAVariable and get myValue ?
Thanks for your time guys
Re: [question] Class structure
If you're just comparing files to see if they are identical, then you don't need separate classes. Just read the files and compare the length. If that's the same then you can read bytes to compare.
Re: [question] Class structure
Also: some tools already exist for this problem. diff on linux/unix or WinMerge on Windows are good choices.
Re: [question] Class structure
Won't work as the comparison has to be automatic without human intervention. I have to compare the whole file but be able to reconize in which section of the file I am because files will be legitmately different on some zones, and I need to find these zones. Furthermore zones pos are not static at all and relies on information provided by carfully reaing file's data