Giter VIP home page Giter VIP logo

superobject's People

Contributors

hgourvest avatar pierreyager avatar

Watchers

 avatar

superobject's Issues

Possible memory leak when trying to serialize an object

What steps will reproduce the problem?
  TSubClass = class
  public
    aSubString: string;
  end;

  TSubClass = class
  public
    aSubClass: TSubClass;
  end;

var
  x: TMyClass;

  x:=TMyClass.Create;
  x.FromJson('{"aSubClass": {"aSubString": ""}}');
  x.Free;

FromJson creates a new object but does not free it before.
1xTSubClass is not freed everytime you call FromJson.
I tried to find how to free it in the FromClass procedure but not succeed.

Original issue reported on code.google.com by [email protected] on 13 Aug 2012 at 11:35

Clone for stNull gives AV

What steps will reproduce the problem?

var
  j1, j2, j3: ISuperObject;
begin
  j1 := SO('{a:null}');
  j2 := j1.Clone;
  j3 := j2.Clone;
end;

What is the expected output? What do you see instead?
No AV.

What version of the product are you using? On what operating system?
Latest from svn (r54)

Please provide any additional information below.
Function TSuperObject.Clone for stNull returns nil. However parsing JSON object 
creates stNull object (not nil).

It should create be:
function TSuperObject.Clone: ISuperObject;
var
  ite: TSuperObjectIter;
  arr: TSuperArray;
  j: integer;
begin
  case FDataType of
    stNull: Result := TSuperObject.Create(stNull); <- add this
    stBoolean: ...

You could also add a check in Clone function, however I think that it should be 
consistent with Load/Parse. But I see that similar check was added in Merge 
function (r37). So I'm not sure which one is more correct. Maybe both, so add 
check in Clone for nil and clone stNull as TSuperObject.Create(stNull)?

Original issue reported on code.google.com by [email protected] on 22 Mar 2013 at 1:32

ParseStream broken in partial = false

What steps will reproduce the problem?
Call ParseStream with partial = false

What is the expected output? What do you see instead?
Crash

Please provide any additional information below.
Refer to unused local variable st.  It is reference by tok._char_offset.

Suggested fix attached.


Original issue reported on code.google.com by [email protected] on 10 Jul 2012 at 6:16

Attachments:

Compiling r50 in D6

Version r50 does not compile in D6.
I have enclosed a patch file (made using Git). I actually made the fixes using 
version r48, but I just tested my main test case with this patch applied on top 
of r50.

I hope this is a sufficient report.

Original issue reported on code.google.com by [email protected] on 28 Feb 2012 at 3:15

Attachments:

double to json bug

Delphi7 
Windows xp

procedure TForm1.Button1Click(Sender: TObject);
var
  jo: ISuperObject;
begin
  jo := so('{a:1}');
  jo.D['a']:=1.0;
  ShowMessage(jo.AsJSon(False,false));
end;

output:
{"a":1.}

  '1.' is not a valid json number,it should be '1.0'

Original issue reported on code.google.com by [email protected] on 21 Feb 2011 at 3:49

Ignore russian symbols

123.txt
{
"firstName": "Testing",
"stroka": [ "прпрп","прпр","имсимс" ]
}

I use the code:
var
  obj:  ISuperObject;
  item: ISuperObject;
begin

  obj := TSuperObject.ParseFile('123.txt', true, true);

  for item in obj['stroka'] do
    Memo1.Lines.add(item.AsString); 

in Memo1 i have 
Memo1
i?i?i
i?i?
einein

how read and output from file russian words 

Original issue reported on code.google.com by [email protected] on 1 Nov 2010 at 1:02

writeln() causes I/O error in GUI app

What steps will reproduce the problem?
1. Create a record that contains another record.
2. Use a TSuperRttiContext to convert the record to JSON

What is the expected output? What do you see instead?
The subrecord should either be parsed (preferably) or otherwise be ignored.

Instead, you'll arrive on line 7063 
(http://code.google.com/p/superobject/source/browse/trunk/superobject.pas#7063),
 where there's a `writeln` statement. That causes an I/O error in GUI 
applications.


What version of the product are you using? On what operating system?
revision 42

Please provide any additional information below.
For the rest the TSuperRttiContext is a huge timesaver. SuperObject  is awesome.

Original issue reported on code.google.com by woutervannifterick on 24 Feb 2012 at 1:33

class type expected, but got "IUnknown"

What steps will reproduce the problem?
1. I've downloaded super object 1.2.4.
2. I've written very simple pascal program which includes "superobject" in uses 
part.
3. When I compile the program, compiler gives me that error:
superobject.pas(1304, 17) Error: class type expected, but got "IUnknown"

What is the expected output? What do you see instead?
I expected it to work properly. Because due to your documents, it should work 
on Free Pascal.

What version of the product are you using? On what operating system?
I am using Free Pascal 2.4.2 as compiler on Ubuntu 10.10 Destop version.

Please provide any additional information below.
My simple program is:

{$UNITPATH ../../units/SuperObject124/}

uses superobject;
begin
end.

Original issue reported on code.google.com by [email protected] on 20 Dec 2010 at 11:54

Cannot add an array to the ISuperObject

What steps will reproduce the problem?
1. Declare variable o: ISuperObject;
2. Assign variable with o := so('');
3. Try to "add" an array like o.A['Test'] := TSuperArray.Create;

What is the expected output? What do you see instead?
It should be able to compile.

What version of the product are you using? On what operating system?
1.2.4

Please provide any additional information below.
I added it myself in the code but if I want to download an update again it will 
be redundant.

Original issue reported on code.google.com by [email protected] on 21 Jun 2012 at 2:05

Trunk Won't compile on Linux with FPC 2.6.0 No implementation for IUnknown

What steps will reproduce the problem?
1.Use on linux with Lazarus 0.9.30.4-0 and FPC 2.6.0  
2.Simply won't compile 

What is the expected output? What do you see instead?

On the exact same FPC version on win32 it works fine, on Linux it won't compile


What version of the product are you using? On what operating system?

Trunk from SVN on Ubuntu 12.04 32bit with Lazarus 0.9.30.4-0 and FPC 2.6.0 


Please provide any additional information below.

/home/components/superobject/superobject.pas(154,18) Error: No matching 
implementation for interface method "IUnknown._AddRef:LongInt; CDecl;" found
/home/components/superobject/superobject.pas(154,18) Error: No matching 
implementation for interface method "IUnknown._Release:LongInt; CDecl;" found
/home/components/superobject/superobject.pas(858,1) Fatal: There were 2 errors 
compiling module, stopping




Original issue reported on code.google.com by [email protected] on 17 Apr 2012 at 8:25

Access Violation within Application.Terminate

What steps will reproduce the problem?
1. When i use Application.Terminate i get an access violation in the following 
lines:

function TSuperObject._Release: Integer; stdcall;
begin
  Result := InterlockedDecrement(FRefCount);
  if Result = 0 then
    Destroy;         <-----
end;

Erste Gelegenheit für Exception bei $00684C48. Exception-Klasse $C0000005 mit 
Meldung 'access violation at 0x00684c48: write of address 0x00678a58'. Prozess 
Test.exe (4496)
What is the expected output? What do you see instead?

2. V1.2 on Win7 Ultimate.. Both Delphi XE2 AND XE3

Original issue reported on code.google.com by [email protected] on 9 Oct 2012 at 4:46

Problem with deserialization

I found an issue with deserialization. When I try to deserialize json which 
doesn't contain all object's fields or contains null I got Marshalling Error.
Please check the source code in attached file.

Kind Regards
P.S.

Original issue reported on code.google.com by [email protected] on 20 Mar 2013 at 2:31

Attachments:

pseudo namespace affects output order


Delphi 2010
SOT, superobject.pas SVN Rev 20

Issue: Order in 2nd test below is changed

--- 1 - OK

    str := '{"w":"World","h":["Hello"]}';
    resp := SO(str);
    str := resp.AsJSon();

    str => {"w":"World","h":["Hello"]}

--- 2 - FAIL

    str := '{"ns:w":"World",h:["Hello"]}';
    resp := SO(str);
    str := resp.AsJSon();

    str => {"h":["Hello"],"ns:w":"World"}

--- 3 - OK

    str := '{"ns:w":"World","ns:h":["Hello"]}';
    resp := SO(str);
    str := resp.AsJSon();

    str => {"ns:w":"World","ns:h":["Hello"]}


Original issue reported on code.google.com by [email protected] on 8 Mar 2010 at 1:44

exception on the SO deep procedure

What steps will reproduce the problem?
1.  collect data.
2.  add data to json.
3.  first call is ok. just like before.
4.  second call will exception and hung.

What is the expected output? What do you see instead?

Access violation at address 05435379 in module 'vif_iis.dll'. Write of address 
0AD713C0

What version of the product are you using? On what operating system?
Win7 64bit+xe3


Please provide any additional information below.

http://p13.freep.cn/p.aspx?u=v20_p13_photo_1304181534184397_0.jpg 

http://iegood.com/p.aspx?u=v20_p1_photo_1304181534358549_0.jpg 

see the picture.
=========
btw,the author update the superobject so slowly.



Original issue reported on code.google.com by [email protected] on 19 Apr 2013 at 12:44

Does not support extended RTTI for Delphi XE

What steps will reproduce the problem?
1. Compile with Delphi XE
2. Attempt to compile the RTTI demo.

The simple fix would be to change the {$IFDEF VER210} to {$IFDEF EXTRTTI} and 
add the following block to the top of the unit:

{$if defined(VER210) or defined(VER220)}
{$DEFINE EXTRTTI}
{$ifend}

Original issue reported on code.google.com by [email protected] on 30 Sep 2010 at 5:47

Superobject not retrieving tems in same order as in json-file

I'm not sure if this is an issue, or if I'm missing something.

What steps will reproduce the problem?

1. I compiled the VirtualTreeView demo in XE5 and opened the sample json-file. 
Things were organised alphabetically. 
2. I changed the property "TreeOptions.AutoOptions" by removing toAutoSort and 
expected the treeview to display items in the same order as in the sample file, 
but they were not.

For example in the treeview bicycle is displayed before book even though they 
are the other way round in the file. And all category, author, title, price are 
also mixed up.


What version of the product are you using?

Sourcecode downloaded October 4th 2013.


Please provide any additional information below.

I've seen other issues mentioning "pseudo namespace" and hashes. Are these what 
cause this behaviour ? Is there any property or parameter that can be changed 
to get the desired unaltered order ?

Original issue reported on code.google.com by [email protected] on 8 Oct 2013 at 11:06

SuperObjects to XE5 Android and IOS

Hi, is there any way to remove the use of DLLs and SO libraries in SuperObjects 
to make it portable to XE5 Android and IOS Apps? 

Regards, 

Al

Original issue reported on code.google.com by [email protected] on 25 Oct 2013 at 9:45

Doesn't compile on FPC 2.7.1 on Linux, QueryInterface, _AddRef and _Release declarations

QueryInterface, _AddRef and _Release have a different signature on FPC on 
Linux. (cdecl instead of stdcall)

Index: source/superobject.pas
===================================================================
--- source/superobject.pas  (révision 54)
+++ source/superobject.pas  (copie de travail)
@@ -654,8 +654,8 @@
 {$ELSE}
     function QueryInterface(const IID: TGUID; out Obj): HResult; virtual; stdcall;
 {$ENDIF}
-    function _AddRef: Integer; virtual; stdcall;
-    function _Release: Integer; virtual; stdcall;
+    function _AddRef : longint;{$IFNDEF WINDOWS}cdecl{$ELSE}stdcall{$ENDIF};
+    function _Release : longint;{$IFNDEF WINDOWS}cdecl{$ELSE}stdcall{$ENDIF};

     function GetO(const path: SOString): ISuperObject;
     procedure PutO(const path: SOString; const Value: ISuperObject);
@@ -5223,12 +5223,12 @@
   end;
 end;

-function TSuperObject._AddRef: Integer; stdcall;
+function TSuperObject._AddRef : longint;{$IFNDEF 
WINDOWS}cdecl{$ELSE}stdcall{$ENDIF};
 begin
   Result := InterlockedIncrement(FRefCount);
 end;

-function TSuperObject._Release: Integer; stdcall;
+function TSuperObject._Release : longint;{$IFNDEF 
WINDOWS}cdecl{$ELSE}stdcall{$ENDIF};
 begin
   Result := InterlockedDecrement(FRefCount);
   if Result = 0 then
@@ -7611,4 +7611,4 @@
   Assert(debugcount = 0, 'Memory leak');
 {$ENDIF}
 end.
-

Original issue reported on code.google.com by [email protected] on 9 Jan 2013 at 2:53

Bug in free pascal when not using {$DEFINE UNICODE}

What steps will reproduce the problem?
1. Use lazarus free pascal IDE
2. Remove the {$DEFINE UNICODE}, or just put a dot like this {.$DEFINE UNICODE}
3. Try to compile any application with superobject unit

What is the expected output? What do you see instead?

superobject.pas(2166,55) Error: Incompatible type for arg no. 7: Got
"TSuperType", expected "ISuperObject"


What version of the product are you using? On what operating system?
1.2.2 - Windows XP

Please provide any additional information below.

on line 2166 we see the code
ParseEx(tok, buffera, size, this, options, put, dt)
where a parameter is missing.
the missing parameter is "strict" and the corrected line is
ParseEx(tok, buffera, size, strict, this, options, put, dt)
once you do this, the problem is solved and the unit compiles with any
Lazarus application.

Thanks to Henri Gourvest for this great work. It is very useful.


Original issue reported on code.google.com by [email protected] on 27 Dec 2009 at 9:27

Compile error in latest version - UUIDToString compiler define issue

What steps will reproduce the problem?
1. Build latest in Delphi 2006
2. [Pascal Error] superobject.pas(820): E2065 Unsatisfied forward or external 
declaration: 'UUIDToString'

Quickest solution:

move the definitions of 
  function UUIDToString(const g: TGUID): string;
  function StringToUUID(const str: string; var g: TGUID): Boolean;

Down underneath the next line
  {$IFDEF HAVE_RTTI}


Alternately, move the implementation of these two methods outside of this 
define scope.

Original issue reported on code.google.com by [email protected] on 14 Oct 2011 at 5:55

FPC not dealing with {$if true}...{$ifend}

Hi there,

I'm developing a Twitter lib(Dweetta) and while trying to compile under
Lazarus, it complains about the switches.

superobject.pas:601
{$if true}
    FO: record
      case TSuperType of
        stBoolean: (c_boolean: boolean);
        stDouble: (c_double: double);
        stCurrency: (c_currency: Currency);
        stInt: (c_int: SuperInt);
        stObject: (c_object: TSuperTableString);
        stArray: (c_array: TSuperArray);
{$IFDEF SUPER_METHOD}
        stMethod: (c_method: TSuperMethod);
{$ENDIF}
      end;
{$ifend}
-------------------------8<--------------------

I'm sorry not to give a patch, but I still need some more study of your source.

Cheers,
Gus

Original issue reported on code.google.com by guscarreno on 14 Dec 2009 at 11:32

Bug with boolean values

When we have values string like:
{"teste": ["False","false","0","f","F"]}
in all this cases getting B[Value] return True

Original issue reported on code.google.com by [email protected] on 13 Dec 2011 at 1:20

FPC 2.6 and iOS Compiler Error

What steps will reproduce the problem?
Compiling under XCode with FPC 2.6 i get the following errors

superobject.pas(154,18) Error: No matching implementation for interface method 
"IUnknown._AddRef:LongInt; CDecl;" found

superobject.pas(154,18) Error: No matching implementation for interface method 
"IUnknown._Release:LongInt; CDecl;" found

superobject.pas(857,1) Fatal: There were 2 errors compiling module, stopping

What version of the product are you using? On what operating system?
Latest SVN version.


Please provide any additional information below.

It is possible to use superobject on iOS? would be great cause it saves a lot 
of work and it does a great job handling JSON with delphi.


Thanks in advance,

Omar Zelaya

Original issue reported on code.google.com by [email protected] on 23 Mar 2012 at 3:16

SOT Exception Type

Use SOT exceptions instead of the base Exception; e.g., 

        raise exception.Create('Marshalling error');



Original issue reported on code.google.com by [email protected] on 8 Mar 2010 at 2:46

Error parsing simple JSON : space added to identifier.


Given the following code

Var
  R : ISuperObject;

begin
  R:=SO('{Readers : []}');
end;

Then

R.A['Readers'] is nil.

Instead,

R.A['Readers '] contains the array. 

Obviously, the space should not be there. 

Removing the space after 'Readers':

  R:=SO('{Readers: []');

gives expected result, that is:

R.A['Readers'] 

contains the array.

In JavaScript, the space is ignored. 
(unless you put quotes around it, of course)

Original issue reported on code.google.com by [email protected] on 27 Mar 2012 at 7:18

Compile for iOS

[DCC Error] SuperObject.pas(601): E2154 Type 'TSuperTableString' needs 
finalization - not allowed in variant record
[DCC Error] SuperObject.pas(602): E2154 Type 'TSuperArray' needs finalization - 
not allowed in variant record

Original issue reported on code.google.com by [email protected] on 18 May 2013 at 2:41

TSuperObject.ParseStream won't work with "non-seekable" streams (patch included)

What steps will reproduce the problem?
I've made very simple JSON formatter (console in/out stream) based on 
TSuperObject, but TSuperObject.ParseStream doesn't work with "non-seekable" 
streams like "stdin".

What is the expected output? What do you see instead?
TSuperObject.ParseStream should not use stream.Seek method.

What version of the product are you using? On what operating system?
Latest svn.

Please provide any additional information below.
Patch attached that makes TSuperObject.ParseStream work without using Seek 
method of stream.

Original issue reported on code.google.com by [email protected] on 31 Mar 2013 at 5:43

Attachments:

parse ansi to unicode

The recommended changes are part of the code

In the "Append" method need to first "buff" convert "AnsiString", 
further "Stream.Write"
In the "TSuperObject.ParseStream", the non-Unicode, it should be "buffera" 
first into "SOString" re-assigned to the same "bufferw"


Original issue reported on code.google.com by [email protected] on 16 Jan 2010 at 9:44

Patch to support /Date(n)/ format

What steps will reproduce the problem?
1. Request a dataset from Azure datamarket

You'll get something like this:
    {
         "SomeField": "Hello",
         "DateStart": "\/Date(939772800000)\/"
    }


2. Use TSuperRTTIContext.AsType<T>() to parse the json into a record.

type TSomeRec=record SomeField:String; DateStart:TDateTime);
var SomeRec:TSomeRec;
begin
  SomeRec := TSuperRTTIContext.AsType<TSomeRec>  ('{SomeField:"xx",DateStart:"\/Date(939772800000)\/"');
end;

What is the expected output? What do you see instead?

The date doesn't get parsed because of the formatting.

Please provide any additional information below.

Related:
http://stackoverflow.com/questions/206384/how-to-format-a-json-date

/Date(n)/ seems to be a pretty common way to format json dates, and the version 
of serialfromdatetime below supports it.

function serialfromdatetime(ctx: TSuperRttiContext; const obj: ISuperObject; 
var Value: TValue): Boolean;
var
  dt: TDateTime;
  i: Int64;
  s:String;
begin
  case ObjectGetType(obj) of
  stInt:
    begin
      TValueData(Value).FAsDouble := JavaToDelphiDateTime(obj.AsInteger);
      Result := True;
    end;
  stString:
    begin
      s := obj.AsString;
      if Length(s)>length('/Date()') then
        if (pos('/Date(',S)=1) and (S[Length(S)]='/') then
        begin
          Delete(S,Length(S)-1,2);
          Delete(S,1,6);
          Result := TryStrToInt64(S,I);
          if Result then
            TValueData(Value).FAsDouble := JavaToDelphiDateTime(I);
          Exit;
        end;

      if ISO8601DateToJavaDateTime(s, i) then
      begin
        TValueData(Value).FAsDouble := JavaToDelphiDateTime(i);
        Result := True;
      end else
      if TryStrToDateTime(s, dt) then
      begin
        TValueData(Value).FAsDouble := dt;
        Result := True;
      end else
        Result := False;
    end;
  else
    Result := False;
  end;
end;


Original issue reported on code.google.com by woutervannifterick on 29 Nov 2012 at 1:22

DelphiDateTimeToISO8601Date not working with Delphi 7

What steps will reproduce the problem?
1. Invoke the method SuperObject.DelphiDateTimeToISO8601Date(now) in Delphi 7

What is the expected output? What do you see instead?
A string with formatted date

Please provide any additional information below.
The problem is the sign variable is declared as SOChar, what is mapped as 
WideChar type for Delphi 7, and Format method not support WideChar.
The code below show the Delphi 7 problem.

var
  vChar: WideChar;
begin
  vChar := 'a';
  Format('%s', [vChar]);

Original issue reported on code.google.com by [email protected] on 16 Sep 2012 at 6:33

Insufficient RTTI available Error on some records

I am using Delphi XE 
I have a record


     tmyrec=packed record
       myname:string ; 
       mysurname:string  ;
       myage:integer;
       mydate:tdatetime;
     end;

Using superobject I can convert it to a json string but when I try it with 

     tmyrec=packed record
       myname:string[50] ; 
       mysurname:string[50]  ; //I put limited strings here
       myage:integer;
       mydate:tdatetime;
     end;

I get error 
Insufficient RTTI available to support this operation.


How can I serialize such records? can you send an example? thank you.


Original issue reported on code.google.com by [email protected] on 8 Jun 2011 at 2:14

Delphi 6 Hash function raise EIntOverflow exception

Running demo VirtualTreeView raise exception.

Change compiler directives to this helped:

class function TSuperAvlEntry.Hash(const k: SOString): Cardinal;
var
  h: cardinal;
  i: Integer;
begin
  h := 0;
{$Q-}
  for i := 1 to Length(k) do
    h := Cardinal( h*129 + ord(k[i]) + $9e370001);
  Result := h;
end;
{$Q+}

Original issue reported on code.google.com by [email protected] on 4 Dec 2010 at 12:56

Path resolution on TSuperObject

Please review the following results when quoting path expressions that may
or may not include namespace notation.

Test #5 shows the expected results. It would be nice if #3 or #4 produced
the same results, but I'm not sure what the SOT path spec says about pseudo
namespaces. 

I was hoping that quoted or escaped path notation from via the root SO
would work.

--- 1

    str := '{ "ns_h": [ { "color": "red" }, { "color": "blue" } ] }';
    resp := SO(str);
    iso := resp['ns_h'];

    iso.AsString => [{"color":"red"},{"color":"blue"}]

--- 2

    str := '{ "ns_h": [ { "color": "red" }, { "color": "blue" } ] }';
    resp := SO(str);
    iso := resp['"ns_h"'];

    iso.AsString => ns_h

--- 3

    str := '{ "ns:h": [ { "color": "red" }, { "color": "blue" } ] }';
    resp := SO(str);
    iso := resp['"ns:h"'];

    iso.AsString => ns:h

--- 4

    str := '{ "ns:h": [ { "color": "red" }, { "color": "blue" } ] }';
    resp := SO(str);
    iso := resp['ns:h'];

    iso => nil

--- 5

    str := '{ "ns:h": [ { "color": "red" }, { "color": "blue" } ] }';
    resp := SO(str);
    iso := resp.AsObject['ns:h'];

    iso.AsString => [{"color":"red"},{"color":"blue"}]

--- 6

    str := '{ "ns:h": [ { "color": "red" }, { "color": "blue" } ] }';
    resp := SO(str);
    iso := resp.AsObject['"ns:h"'];

    iso => nil

--- 7

    str := '{ "ns:h": [ { "color": "red" }, { "color": "blue" } ] }';
    resp := SO(str);
    iso := resp['ns:h[0].color'];

    iso => nil

--- 8

    str := '{ "ns_h": [ { "color": "red" }, { "color": "blue" } ] }';
    resp := SO(str);
    iso := resp['ns_h[0].color'];

    iso.AsString => red

--- 9

    str := '{ "ns:h": [ { "color": "red" }, { "color": "blue" } ] }';
    resp := SO(str);
    iso := resp['ns\:h'];

    iso => nil

--- 10

    str := '{ "ns\:h": [ { "color": "red" }, { "color": "blue" } ] }';
    resp := SO(str);
    iso := resp['ns\:h'];

    iso => nil

--- 11

    str := '{ "ns\:h": [ { "color": "red" }, { "color": "blue" } ] }';
    resp := SO(str);
    iso := resp['ns:h'];

    iso => nil

Original issue reported on code.google.com by [email protected] on 8 Mar 2010 at 4:35

SO support for ignore class fields due a custom attribute

I like to see SO to support field ignore due a delphi custom attribute like:

SOIgnore = class(TSuperAttribute);

where:


  TMyObjet = class
  public
    fieldA: Integer;
    [SOIgnore()]
    fieldB: Integer;
  end;

  obj = TMyObj.Create()
  obj.ToJson()

returning

  {
    fieldA: 1
  }


instead of

  {
    fieldA: 1,
    fieldB: 2
  }

Original issue reported on code.google.com by [email protected] on 6 Jun 2011 at 8:49

Document attribute support


SOT v1.2 supports D2010 attributes for marshalling, but I don't believe
it's documented.

Type

   TMyRecord = record

     [SOName('ns1:brand')]
     brand: String;

     [SOName('ns2:quantity')]
     amount: Integer;
   end;

Original issue reported on code.google.com by [email protected] on 8 Mar 2010 at 5:19

XE4 support

What steps will reproduce the problem?
1. Compile in XE4

What is the expected output? What do you see instead?
The compiler complains that DecimalSeparator does not exist.
That's because there are constructs like this:

{$if defined(NEED_FORMATSETTINGS)}FormatSettings.{$ifend}DecimalSeparator

NEED_FORMATSETTINGS is set for newer compilers, but not for XE4.

This will be an issue for every upcoming release. 

Maybe it's better to either detect old versions instead, and assume that this 
will never change in the future

Another option could be to use conditional expressions. 
That's what I did to get it to compile. I'm not sure in which exact version 
they were introduced though, so it could be troublesome for older versions.

{$if defined(FPC)}
  {$DEFINE HAVE_INLINE}
{$ifend}

{$if RTLVersion >= 17.0}
  {$DEFINE HAVE_INLINE}
{$ifend}

{$if RTLVersion >= 21.0}
  {$define HAVE_RTTI}
{$ifend}

{$if RTLVersion >= 23.0}
  {$define NEED_FORMATSETTINGS}
{$ifend}

{$if defined(FPC) and defined(VER2_6)}
  {$define NEED_FORMATSETTINGS}
{$ifend}


What version of the product are you using? On what operating system?
XE4

Please provide any additional information below.

Original issue reported on code.google.com by woutervannifterick on 11 Sep 2013 at 3:14

The WindowsNT Compatibility block is not compiling under FPC

Hey there,

superobject.pas:1006 until the block ends, has many problems under FPC.
 * Because you define {$MODE OBJFPC} you'll need to add the ^ to pointers
to DayLightCompareDate() and below.
 * Or define {$MODE DELPHI}, witch gets rid of this problem but still gets
stuck on the & at SysTime(see below)

superobject.pas:1091
 * Call to FileTimeToSystemTime() is failing to compile on the second param
&SysTime. Something about pointer conversion...

Again I'm very sorry not to provide a patch :-\

Cheers,
Gus

Original issue reported on code.google.com by guscarreno on 14 Dec 2009 at 11:43

OS X - Delphi XE3

I'm trying to compile SuperObject with Delphi XE3 in a firemonkey project but 
compiling for OS X results in failure.

When will there be support for XE3 / firemonkey?
Sadly the latest update is 2010 :(

Original issue reported on code.google.com by [email protected] on 4 Apr 2013 at 7:16

integer overflow exception when overflow

{$UNDEF SaveQ} {$IFOPT Q+} {$Q-} {$DEFINE SaveQ} {$ENDIF}
class function TSuperAvlEntry.Hash(const k: SOString): Cardinal;
var
  h: cardinal;
  i: Integer;
begin
  h := 0;
  for i := 1 to Length(k) do
    h := h*129 + ord(k[i]) + $9e370001;
  Result := h;
end;
{$IFDEF SaveQ} {$Q+} {$UNDEF SaveQ} {$ENDIF}

Original issue reported on code.google.com by [email protected] on 2 Dec 2011 at 7:22

AsString method returns null value as "null", but should be ''

What steps will reproduce the problem?
1. Input: {"strField":null}
2. source: superobject.pas
3. function TSuperObject.AsString: SOString;

What is the expected output? What do you see instead?
expected output: ''; (empty string)
now: 'null'

What version of the product are you using? On what operating system?
superobjectv1.2.4

Please provide any additional information below.
amendment:
function TSuperObject.AsString: SOString;
begin
  if FDataType = stNull then
    Result := '' else
    if FDataType = stString then
      Result := FOString else
      Result := AsJSon(false, false);
end;

Original issue reported on code.google.com by [email protected] on 26 Apr 2013 at 11:44

Desserialize Json Array to List<T>

There are not support to desserialize json array to TList<T> using 
TSuperObjectHelper.FromJson.

I implemented this and would like you to examine the code and included in the 
project. Attached is the Diff.

Original issue reported on code.google.com by [email protected] on 22 Jan 2013 at 4:51

Attachments:

Minor documentation errata

Parsing a JSON data structure example section of ReadMe.html shows the example:

obj := TSuperObject.ParseFile(FileName);

But this will not work as the 2nd 'strict' boolean parameter is not optional.

Original issue reported on code.google.com by [email protected] on 14 Oct 2011 at 6:20

double parse error

procedure TForm1.Button1Click(Sender: TObject);
var
  jo: ISuperObject;
begin
  jo := so('{a:74.6356}');
  Memo2.Text := jo.AsJSon(False, false);
end;

output:
{"a":74.635?}

Original issue reported on code.google.com by [email protected] on 7 Feb 2010 at 12:50

FormatSettings had changed in Delphi XE

Include Delphi XE in compiler directive

{$if defined(VER230)}
  {$define NEED_FORMATSETTINGS}
{$ifend}

replaced with

{$if defined(VER220) or defined(VER230)}
  {$define NEED_FORMATSETTINGS}
{$ifend}

Original issue reported on code.google.com by [email protected] on 26 May 2012 at 5:53

Double serialized as NaN, but without quotes, produce invalid json

What steps will reproduce the problem?
1. This is kind of random, so just encode a lot of Double randomized value 
(very high or very low I guess)
2. convert using superObj := superRttiContext.AsJson<Type>(Data);
3. save using superObj.SaveTo(filePath);

What is the expected output?
The actual double value or "NaN" with quotes

What do you see instead?
NaN without quote like {"X": NaN}


What version of the product are you using? On what operating system?
Lastest version from repo (at this date)
Windows XP, Delphi 2010


Thanks.

Original issue reported on code.google.com by [email protected] on 27 Oct 2011 at 4:20

Compile with BDS2006 brings trouble due to wrong header conversion (Keyword "this" is used in source)

What steps will reproduce the problem?
1. Start Borland Developer Studio 2006
2. Create Project, add superobject.pas and superxmlparser.pas
3. Use it in the source, like

TSuperObject *obj = new TSuperObject(__classid(TSuperObject));


What is the expected output? What do you see instead?

Expected: Compiling without problems.
Instead: Compile error, missing close bracket ")".


What version of the product are you using? On what operating system?
BDS2006, Windows Vista Business, 32bit.

Please provide any additional information below.

The problem happens due to "wrong" conversion/creation of the
superobject.hpp file which is auto-created due to compilation.

The problematic code happens here when the word "this" is used:
------------------------------------------------------------------
    /*         class method */ static _di_ISuperObject __fastcall
ParseString(TMetaClass* vmt, WideChar * s, bool strict, bool partial =
true, const _di_ISuperObject thisIsMe = (void *)(0x0), TSuperFindOptions
options = Set<TSuperFindOption, foCreatePath, foCallMethod> () , const
_di_ISuperObject put = (void *)(0x0), TSuperType dt = (TSuperType)(0x0));
    /*         class method */ static _di_ISuperObject __fastcall
ParseStream(TMetaClass* vmt, Classes::TStream* stream, bool strict, bool
partial = true, const _di_ISuperObject thisIsMe = (void *)(0x0),
TSuperFindOptions options = Set<TSuperFindOption, foCreatePath,
foCallMethod> () , const _di_ISuperObject put = (void *)(0x0), TSuperType
dt = (TSuperType)(0x0));
    /*         class method */ static _di_ISuperObject __fastcall
ParseFile(TMetaClass* vmt, const AnsiString FileName, bool strict, bool
partial = true, const _di_ISuperObject thisIsMe = (void *)(0x0),
TSuperFindOptions options = Set<TSuperFindOption, foCreatePath,
foCallMethod> () , const _di_ISuperObject put = (void *)(0x0), TSuperType
dt = (TSuperType)(0x0));
    /*         class method */ static _di_ISuperObject __fastcall
ParseEx(TMetaClass* vmt, TSuperTokenizer* tok, WideChar * str, int len,
bool strict, const _di_ISuperObject thisIsMe = (void *)(0x0),
TSuperFindOptions options = Set<TSuperFindOption, foCreatePath,
foCallMethod> () , const _di_ISuperObject put = (void *)(0x0), TSuperType
dt = (TSuperType)(0x0));

---------------------------------------

Search for:
const _di_ISuperObject this = (void *)(0x0)

in the lines.

That stuff brakes compilation. Possible reason: "this" is a reserved
keyword in c++.
Please rename every word "this" to something different, like "thisIsMe" or
something like that. I tried that for the 4 functions ParseString,
ParseStream, ParseFile and ParseEx. 

I attached a "fixed" Version which compiles also on BDS2006/C++ Builder.


Original issue reported on code.google.com by terminar on 27 May 2010 at 5:44

Attachments:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.