2024 April Release

Interface CooContent Permanent link for this heading

This interface describes methods available when working with contents.

Methods Permanent link for this heading

Return Type

Signature

boolean

Compare(
  content content)

content

Copy()

string

GetContent(
  transaction transaction,
  integer flags,
  integer codepage)

datetime

GetDate()

string

GetHash()

integer

GetID()

integer

GetSize()

boolean

IsModified()

void

SetContent(
  transaction transaction,
  integer flags,
  integer codepage,
  string content)

void

Split()

Methods Permanent link for this heading


Compare Permanent link for this heading

Returns true if this content has the same identity as the passed content.
Note: This method does not compare the content data.

boolean Compare(
  content content)

Name

Description

content

The other content.

Copy Permanent link for this heading

Copies a content.

content Copy()


GetContent Permanent link for this heading

Retrieves the content of a content as string. The size of the content and the resulting string both must not exceed 4 GiB.

string GetContent(
  transaction transaction,
  integer flags,
  integer codepage)

Name

Description

transaction

The transaction to be used (e.g. cootx for the current one).

flags

COOGC_MULTIBYTEFILE ... The content is stored using a 8-bit encoding specified by the code page.
COOGC_UNICODEFILE ... The content is stored using UTF-16 little endian without byte order mark.
COOGC_BASE64 ... The binary content is returned as Base64 encoded string.
COOGC_BASE16 ... The binary content is returned as Base16 encoded string.
COOGC_DETECTENCODING .. The content encoding is detected by the byte order mark (supported are UTF-8, UTF-16 big and little endian), if present, otherwise it is assumed to be UTF-8, if decoding is successful, if not it is treated as ANSI codepage 1252 (Latin 1/Western Europe).

codepage

The source codepage of the content.
COOGC_ACP ... The content is stored using the ANSI codepage 1252 (Latin 1/Western Europe), except if a UTF-8 byte order mark is present.
COOGC_UTF7 ... The content is stored using UTF-7 encoding.
COOGC_UTF8 ... The content is stored using UTF-8 encoding and may contain a byte order mark.

GetDate Permanent link for this heading

Retrieves the modification date of the content.

datetime GetDate()


GetHash Permanent link for this heading

Retrieves the hash of the content.

string GetHash()


GetID Permanent link for this heading

Retrieves the identification number of the content.

integer GetID()


GetSize Permanent link for this heading

Retrieves the size of the content.

integer GetSize()


IsModified Permanent link for this heading

Tests whether the content is modified.

boolean IsModified()


SetContent Permanent link for this heading

Sets the content of a content with a string.

void SetContent(
  transaction transaction,
  integer flags,
  integer codepage,
  string content)

Name

Description

transaction

The transaction to be used (e.g. cootx for the current one).

flags

COOGC_MULTIBYTEFILE ... The string is stored using the given codepage.
COOGC_UNICODEFILE ... The string is stored using UTF-16 little endian encoding (without byte order mark).
COOGC_BASE64 ... The string is a Base64 encoded binary content which will be decoded before storing the binary data.
COOGC_BASE16 ... The string is a Base16 encoded binary content which will be decoded before storing the binary data.

codepage

The target codepage which is used to store the string.
COOGC_ACP ... The string is converted to the ANSI codepage 1252 (Latin 1/Western Europe). If conversion is not possible the error COOERR_INVCHARSEQUENCE is returned.
COOGC_UTF7 ... The string is stored using UTF-7 encoding.
COOGC_UTF8 ... The string is stored using UTF-8 encoding and prefixed with a byte order mark if not already present.

content

The Unicode string which should be stored within the content.

Split Permanent link for this heading

Disables copy-on-write for this instance by copying it if other references exist.
By default, an instance is copied whenever it is modified and other references exist so that those references remain unaffected and still refer to an unmodified instance. By splitting the instance, references created after the split operation keep referring to this instance even if it is modified. Consequently, splitting an instance is desirable if instance modifications should be visible to other references (instance sharing).

In expressions, all variables are split by default because expression scopes based on dictionaries or aggregates are guaranteed to be split. Therefore, this method is more relevant for other programming languages that do not perform auto-splitting.

void Split()