DL Logo

PDCollectionSchema Typedefs

PDCollectionSchema

Header: PDExpT.h:7065

Description

An opaque pointer to a collection schema object.

A PDCollectionSchema is ordered with the following considerations. The PDCollectionSchema has characteristics of both a collection of named fields and an array. Field names are guaranteed to be unique. Indexing is guaranteed to be 0-based, in ascending order, with no gaps. When repositioning a field by changing its index, the schema will be re-indexed as necessary to conform to this convention. If a field is assigned an out-of-bound index, the index is adjusted to be in bounds rather than raising an error.

Syntax

typedef struct CPDCollectionSchema *PDCollectionSchema;

Returned From

Used By

PDCollectionSchema Structures

_t_PDCollectionSchemaSortPair

Header: PDExpT.h:7003

Description

The name of a field in a collection sort dictionary, and its associated value for ascending.

Syntax

struct _t_PDCollectionSchemaSortPair {
ASAtom fieldName;
ASBool ascending;
} PDCollectionSchemaSortPairRec;

Used By

PDCollectionSchema Functions

PDCollectionSchemaAcquire

Header: PDProcs.h:12419

Description

Acquires the PDCollectionSchema object for a collection.

Syntax

PDCollectionSchema PDCollectionSchemaAcquire(PDCollection collection);

Parameters

collection
The collection object.

Returns

The collection object.

PDCollectionSchemaDestroy

Header: PDProcs.h:12425

Description

Destroys a PDCollectionSchema object.

Syntax

void PDCollectionSchemaDestroy(PDCollectionSchema schema);

Parameters

collection
The collection object.

Returns

The collection object.

PDCollectionSchemaGetField

Header: PDProcs.h:12443

Description

Gets a field by name or position. The caller must set field.size to sizeof(PDCollectionFieldRec). To look up a field by name, set field.fieldName to the appropriate name. To look up a field by position, set field.fieldName to ASAtomNull, and set field.index to the position. The caller owns (and must destroy) field.fieldText if it is not NULL.

Syntax

ASBool PDCollectionSchemaGetField(PDCollectionSchema schema, PDCollectionFieldRec *field);

Parameters

schema
The collection schema object.
field
The field to be obtained.

Returns

true if the field was found, false otherwise.

PDCollectionSchemaGetLength

Header: PDProcs.h:12431

Description

Gets the number of fields in the schema.

Syntax

ASArraySize PDCollectionSchemaGetLength(PDCollectionSchema schema);

Parameters

collection
The collection object.

Returns

The number of fields in the schema.

PDCollectionSchemaRemoveField

Header: PDProcs.h:12461

Description

Removes a field from the collection schema.

Syntax

void PDCollectionSchemaRemoveField(PDCollectionSchema schema, ASAtom fieldName);

Parameters

schema
The collection schema.
fieldName
The name of the field to remove from the collection schema.

PDCollectionSchemaSetField

Header: PDProcs.h:12455

Description

Sets a field with new values. The target field is identified by the field.fieldName member. If the target field exists, it is overwritten; otherwise a new field is added. The caller must set field.size to sizeof(PDCollectionFieldRec). Specifying a new value for field.index will affect other field values as necessary to maintain the correct overall ordering. See PDCollectionSchema for information about ordering.

Syntax

void PDCollectionSchemaSetField(PDCollectionSchema schema, const PDCollectionFieldRec *field);

Parameters

schema
The collection schema object.
field
The field to add or modify in the collection schema.