Recent

Author Topic: IStringList...  (Read 4017 times)

cdbc

  • Hero Member
  • *****
  • Posts: 1232
    • http://www.cdbc.dk
IStringList...
« on: May 02, 2024, 08:32:20 am »
Hi
Well, I finally got my shijt together and done it  ::)
edit: new version out now 6.09.06.2024 which adds IStrings & support for observers.
For the longest time I've been missing an easy no frills way to do this:
Code: Pascal  [Select][+][-]
  1. procedure TfrmIntfMain.btnUtf8Click(Sender: TObject);
  2. var lst: IStringList;
  3. begin
  4.   if dlgOpen.Execute then begin
  5.     lst:= CreateStrList;
  6.     lst.LoadFromFile(dlgOpen.FileName);
  7.     // do some processing of lst-data
  8.     Memo1.Clear;
  9.     Memo1.Caption:= lst.Text;
  10.   end;
  11. end;
I mean without
Code: Pascal  [Select][+][-]
  1. sl:= TStringlist.Create;
  2. try
  3.   // use the list
  4. finally
  5.   sl.Free;
  6. end;
...and now finally(pun intended) I can  :D
You too if you so desire, I've made it public (i think) on my gitlab.
It's free for anyone to download and use, in the hope it can be of use to others.
Mind you, I'm not proficient in /gitlab'ing/ so I've tried my best to make it public...
Here it is: https://gitlab.com/cdbc-public/ibcstringlist
Enjoy  8-)
Regards Benny
« Last Edit: June 09, 2024, 12:11:32 pm by cdbc »
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 2.2.6 up until Jan 2024 from then on it's: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 3.0

Thaddy

  • Hero Member
  • *****
  • Posts: 14787
  • Censorship about opinions does not belong here.
Re: IStringList...
« Reply #1 on: May 02, 2024, 02:04:55 pm »
Benny, I am working on a small utility that parses a class for public methods and writes a COM based interface from that. Then rewrites the class header to include that interface. I will ping you when ready.
( I wanted that for years and picked it up again literally yesterday )
« Last Edit: May 02, 2024, 03:47:01 pm by Thaddy »
bitrate is always calculated like this:sample rate * bitdepth * number of channels.

cdbc

  • Hero Member
  • *****
  • Posts: 1232
    • http://www.cdbc.dk
Re: IStringList...
« Reply #2 on: May 02, 2024, 02:26:46 pm »
Hi Thaddy
Cool, that I'll be looking forward to  :)
...And today being today, I'll consider it a birthday-present, thank you  :D
Quote
( I wanted that for years and picked it up again literaly yesterday )
I know exactly what you mean, but something always came up...
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 2.2.6 up until Jan 2024 from then on it's: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 3.0

Thaddy

  • Hero Member
  • *****
  • Posts: 14787
  • Censorship about opinions does not belong here.
Re: IStringList...
« Reply #3 on: May 02, 2024, 03:25:02 pm »
Happy Birthday!
bitrate is always calculated like this:sample rate * bitdepth * number of channels.

cdbc

  • Hero Member
  • *****
  • Posts: 1232
    • http://www.cdbc.dk
Re: IStringList...
« Reply #4 on: May 02, 2024, 03:30:08 pm »
Thanks mate :)
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 2.2.6 up until Jan 2024 from then on it's: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 3.0

indydev

  • Jr. Member
  • **
  • Posts: 98
Re: IStringList...
« Reply #5 on: May 30, 2024, 06:29:00 pm »
This is nice! Now if I can put this and Thaddy's Smart Pointer example,

https://forum.lazarus.freepascal.org/index.php/topic,59468.msg443427.html#msg443427

to use  :)

cdbc

  • Hero Member
  • *****
  • Posts: 1232
    • http://www.cdbc.dk
Re: IStringList...
« Reply #6 on: May 30, 2024, 08:13:13 pm »
Hi
@indydev: notice the 'List' property/function... You can stick that anywhere, that expects a 'TStrings/TStringList' param  8-)
Have fun  :D
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 2.2.6 up until Jan 2024 from then on it's: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 3.0

Roland57

  • Sr. Member
  • ****
  • Posts: 445
    • msegui.net
Re: IStringList...
« Reply #7 on: May 31, 2024, 11:46:10 am »
Hello! Interesting but I cannot compile:

Compiling strip_v2.lpr
Compiling istrlist.pas
istrlist.pas(37,23) Fatal: Can't find unit sortbase used by istrlist
Fatal: Compilation aborted

My projects are on Gitlab and on Codeberg.

cdbc

  • Hero Member
  • *****
  • Posts: 1232
    • http://www.cdbc.dk
Re: IStringList...
« Reply #8 on: May 31, 2024, 01:14:03 pm »
Hi Roland
'sortbase.pp' is located here: ".../fpcsrc/rtl/inc/", on my install of trunk.
Hang on, I'll check with 3.2.2...
edit: Damn, it looks like I'm going to have to "ifdef" some parts of 'istrlist.pas', to fit both fpc-trunk & fpc-3.2.2 I'll get right on that...
Sorry mate
  :-[  I'll report back here when I'm done  :)
Regards Benny
« Last Edit: May 31, 2024, 01:35:55 pm by cdbc »
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 2.2.6 up until Jan 2024 from then on it's: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 3.0

Roland57

  • Sr. Member
  • ****
  • Posts: 445
    • msegui.net
Re: IStringList...
« Reply #9 on: May 31, 2024, 01:34:02 pm »
'sortbase.pp' is located here: ".../fpcsrc/rtl/inc/", on my install of trunk.
Hang on, I'll check with 3.2.2...

Thanks for your answer. After I copied the sortbase unit in my directory, I get this:

Free Pascal Compiler version 3.2.2 [2021/05/16] for x86_64
Target OS: Linux for x86-64
Compiling strip_v2.lpr
Compiling istrlist.pas
Compiling sortbase.pp
istrlist.pas(136,33) Error: Identifier not found "RTLString"

My projects are on Gitlab and on Codeberg.

cdbc

  • Hero Member
  • *****
  • Posts: 1232
    • http://www.cdbc.dk
Re: IStringList...
« Reply #10 on: May 31, 2024, 01:38:58 pm »
Hi
...Yeah got those too, when I tried to compile a simple example in fpc-3.2.2, there are a few... that particular one is just a string.
I'll start /IfDef'ing/ now, will report back here, when I'm done...
Hmmm, thought it over and with talks about a 3.2.4-fixes, I think I'll create an "istrlist322" for now and then maybe ifdef the real McCoy later... What do you think?!?
Sorry Mate  :-[
Regards Benny
« Last Edit: May 31, 2024, 01:44:40 pm by cdbc »
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 2.2.6 up until Jan 2024 from then on it's: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 3.0

Roland57

  • Sr. Member
  • ****
  • Posts: 445
    • msegui.net
Re: IStringList...
« Reply #11 on: May 31, 2024, 02:12:05 pm »
I think I'll create an "istrlist322"

Good! If you have time.  ;)
My projects are on Gitlab and on Codeberg.

cdbc

  • Hero Member
  • *****
  • Posts: 1232
    • http://www.cdbc.dk
Re: IStringList...
« Reply #12 on: May 31, 2024, 02:45:27 pm »
Hi
Right, so I've /ifdef'ed/ a working copy and it compiles in both trunk and 3.2.2
What remains is the *GitLab'ing* business  %)
I'll let you know when the new version is merged...
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 2.2.6 up until Jan 2024 from then on it's: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 3.0

cdbc

  • Hero Member
  • *****
  • Posts: 1232
    • http://www.cdbc.dk
Re: IStringList...
« Reply #13 on: May 31, 2024, 04:08:52 pm »
Hi
Roland there's a new version in GitLab, 4.31.05.2024, that now properly supports fpc v 3.2.2  8)
This, of course goes for all others too, that wish to try it out.
Have fun & Enjoy  8-)
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 2.2.6 up until Jan 2024 from then on it's: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 3.0

Roland57

  • Sr. Member
  • ****
  • Posts: 445
    • msegui.net
Re: IStringList...
« Reply #14 on: May 31, 2024, 04:31:15 pm »
Test successful. Thanks!
My projects are on Gitlab and on Codeberg.

 

TinyPortal © 2005-2018