### Struct

# Gck Builder

#### Description [src]

    struct GckBuilder {
      /* No available fields */
    }

A builder for a set of attributes. Add attributes to a builder, and then use `gck_builder_end()` to get the completed `GckAttributes`.

The fields of `GckBuilder` are private and not to be accessed directly.

#### Constructors

###### gck_builder_new

Create a new `GckBuilder` not allocated on the stack, so it can be shared across a single scope, and referenced / unreferenced.

#### Instance methods

###### gck_builder_add_all

Add all the `attrs` attributes to the builder. The attributes are added uncondititionally whether or not attributes with the same types already exist in the builder.

###### gck_builder_add_attribute

Add an attribute to the builder. The attribute is added unconditionally whether or not an attribute with the same type already exists on the builder.

###### gck_builder_add_boolean

Add a new attribute to the builder for the boolean `value`. Unconditionally adds a new attribute, even if one with the same `attr_type` already exists.

###### gck_builder_add_data

Add a new attribute to the builder with an arbitrary value. Unconditionally adds a new attribute, even if one with the same `attr_type` already exists.

###### gck_builder_add_date

Add a new attribute to the builder for the date `value`. Unconditionally adds a new attribute, even if one with the same `attr_type` already exists.

###### gck_builder_add_empty

Add a new attribute to the builder that is empty. Unconditionally adds a new attribute, even if one with the same `attr_type` already exists.

###### gck_builder_add_except

Add the attributes in `attrs` to the builder, with the exception of those in the argument list. The attributes are added uncondititionally whether or not attributes with the same types already exist in the builder.

###### gck_builder_add_exceptv

Add the attributes in `attrs` to the builder, with the exception of those whose types are specified in `except_types`. The attributes are added uncondititionally whether or not attributes with the same types already exist in the builder.

###### gck_builder_add_invalid

Add a new attribute to the builder that is invalid in the PKCS#11 sense. Unconditionally adds a new attribute, even if one with the same `attr_type` already exists.

###### gck_builder_add_only

Add the attributes specified in the argument list from `attrs` to the builder. The attributes are added uncondititionally whether or not attributes with the same types already exist in the builder.

###### gck_builder_add_onlyv

Add the attributes with the types in `only_types` from `attrs` to the builder. The attributes are added uncondititionally whether or not attributes with the same types already exist in the builder.

###### gck_builder_add_string

Add a new attribute to the builder for the string `value` or `NULL`. Unconditionally adds a new attribute, even if one with the same `attr_type` already exists.

###### gck_builder_add_ulong

Add a new attribute to the builder for the unsigned long `value`. Unconditionally adds a new attribute, even if one with the same `attr_type` already exists.

###### gck_builder_clear

Clear the builder and release all allocated memory. The builder may be used again to build another set of attributes after this function call.

###### gck_builder_copy

Make a copy of the builder and its state. The new builder is allocated with `gck_builder_new()` and should be freed with gck_builder_unref().

###### gck_builder_end

Take the attributes that have been built in the `GckBuilder`. The builder will no longer contain any attributes after this function call.

###### gck_builder_find

Find an attribute in the builder. Both valid and invalid attributes (in the PKCS#11 sense) are returned. If multiple attributes exist for the given attribute type, then the first one is returned.

###### gck_builder_find_boolean

Find a boolean attribute in the builder that has the type `attr_type`, is of the correct boolean size, and is not invalid in the PKCS#11 sense. If multiple attributes exist for the given attribute type, then the first\ one is returned.

###### gck_builder_find_date

Find a date attribute in the builder that has the type `attr_type`, is of the correct date size, and is not invalid in the PKCS#11 sense. If multiple attributes exist for the given attribute type, then the first one is returned.

###### gck_builder_find_string

Find a string attribute in the builder that has the type `attr_type`, has a non `NULL` value pointer, and is not invalid in the PKCS#11 sense. If multiple attributes exist for the given attribute type, then the first one is returned.

###### gck_builder_find_ulong

Find a unsigned long attribute in the builder that has the type `attr_type`, is of the correct unsigned long size, and is not invalid in the PKCS#11 sense. If multiple attributes exist for the given attribute type, then the first one is returned.

###### gck_builder_init

Initialize a stack allocated builder, with the default flags.

###### gck_builder_init_full

Initialize a stack allocated builder, with the appropriate flags.

###### gck_builder_ref

Add a reference to a builder that was created with `gck_builder_new()`. The builder must later be unreferenced again with gck_builder_unref().

###### gck_builder_set_all

Set all the `attrs` attributes to the builder. If any attributes with the same types are already present in the builder, then those attributes are changed to the new values.

###### gck_builder_set_boolean

Set an attribute on the builder for the boolean `value`. If an attribute with `attr_type` already exists in the builder then it is changed to the new value, otherwise an attribute is added.

###### gck_builder_set_data

Set a new attribute to the builder with an arbitrary value. If an attribute with `attr_type` already exists in the builder then it is changed to the new value, otherwise an attribute is added.

###### gck_builder_set_date

Set an attribute on the builder for the date `value`. If an attribute with `attr_type` already exists in the builder then it is changed to the new value, otherwise an attribute is added.

###### gck_builder_set_empty

Set an attribute on the builder that is empty. If an attribute with `attr_type` already exists in the builder then it is changed to the new value, otherwise an attribute is added.

###### gck_builder_set_invalid

Set an attribute on the builder that is invalid in the PKCS#11 sense. If an attribute with `attr_type` already exists in the builder then it is changed to the new value, otherwise an attribute is added.

###### gck_builder_set_string

Set an attribute on the builder for the string `value` or `NULL`. If an attribute with `attr_type` already exists in the builder then it is changed to the new value, otherwise an attribute is added.

###### gck_builder_set_ulong

Set an attribute on the builder for the unsigned long `value`. If an attribute with `attr_type` already exists in the builder then it is changed to the new value, otherwise an attribute is added.

###### gck_builder_take_data

Add a new attribute to the builder with an arbitrary value. Unconditionally adds a new attribute, even if one with the same `attr_type` already exists.

###### gck_builder_unref

Unreferences a builder. If this was the last reference then the builder is freed.