ROBinHelpers

Overview

ROBinHelpers represents helper class that provides methods for correct conversion NSDate to Delphi Date and vise versa, getting ANSI strings from NSData and methods for raising RO-encoding specific exceptions.

Location

Class Methods


ansiStringFromNSData:

Class method that creates and returns ANSI string from given bytes buffer.

+ (NSString *) ansiStringFromNSData:(NSData *)theData

Parameters:

  • theData: incoming bytes buffer.

delphiDateToNSDate:

Class method that translates Delphi date (presented as double value) to corresponding NSDate instance.

+ (NSDate *) delphiDateToNSDate:(double)aDate

Parameters:

  • aDate: incoming value that represents date in Delphi format.

nsDateToDelphiDate:

Class method that translates given NSDate instance to corresponding double value that can be read on Delphi side.

+ (double) nsDateToDelphiDate:(NSDate *)aDate

Parameters:

  • aDate: NSDate instance we want to convert to Delphi date.

unexpectedBinaryLength

Class method that just raises RO Exception with message "BinMessage: Invalid binary length read from stream." Raises on attempt reading bytes buffer with size more than whole message size. This exception indicates that message was broken.

+ (void) unexpectedBinaryLength

unexpectedEndOfStream

Class method that just raises RO Exception with message "BinMessage: Unexpected end of stream." Raises on attempt reading message with length less than binary header size. This exception indicates that message was broken.

+ (void) unexpectedEndOfStream

unexpectedStringLength

Class method that just raises RO Exception with message "BinMessage: Invalid string length read from stream." Raises on attempt reading string with length more than whole message size. This exception indicates that message was broken.

+ (void) unexpectedStringLength