discuss-gnustep
[Top][All Lists]
Advanced

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

Re: splitting a class in pieces, compile-time dependent


From: Riccardo Mottola
Subject: Re: splitting a class in pieces, compile-time dependent
Date: Sat, 27 Jul 2013 10:34:25 +0200
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:22.0) Gecko/20100101 Firefox/22.0 SeaMonkey/2.19

Hi,

MicheleBert . wrote:
2013/7/23 Riccardo Mottola <riccardo.mottola@libero.it>:
I want to find  a good way to split this in MyClass-A, MyClass-B, etc by
adding the least possible logic and especially keeping everything static ad
build time (not runtime).
I am not sure I understood well, but I can guess a suggestion?
Could be done something like following? (I write in C++, but I think
there is an objc equivalent)

class MyClassSpecific
{
#if defined(_A_)
  <A stuff>
#elif defined(_B_)
   <B stuff>
#endif
};

class MyClass : public MyClassSpecific
{
   <common stuff>
};
That is essentially quite similar to the beginning code. But how do you split this in different files?

I ended up implementing David's version which actually works (thanks David).
The only thing which I don't like about that version is that the different files are "included" in a class implementation file (.m) and not explicitly in the makefile. I essentially tried to do the same thing, but with explicit separation of headers and of course it didn't work. If such a project had to be managed in ProjectCenter it wouldn't work, for example: project files are added automatically to the make file. I checked and "make dist" works, but it still might pose problems when distribution make package lists.

I still have stuff to improve, but for now I like the first clean-up, it made the code (and also the necessary imports) much much better. The only dirty part is actually my linux code which has tons of ivars.

Riccardo



reply via email to

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