pingus-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: System file reorganisation


From: Neil Hotmail
Subject: Re: System file reorganisation
Date: Sun, 27 Oct 2002 12:01:26 -0000

On Sunday 27 October 2002 12:22, Neil Hotmail wrote:
> Have one foo.hxx file with the interface, and good comments as to the
> purpose of each of the interface.
| So far so good...

> Have one foo.cxx file which implements methods that call system specific
> things in foo, but which may be reimplemented as system specific
| That's a bit unclear to me.

i.e.
basename stays in system.cxx because while it is a system specific call it
is implemented on the back of another system specific call, i.e. the macro
"pathseparator" (its not - but it should be)

> Have one foo_<system>.cxx for each system it is ported to, with the
> implementation of the remaining methods.

| Having only foo_<system>.cxx would be clear. ;-)

| This way works too if you generate correct linking for every case. It
starts
| to get worse when there are different targets that differ only slightly. I
| could imagine that I'd have e.g.:
| System <-- SystemLinux <-- SystemFreeBSD as a class hierachie for Strategy
if
| FreeBSD is very similar to Linux and needs only a slightly different
| approach. Doing this with differnt files requires to duplicate all the
code
| instead of simply overloading one or two virtual functions.

That would be an advantage - maybe an alternative would be:

//in Pingus.hxx
#define System System_Win32

//in System.cxx
class System_Base
{
 char* basename(char*);
}

//in System_Win32.cxx
class System_Win32: public System_Base
{
   char* statdir(); //just overload the functions you want, not virtually
but at compile time
}

//in System_Posix.cxx
class System_Posix: public System_Base
{
  char* statdir(); //
}

//in System_BSD.cxx
class System_BSD: public System_Posix
{
  char* statdir(); //overload statdir
  //leave other Posix functions intact
}

Ginge





reply via email to

[Prev in Thread] Current Thread [Next in Thread]