realbasic-plugins
[Top] [All Lists]

Re: Subclassing from my own plugin

To: REALbasic Plugins <realbasic-plugins at lists dot realsoftware dot com>
Subject: Re: Subclassing from my own plugin
From: "Theodore H. Smith" <delete at elfdata dot com>
Date: Sun, 24 Dec 2006 00:03:19 +0000
Delivered-to: listarchive at realsoftware dot com
Delivered-to: realbasic-plugins at lists dot realsoftware dot com
Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=googlemail.com; h=received:mime-version:in-reply-to:references:content-type:message-id:content-transfer-encoding:from:subject:date:to:x-mailer:sender; b=QtHec86ENjZjRYuSJFJsUC80JcENfsgH82EkihY85p769x3gN37CDB5hOxJZsVL8FqbZCHVFvTWsLFg9RUS1785v1Iw5VJjaMFQFYJ9GX7+48Cu9fNMIp/TTEHQpTuA2wT4eG6UqCt4jI5ZXYSLWGG1HoBS2q7gtT6gBPKvhLO0=
References: <AEC83D60-0393-47EC-8581-4A3F8E1A8365 at elfdata dot com> <FC16073D-8BAC-4974-9D8C-554E562B012B at elfdata dot com> <E02EF3F2-255C-4143-AC10-45B7E30765FB at mac dot com>

On 23 Dec 2006, at 23:23, Alfred Van Hoek wrote:


On Dec 23, 2006, at 5:56 PM, Theodore H.Smith wrote:

Both classes are within my ElfData plugin, btw. I'm not subclassing any RB classes!


Theodore,

If You define:

REALclassDefinition SubClassA = {
        kCurrentREALControlVersion,
        "ClassA",
        nil,
        sizeof(SubClassAData),
        0,
};

REALclassDefinition SubClassB = {
        kCurrentREALControlVersion,
        "ClassB",
        "ClassA",
        sizeof(SubClassBData),
        0,
};

REALclassDefinition SubClassC = {
        kCurrentREALControlVersion,
        "ClassC",
        "ClassB",
        sizeof(SubClassCData),
        0,
};


Then the instance in the following macros

ClassData(SubClassC, SubClassCData, instance, dataC);
ClassData(SubClassB, SubClassBData, instance, dataB);
ClassData(SubClassA, SubClassAData, instance, dataA);

will lead to valid dataA, dataB, and dataC pointers if a user would have instantiated a ClassC object.

I know that Alfred.

That's not my question. Can you re-read please?



_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>


From  Sun 24 Dec 2006 01:16:20 +0100
Return-Path: <realbasic-plugins-bounces at lists dot realsoftware dot com>
X-Original-To: listarchive at realsoftware dot com
Delivered-To: listarchive at realsoftware dot com
Received: by xmail.realsoftware.com (Postfix, from userid 1037)
        id 654C41492ED7; Sat, 23 Dec 2006 16:16:40 -0800 (PST)
X-Spam-Checker-Version: SpamAssassin 3.1.1 (2006-03-10) on www.realsoftware.com X-Spam-Level: X-Spam-Status: No, score=-2.5 required=4.5 tests=AWL,BAYES_00 autolearn=ham version=3.1.1
Received: from lists.realsoftware.com (lists.realsoftware.com [209.198.132.125])
        by xmail.realsoftware.com (Postfix) with ESMTP id 8D5681492EC7;
        Sat, 23 Dec 2006 16:16:36 -0800 (PST)
Received: from lists.realsoftware.com (localhost [127.0.0.1])
        by lists.realsoftware.com (Postfix) with ESMTP
        id 58A49176E72E; Sat, 23 Dec 2006 18:16:27 -0600 (CST)
X-Original-To: realbasic-plugins at lists dot realsoftware dot com
Delivered-To: realbasic-plugins at lists dot realsoftware dot com
Received: from smtprelay01.ispgateway.de (smtprelay01.ispgateway.de
        [80.67.18.13])
        by lists.realsoftware.com (Postfix) with ESMTP id 12CFD176E721
        for <realbasic-plugins at lists dot realsoftware dot com>;
        Sat, 23 Dec 2006 18:16:22 -0600 (CST)
Received: (qmail 18293 invoked from network); 24 Dec 2006 00:16:20 -0000
Received: from unknown (HELO [192.168.1.80]) (363246 at [84 dot 175 dot 108 dot 
144])
        (envelope-sender <support at monkeybreadsoftware dot de>)
        by smtprelay01.ispgateway.de (qmail-ldap-1.03) with SMTP
        for <realbasic-plugins at lists dot realsoftware dot com>;
        24 Dec 2006 00:16:20 -0000
To: realbasic-plugins at lists dot realsoftware dot com (REALbasic Plugins)
In-Reply-To: <AEC83D60-0393-47EC-8581-4A3F8E1A8365 at elfdata dot com>
From: support at monkeybreadsoftware dot de (Christian Schmitz)
Date: Sun, 24 Dec 2006 01:16:20 +0100
Message-ID: <1hqtsrh dot 1cdx64v1x2a07yM%support at monkeybreadsoftware dot de>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Organization: Monkeybread Software Germany
X-Face: nrf3>{WQ6c&r+7 at e)"]0G60`-6ND^)I2mI%>)QGYa=9"=7jhd-g2|b3!>Al0+
        Ccb%xGQshhi|g at QU2$
User-Agent: MacSOUP/D-2.7 (Mac OS X version 10.4.8)
Subject: Re: Subclassing from my own plugin
X-BeenThere: realbasic-plugins at lists dot realsoftware dot com
X-Mailman-Version: 2.1.2
Precedence: list
Reply-To: REALbasic Plugins <realbasic-plugins at lists dot realsoftware dot 
com>
Sender: realbasic-plugins-bounces at lists dot realsoftware dot com
Errors-To: realbasic-plugins-bounces at lists dot realsoftware dot com

Theodore H. Smith <delete at elfdata dot com> wrote:

I've started making my first plugin class which is a subclass of =20
another class.

Ok.

Now, I have a question. Are there any known issues with this?

No.
=20
Basically, I'm assuming that subclassing in RB works like it's =20
supposed to.

Yes. But if you subclass RB and C++ you have two sub classes which do
not work together directly.

struct b {
      int f1;
      int f2;
};

No. You should not assume that RB stored the data from a before or
behind the b data.

So you go the way Alfred showed. With different structs for each class.

Otherwise, I must pass around 2 or 3 pointers to some functions when
I really only wanted to access one pointer :(

I do normally declare a struct with all the fields ever used in the
subclasses and than only use that one struct for all.

Gru=DF
Christian

--=20
Around eleven thousand functions in one REALbasic plug-in.=20
The Monkeybread Software Realbasic Plugin v6.5. Now universal!
<http://www.monkeybreadsoftware.de/realbasic/plugins.shtml>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>