🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #17413

Converting Object Pascal to C++

#17413
From: Rusty
Date: Wed, 26 Mar 2003 16:14
47 lines
2136 bytes
Greetings:

I was wondering if there was a good reference on the web that discusses how
to convert Object Pascal to C++.  While I'm at it, is the following
coversion correct:

Object Pacal version:
procedure TCustomColorBox.SetStyle(AStyle: TColorBoxStyle);
begin
  if AStyle <> Style then
  begin
    FStyle := AStyle;
    Enabled := ([cbStandardColors, cbExtendedColors, cbSystemColors,
cbCustomColor] * FStyle) <> [];
    PopulateList;
    if (Items.Count > 0) and (ItemIndex = -1) then
      ItemIndex := 0;
  end;
end;

C++ version:
void __fastcall TColorBoxAlpha::SetStyle( TColorBoxStyle AStyle )
{
     if( AStyle != Style )
     {
          FStyle = AStyle;

          TColorBoxStyle temp;
          temp << cbStandardColors
               << cbExtendedColors
               << cbSystemColors
               << cbCustomColor;

          if( false == TColorBoxStyle( temp * FStyle ).Empty( ) )
               { Enabled = true; }
          else
               { Enabled = false; }

          PopulateList( );

          if(    ( Items->Count > 0 )
              && ( ItemIndex == -1 )   )
          {
               ItemIndex = 0;
          }
     }
}
Technical Details
Message-ID: <3e81d1ca$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-09!supernews.com!iad-peer.news.verio.net!news.verio.net!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,732a1cf0646a66e3
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-03-26 21:05:49 PST
Reply-To: "Rusty" <rustyr@redstorm.com>
From: "Rusty" <rustyr@redstorm.com>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Converting Object Pascal to C++
Date: Wed, 26 Mar 2003 11:14:02 -0500
Lines: 49
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 208.221.166.2
Message-ID: <3e81d1ca$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1048695242 208.221.166.2 (26 Mar 2003 08:14:02 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-09!supernews.com!iad-peer.news.verio.net!news.verio.net!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail