Gorilla.JSON.BSON
Unit Gorilla.JSON.BSON.pasClasses
- TBsonWriter = class ( TJsonWriter )
- TBsonReader = class ( TJsonReader )
Enumerations
- enum TBsonType = ( BsonDocument, Float, String, Object, Array, Binary, Undefined, Oid, Boolean, DateTime, Null, Regex, Reference, Code, Symbol, CodeWScope, Integer, TimeStamp, Long, MinKey, MaxKey ) ;
TBsonType
Code of each bson type. See http://bsonspec.org/spec.html
TBsonWriter
Writer to serialize data into Bson. See http://bsonspec.org/
Ancestors
Members
Fields
- protected FEncoding :
TEncoding
- protected FWriter :
TBinaryWriter
- protected FWriterOwner :
Boolean
- protected FRoot :
TBsonWriter.TBsonContainer
- protected FParent :
TBsonWriter.TBsonContainer
- protected FPropertyName :
string
Methods
- public constructor Create ( const ABinaryWriter : TBinaryWriter ) ;
- public constructor Create ( const Stream : TStream ) ;
- public destructor Destroy ( ) ;
- protected procedure AddContainer ( const Token : TBsonWriter.TBsonContainer ) ;
- protected procedure AddSize ( Size : Integer ) ; inline;
- protected function WriteContainerSize ( Container : TBsonWriter.TBsonContainer ) : Integer ;
- protected procedure WriteType ( BsonType : TBsonType ) ;
- protected procedure WriteKey ( ) ;
- protected procedure WriteInteger ( const Value : Integer ) ;
- protected procedure WriteInt64 ( const Value : Int64 ) ;
- protected procedure WriteDouble ( const Value : Double ) ;
- protected procedure WriteString ( const Value : string ) ;
- protected procedure WriteCString ( const Value : string ) ;
- protected procedure WriteBytes ( const Value : TBytes; BinaryType : TJsonBinaryType ) ;
- protected procedure WriteBoolean ( const Value : Boolean ) ;
- protected procedure WriteOid ( const Value : TJsonOid ) ;
- protected procedure InternalWriteStartObject ( Inlined : Boolean ) ;
- protected procedure WriteEnd
(
const
Token :
TJsonToken
)
;
overload override;
Write the end token based on the token, this method does not updates the internal state
- public procedure Rewind ( ) ; override;
- public procedure Close
(
)
;
override;
Close the writer and flushes the document. See "Flush"
- public procedure Flush
(
)
;
override;
Calculates and writes the preceding size of each object/array written in the underliying stream/BinaryWriter. If the document is not finished (the last end token is not written yet) the containers will be closed by written the end token but without updating the internal writer state
- public procedure WriteComment
(
const
Comment :
string
)
;
override;
Writes a comment
- public procedure WriteStartObject
(
)
;
override;
Writes the start of a json object
- public procedure WriteEndObject
(
)
;
override;
Writes the end of a json object
- public procedure WriteStartArray
(
)
;
override;
Writes the start of a json array
- public procedure WriteEndArray
(
)
;
override;
Writes the end of a json array
- public procedure WriteStartConstructor
(
const
Name :
string
)
;
override;
Writes the start of a javascript constructor
- public procedure WritePropertyName
(
const
Name :
string
)
;
overload override;
Writes a property name
- public procedure WriteNull
(
)
;
override;
Writes a null value
- public procedure WriteRaw
(
const
Json :
string
)
;
override;
Writes a raw json, it does not update the internal state
- public procedure WriteRawValue
(
const
Json :
string
)
;
override;
Writes a raw json, it updates the internal state
- public procedure WriteUndefined
(
)
;
override;
Writes an undefined value
- public procedure WriteValue
(
const
Value :
string
)
;
overload override;
Writes an string value
- public procedure WriteValue
(
Value :
Integer
)
;
overload override;
Writes an Integer value
- public procedure WriteValue
(
Value :
Cardinal
)
;
overload override;
Writes an UInt32 value
- public procedure WriteValue
(
Value :
Int64
)
;
overload override;
Writes an Int64 value
- public procedure WriteValue
(
Value :
UInt64
)
;
overload override;
Writes an UInt64 value value
- public procedure WriteValue
(
Value :
Single
)
;
overload override;
Writes a Single value
- public procedure WriteValue
(
Value :
Double
)
;
overload override;
Writes a Double value
- public procedure WriteValue
(
Value :
Extended
)
;
overload override;
Writes an Extended value
- public procedure WriteValue
(
Value :
Boolean
)
;
overload override;
Writes a Boolean value
- public procedure WriteValue
(
Value :
Char
)
;
overload override;
Writes a Char value
- public procedure WriteValue
(
Value :
Byte
)
;
overload override;
Writes a Byte value
- public procedure WriteValue
(
Value :
TDateTime
)
;
overload override;
Writes a TDateTime value
- public procedure WriteValue
(
const
Value :
TGUID
)
;
overload override;
Writes a see "TGUID" value
- public procedure WriteValue
(
const
Value :
TBytes; BinaryType :
TJsonBinaryType
=
Generic
)
;
overload override;
Writes a Binary value. See http://bsonspec.org/spec.html
- public procedure WriteValue
(
const
Value :
TJsonOid
)
;
overload override;
Writes a see "TJsonOid" value. See http://bsonspec.org/spec.html
- public procedure WriteValue
(
const
Value :
TJsonRegEx
)
;
overload override;
Writes a see "TJsonRegEx" value. See http://bsonspec.org/spec.html
- public procedure WriteValue
(
const
Value :
TJsonDBRef
)
;
overload override;
Writes a see "TJsonDBRef" value. See http://bsonspec.org/spec.html
- public procedure WriteValue
(
const
Value :
TJsonCodeWScope
)
;
overload override;
Writes a see "TJsonCodeWScope" value. See http://bsonspec.org/spec.html
- public procedure WriteMinKey
(
)
;
overload override;
Writes a MinKey value. See http://bsonspec.org/spec.html
- public procedure WriteMaxKey
(
)
;
overload override;
Writes a MinKey value. See http://bsonspec.org/spec.html
- public procedure WriteCode ( const Code : string ) ;
Properties
TBsonReader
Reader to access Bson data. See http://bsonspec.org/
Ancestors
Members
Fields
- private FEncoding :
TEncoding
- private FCurrentElementType :
TBsonType
- private FReadRootValueAsArray :
Boolean
- private FReader :
TBinaryReader
- private FStack :
TObjectStack<Gorilla.JSON.BSON.TBsonReader.TContainerContext>
- private FCurrentContext :
TBsonReader.TContainerContext
- private FByteBuffer :
TBytes
- private FCharBuffer :
TCharArray
Methods
- public constructor Create ( const AStream : TStream; AReadAsRootValuesArray : Boolean = False ) ;
- public destructor Destroy ( ) ;
- private function ReadElement ( ) : string ;
- private function ReadCodeWScope ( ) : TJsonCodeWScope ;
- private function ReadRegEx ( ) : TJsonRegEx ;
- private function ReadDBRef ( ) : TJsonDBRef ;
- private function ReadDouble ( ) : Double ;
- private function ReadInteger ( ) : Integer ;
- private function ReadInt64 ( ) : Int64 ;
- private function ReadByte ( ) : Byte ;
- private function ReadString ( ) : string ; overload;
- private function ReadString ( ALength : Integer ) : string ; overload;
- private function ReadCString ( ) : string ;
- private function ReadType ( ) : TBsonType ;
- private procedure ReadByType ( AType : TBsonType ) ;
- private function ReadBinary ( out BinaryType : TJsonBinaryType ) : TBytes ;
- private function ReadBytes ( Count : Integer ) : TBytes ;
- private procedure MovePosition ( Count : Integer ) ; inline;
- private procedure PopContext ( FreeContext : Boolean ) ;
- private procedure PushContext ( const Context : TBsonReader.TContainerContext ) ;
- protected function ReadInternal ( ) : Boolean ; override;
- public procedure Close
(
)
;
override;
Changes the "TJsonReader.TState" to Closed.
- public procedure Skip
(
)
;
override;
Skips the children of the current token
- public procedure Rewind
(
)
;
override;
Resets the reader state to start read again
Properties
- public ReadRootValueAsArray : Boolean
Indicating whether the root object will be read as JSON array
read FReadRootValueAsArray
write FReadRootValueAsArray - public CurrentElementType : TBsonType
- public Reader : TBinaryReader