Permalink
Browse files

jsonDoc v1.1.8

  • Loading branch information...
stijnsanders committed Nov 1, 2018
1 parent 5002604 commit 78c7c627715fe32177459514ef420a09f2468cd2
Showing with 504 additions and 116 deletions.
  1. +15 −2 bsonTools.pas
  2. +489 −114 jsonDoc.pas
View
@@ -2,11 +2,11 @@
TMongoWire: bsonTools.pas
Copyright 2010-2017 Stijn Sanders
Copyright 2010-2018 Stijn Sanders
Made available under terms described in file "LICENSE"
https://github.com/stijnsanders/TMongoWire
v1.1.0
v1.1.1
}
unit bsonTools;
@@ -61,6 +61,7 @@ TBSONDocArray=class(TJSONImplBaseObj, IJSONArray, IJSONDocArray,
function AddJson(const Data: WideString): integer; stdcall;
procedure LoadItem(Index: integer; const Doc: IJSONDocument); stdcall;
procedure Clear; stdcall;
function GetJSON(Index: integer): WideString; stdcall;
//IBSONDocArray
procedure ReadAll(Data: TStream); stdcall;
procedure WriteAll(Data: TStream); stdcall;
@@ -1103,6 +1104,18 @@ procedure TBSONDocArray.LoadItem(Index: integer; const Doc: IJSONDocument);
LoadBSON(FData,Doc);
end;
function TBSONDocArray.GetJSON(Index: integer): WideString;
var
Doc:IJSONDocument;
begin
if (Index<0) or (Index>=FRefIndex) then
raise ERangeError.Create('Out of range');
FData.Position:=FRef[Index];
Doc:=JSON;
LoadBSON(FData,Doc);
Result:=Doc.ToString;
end;
procedure TBSONDocArray.Set_Item(Index: integer; const Value: Variant);
var
p:integer;
Oops, something went wrong.

0 comments on commit 78c7c62

Please sign in to comment.