Author: Michel Langeveld
Date: 13:16:01 10/29/03
Go up one level in this thread
On October 29, 2003 at 13:50:38, Gerd Isenberg wrote:
>On October 29, 2003 at 12:41:36, Michel Langeveld wrote:
>
>>>Hi Michel,
>>>
>>>I guess forEachGame is a static class function.
>>>Then you have to use explicite class specifiers in your typedef:
>>>
>>>typedef void (PGNtoScreen::*on_game_function_type)(char *moves);
>>>
>>>Gerd
>>
>>Hi Gerd,
>>
>>Thanks for looking.
>>
>>It's actually a static class function. I think the problem is that the compiler
>>doesn't know what object to use for calling this function. I made a complete
>>code that shows the same problem. Still puzzled.
>>
>>#include <iostream>
>>#include <stdlib.h>
>>
>>using namespace std;
>>
>>#define MAXBUF_SIZE 1000
>>
>>//typedef void (*line_event_type)(char *line);
>>typedef void (PGNtoScreen::*line_event_type)(char *line);
>>
>>class PGNParse
>>{
>>public:
>> PGNParse()
>> {
>> }
>>
> static
>> void parse(char *strTextFile, line_event_type lineEvent)
>> {
>> char line[MAXBUF_SIZE];
>>
>> FILE *f = fopen(strTextFile, "r");
>> while (!feof(f))
>> {
>> if (fgets(line, MAXBUF_SIZE, f) == NULL) continue;
>>
>> lineEvent(line);
>> }
>> }
>>};
>What's the reason to use a PGNParse class here at all, so far no data members -
>it's more like name spacing.
I wanted the make a generic class with all the logic.
This example is "isolated". The real class contains more logic and then it makes
more sense to have a seperate class.
Will look to your other comments.
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.