mdbs99 / james

James is a collection of object-oriented Pascal primitives for Lazarus and Delphi
MIT License
53 stars 20 forks source link

Create a new IDataPack interface #10

Closed mdbs99 closed 7 years ago

mdbs99 commented 7 years ago

This new interface IDataPack will represent any kind of data package. The first implementation will for XML using a new TXmlPack class.

The methods and its usage may be like this:

var
  Doc: IXMLDocument;
begin
  Doc :=
    TXMLDocument.Create(
      TXMLPack.New
        .Add('root')
          .Add('items')
            .Add('item')
              .Add('code', 1).Up
              .Add('description', 'foo').Up
        .Root
        .Stream
    );
  Doc.SaveTo('file.xml');
end;
heliosroots commented 7 years ago

How would signature for IDataPack?

mdbs99 commented 7 years ago

Initially, we will need a Stream method that returns a DataStream. That is the result. This entity represents a data pack, but could be any format (XML, JSON, INI, etc). Thus, we will have a class for each one. Then, I'm thinking to use some other methods to manipulate data like the example above. But these methods needs to be more generic as possible to work in all formats. This project here could be an inspiration.

mdbs99 commented 7 years ago

This issue will be fix using my new project called Xavier. Follow this https://github.com/mdbs99/james/issues/65#issuecomment-330058296 for more info.