dmitry boyarintsev wrote:
Hello Developers

I'm a bit puzzled there're 2 units in fpc-xml: xmlcfg and xmlconfg

xmlconf is the actual one. xmlcfg is unable to properly handle non-ascii data.
Maybe it's a good idea to declare it deprecated by now.

Both of them declare TXMLConfig class. The interfaces of both classes
seems to be quite identical.

They are mostly identical, so that transition can be generally done simply by replacing the unit name in uses clause.

If one of them is up-kept for backward compatibility, shouldn't it be like:

[code]
unit
  xmlcfg;

uses
  xmlconfig;

type
  TXMLConfig = class(xmlconfig.TXMLConfig);
[/code]
or vice versa?!

To avoid pulling legacy workarounds into new code, abd be able to read the 
already existing data
at the same time, the choice was made to leave the old unit as is and write a 
new one.

LCL also provides its own TXMLConfig at Laz_XMLCfg (with the same interface).

I'm pretty sure that compiler is not smart enough to smart-link away
(similar) classes :)
So I guess, there's alway a risk of duplicating code (3 times, by
using 3 different TXMLConfigs).

So, what unit should an IDE extension and/or LCL components use?

Unit that will get compiled into user's programs should use xmlconf. IDE components typically use laz_xmlcfg.

xmlconf: is used by LazReport
  - LazReport had faced issues with Unicode in the meantime, so it switched 
over.
xmlcfg: is used by Grids, XMLPropStorage and the packager
(RegisterFCL.pas, but not sure why)
  - The rest didn't.
Laz_XMLCfg: is used by LazarusIDE, CodeTools, packager (!!) and fpdoceditor

Regards,
Sergei

--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to