record TgoBsonArray

DescriptionHierarchyInternal Classes and RecordsFieldsMethodsProperties

Unit

Declaration

type TgoBsonArray = record

Description

An array of other BSON values

Overview

Internal Classes and Records

_IArray = interface(TgoBsonValue._IValue)

Methods

class function Create(const ACapacity: Integer = 0): TgoBsonArray; overload; static;
class function Create(const AValues: array of TgoBsonValue): TgoBsonArray; overload; static;
class function Create(const AValues: TArray<TgoBsonValue>): TgoBsonArray; overload; static;
class function Parse(const AJson: String): TgoBsonArray; static;
class function TryParse(const AJson: String; out AArray: TgoBsonArray): Boolean; static;
class function Load(const ABson: TBytes): TgoBsonArray; static;
class function TryLoad(const ABson: TBytes; out AArray: TgoBsonArray): Boolean; static;
class function LoadFromJsonFile(const AFilename: String): TgoBsonArray; static;
class function LoadFromJsonStream(const AStream: TStream): TgoBsonArray; static;
class function LoadFromBsonFile(const AFilename: String): TgoBsonArray; static;
class function LoadFromBsonStream(const AStream: TStream): TgoBsonArray; static;
procedure SaveToJsonFile(const AFilename: String); overload;
procedure SaveToJsonFile(const AFilename: String; const ASettings: TgoJsonWriterSettings); overload;
procedure SaveToJsonStream(const AStream: TStream); overload;
procedure SaveToJsonStream(const AStream: TStream; const ASettings: TgoJsonWriterSettings); overload;
procedure SaveToBsonFile(const AFilename: String);
procedure SaveToBsonStream(const AStream: TStream);
class operator Implicit(const A: TgoBsonArray): TgoBsonValue; static;
class operator Equal(const A, B: TgoBsonArray): Boolean; static;
class operator NotEqual(const A, B: TgoBsonArray): Boolean; static;
function IsNil: Boolean; inline;
procedure SetNil; inline;
function Clone: TgoBsonArray; inline;
function DeepClone: TgoBsonArray; inline;
function ToBson: TBytes; inline;
function ToJson: String; overload; inline;
function ToJson(const ASettings: TgoJsonWriterSettings): String; overload; inline;
function Add(const AValue: TgoBsonValue): TgoBsonArray; inline;
function AddRange(const AValues: array of TgoBsonValue): TgoBsonArray; overload;
function AddRange(const AValues: TArray<TgoBsonValue>): TgoBsonArray; overload; inline;
function AddRange(const AValues: TgoBsonArray): TgoBsonArray; overload; inline;
procedure Delete(const AIndex: Integer); inline;
function Remove(const AValue: TgoBsonValue): Boolean; inline;
function Clear: TgoBsonArray; inline;
function Contains(const AValue: TgoBsonValue): Boolean; inline;
function IndexOf(const AValue: TgoBsonValue): Integer; inline;
function ToArray: TArray<TgoBsonValue>; inline;
function GetEnumerator: TEnumerator; inline;

Properties

property Count: Integer read GetCount;
property Items[constAIndex:Integer]: TgoBsonValue read GetItem write SetItem;

Description

Methods

class function Create(const ACapacity: Integer = 0): TgoBsonArray; overload; static;

Creates an empty BSON array.

Parameters
ACapacity
(optional) initial capacity of the array. You can reduce memory reallocations if you know in advance the (approximate) number of values the array is going to hold.
Returns

The empty BSON array

class function Create(const AValues: array of TgoBsonValue): TgoBsonArray; overload; static;

Creates a BSON array an populates it with a Delphi array of values.

Parameters
AValues
the Delphi array of values to populate the BSON array with.
Returns

The BSON array

Exceptions raised
EArgumentNilException
if any of the values in the array has not been assigned (if their IsNil returns True for those).
class function Create(const AValues: TArray<TgoBsonValue>): TgoBsonArray; overload; static;

Creates a BSON array an populates it with a Delphi array of values.

Parameters
AValues
the Delphi array of values to populate the BSON array with.
Returns

The BSON array

Exceptions raised
EArgumentNilException
if any of the values in the array has not been assigned (if their IsNil returns True for those).
class function Parse(const AJson: String): TgoBsonArray; static;

See TgoBsonValue.Parse

class function TryParse(const AJson: String; out AArray: TgoBsonArray): Boolean; static;

See TgoBsonValue.TryParse

class function Load(const ABson: TBytes): TgoBsonArray; static;

See TgoBsonValue.Load

class function TryLoad(const ABson: TBytes; out AArray: TgoBsonArray): Boolean; static;

See TgoBsonValue.TryLoad

class function LoadFromJsonFile(const AFilename: String): TgoBsonArray; static;

See TgoBsonValue.LoadFromJsonFile

class function LoadFromJsonStream(const AStream: TStream): TgoBsonArray; static;

See TgoBsonValue.LoadFromJsonStream

class function LoadFromBsonFile(const AFilename: String): TgoBsonArray; static;

See TgoBsonValue.LoadFromBsonFile

class function LoadFromBsonStream(const AStream: TStream): TgoBsonArray; static;

See TgoBsonValue.LoadFromBsonStream

procedure SaveToJsonFile(const AFilename: String); overload;

See TgoBsonValue.SaveToJsonFile

procedure SaveToJsonFile(const AFilename: String; const ASettings: TgoJsonWriterSettings); overload;

See TgoBsonValue.SaveToJsonFile

procedure SaveToJsonStream(const AStream: TStream); overload;

See TgoBsonValue.SaveToJsonStream

procedure SaveToJsonStream(const AStream: TStream; const ASettings: TgoJsonWriterSettings); overload;

See TgoBsonValue.SaveToJsonStream

procedure SaveToBsonFile(const AFilename: String);

See TgoBsonValue.SaveToBsonFile

procedure SaveToBsonStream(const AStream: TStream);

See TgoBsonValue.SaveToBsonStream

class operator Implicit(const A: TgoBsonArray): TgoBsonValue; static;

Implicitly casts a BSON array to a BSON value.

class operator Equal(const A, B: TgoBsonArray): Boolean; static;

See TgoBsonValue.Equal

class operator NotEqual(const A, B: TgoBsonArray): Boolean; static;

See TgoBsonValue.NotEqual

function IsNil: Boolean; inline;

See TgoBsonValue.IsNil

procedure SetNil; inline;

See TgoBsonValue.SetNil

function Clone: TgoBsonArray; inline;

See TgoBsonValue.Clone

function DeepClone: TgoBsonArray; inline;

See TgoBsonValue.DeepClone

function ToBson: TBytes; inline;

See TgoBsonValue.ToBson

function ToJson: String; overload; inline;

See TgoBsonValue.ToJson

function ToJson(const ASettings: TgoJsonWriterSettings): String; overload; inline;

See TgoBsonValue.ToJson

function Add(const AValue: TgoBsonValue): TgoBsonArray; inline;

Adds a value to the array.

Parameters
AValue
the value to add.
Returns

The array itself, so you can use it for chaining.

Exceptions raised
EArgumentNilException
if AValue has not been assigned (if IsNil returns True).
function AddRange(const AValues: array of TgoBsonValue): TgoBsonArray; overload;

Adds a range of values to the array.

Parameters
AValues
the Delphi array of values to add to the array.
Returns

The array itself, so you can use it for chaining.

Exceptions raised
EArgumentNilException
if any of the values in the array has not been assigned (if their IsNil returns True for those).
function AddRange(const AValues: TArray<TgoBsonValue>): TgoBsonArray; overload; inline;

Adds a range of values to the array.

Parameters
AValues
the Delphi array of values to add to the array.
Returns

The array itself, so you can use it for chaining.

Exceptions raised
EArgumentNilException
if any of the values in the array has not been assigned (if their IsNil returns True for those).
function AddRange(const AValues: TgoBsonArray): TgoBsonArray; overload; inline;

Adds a range of values from another BSON array to this array.

Parameters
AValues
the BSON array of values to add to this array.
Returns

The array itself, so you can use it for chaining.

Exceptions raised
EArgumentNilException
if AValues has not been assigned or any of the values in the array has not been assigned (if their IsNil returns True for those).
procedure Delete(const AIndex: Integer); inline;

Deletes a value from the array by index.

Parameters
AIndex
the index of the value to delete.
Exceptions raised
EArgumentOutOfRangeException
in AIndex is out of bounds.
function Remove(const AValue: TgoBsonValue): Boolean; inline;

Removes a value from the array.

Note: the Equal operator of AValue is used to check if the value is in the array.

Parameters
AValue
the value to remove.
Returns

True if the value was removed. False if the array does not contain the value.

Exceptions raised
EArgumentNilException
if AValue has not been assigned (if IsNil returns True).
function Clear: TgoBsonArray; inline;

Clears the array.

Returns

The array itself, so you can use it for chaining.

function Contains(const AValue: TgoBsonValue): Boolean; inline;

Checks if the array contains a given value.

Note: the Equal operator of AValue is used to check if the value is in the array.

Parameters
AValue
the value to look for.
Returns

True if the array contains the value.

function IndexOf(const AValue: TgoBsonValue): Integer; inline;

Returns the index of a value in the array.

Note: the Equal operator of AValue is used to check if the value is in the array.

Parameters
AValue
the value to look for.
Returns

The index of the value in the array, or -1 if the array does not contain the value.

function ToArray: TArray<TgoBsonValue>; inline;

Returns the values in the array as a Delphi array of values.

Returns

The Delphi array of BSON values

function GetEnumerator: TEnumerator; inline;

Allow for..in enumeration of the values in the array.

Properties

property Count: Integer read GetCount;

Number of items in the array

property Items[constAIndex:Integer]: TgoBsonValue read GetItem write SetItem;

The items in the array.

Parameters
AIndex
the index of the item to get or set.
Exceptions raised
EArgumentOutOfRangeException
in AIndex is out of bounds. EArgumentNilException when setting the item and AValue is not assigned (IsNil returns True)

Generated by P2PasDoc 0.13.0 on 2017-04-25 12:54:26