Fwupd.Codec
Description: Reference for Fwupd.Codec

### Interface

# FwupdCodec

#### Description [src]

    interface Fwupd.Codec : GObject.Object

A codec that can serialize and deserialize objects to formats such as text, JSON or `GVariant`.

#### Prerequisite

In order to implement Codec, your type must inherit from`GObject`.

#### Implementations

- FwupdBiosSetting
- FwupdDevice
- FwupdPlugin
- FwupdRelease
- FwupdRemote
- FwupdReport
- FwupdRequest
- FwupdSecurityAttr

#### Functions

###### fwupd_codec_array_from_variant

Converts an array of objects, each deserialized from a `GVariant` value.

since: 2.0.0

###### fwupd_codec_array_to_json

Converts an array of objects into a `GVariant` value.

since: 2.0.0

###### fwupd_codec_array_to_variant

Converts an array of objects into a `GVariant` value.

since: 2.0.0

###### fwupd_codec_json_append

Appends a key and value to a JSON object.

deprecated: 2.1.1 since: 2.0.0

###### fwupd_codec_json_append_bool

Appends a key and boolean value to a JSON object.

deprecated: 2.1.1 since: 2.0.0

###### fwupd_codec_json_append_int

Appends a key and unsigned integer to a JSON object.

deprecated: 2.1.1 since: 2.0.0

###### fwupd_codec_json_append_map

Appends a key and string hash map to a JSON object.

deprecated: 2.1.1 since: 2.0.10

###### fwupd_codec_json_append_strv

Appends a key and string array to a JSON object.

deprecated: 2.1.1 since: 2.0.0

###### fwupd_codec_string_append

Appends a key and value to a string.

since: 2.0.0

###### fwupd_codec_string_append_bool

Appends a key and boolean value to a string.

since: 2.0.0

###### fwupd_codec_string_append_hex

Appends a key and hex integer to a string.

since: 2.0.0

###### fwupd_codec_string_append_int

Appends a key and unsigned integer to a string.

since: 2.0.0

###### fwupd_codec_string_append_size

Appends a key and size in bytes to a string.

since: 2.0.0

###### fwupd_codec_string_append_time

Appends a key and time value to a string.

since: 2.0.0

#### Instance methods

###### fwupd_codec_add_string

Converts an object that implements `FwupdCodec` to a debug string, appending it to `str`.

since: 2.0.0

###### fwupd_codec_from_json

Converts an object that implements `FwupdCodec` from a JSON object.

since: 2.0.0

###### fwupd_codec_from_json_string

Converts an object that implements `FwupdCodec` from a JSON string.

since: 2.0.0

###### fwupd_codec_from_variant

Converts an object that implements `FwupdCodec` from a `GVariant` value.

since: 2.0.0

###### fwupd_codec_to_json

Converts an object that implements `FwupdCodec` to a JSON builder object.

since: 2.0.0

###### fwupd_codec_to_json_string

Converts an object that implements `FwupdCodec` to a JSON string.

since: 2.0.0

###### fwupd_codec_to_string

Converts an object that implements `FwupdCodec` to a debug string.

since: 2.0.0

###### fwupd_codec_to_variant

Converts an object that implements `FwupdCodec` to a `GVariant`.

since: 2.0.0

#### Interface structure

    struct FwupdCodecInterface {
      GTypeInterface g_iface;
      void (* add_string) (
        FwupdCodec* self,
        guint idt,
        GString* str
      );
      gchar* (* to_string) (
        FwupdCodec* self
      );
      void (* add_json) (
        FwupdCodec* self,
        FwupdJsonObject* json_obj,
        FwupdCodecFlags flags
      );
      gboolean (* from_json) (
        FwupdCodec* self,
        FwupdJsonObject* json_obj,
        GError** error
      );
      void (* add_variant) (
        FwupdCodec* self,
        GVariantBuilder* builder,
        FwupdCodecFlags flags
      );
      GVariant* (* to_variant) (
        FwupdCodec* self,
        FwupdCodecFlags flags
      );
      gboolean (* from_variant) (
        FwupdCodec* self,
        GVariant* value,
        GError** error
      );
      void (* from_variant_iter) (
        FwupdCodec* self,
        GVariantIter* iter
      );
      void (* _fwupd_reserved1) (
    void
      );
      void (* _fwupd_reserved2) (
    void
      );
      void (* _fwupd_reserved3) (
    void
      );
      void (* _fwupd_reserved4) (
    void
      );
      void (* _fwupd_reserved5) (
    void
      );
      void (* _fwupd_reserved6) (
    void
      );
      void (* _fwupd_reserved7) (
    void
      );

    }

No description available.

###### Interface members

`g_iface` |
    GTypeInterface
| No description available.
`add_string` |
    void (* add_string) (
        FwupdCodec* self,
        guint idt,
        GString* str
      )
| No description available.
`to_string` |
    gchar* (* to_string) (
        FwupdCodec* self
      )
| No description available.
`add_json` |
    void (* add_json) (
        FwupdCodec* self,
        FwupdJsonObject* json_obj,
        FwupdCodecFlags flags
      )
| No description available.
`from_json` |
    gboolean (* from_json) (
        FwupdCodec* self,
        FwupdJsonObject* json_obj,
        GError** error
      )
| No description available.
`add_variant` |
    void (* add_variant) (
        FwupdCodec* self,
        GVariantBuilder* builder,
        FwupdCodecFlags flags
      )
| No description available.
`to_variant` |
    GVariant* (* to_variant) (
        FwupdCodec* self,
        FwupdCodecFlags flags
      )
| No description available.
`from_variant` |
    gboolean (* from_variant) (
        FwupdCodec* self,
        GVariant* value,
        GError** error
      )
| No description available.
`from_variant_iter` |
    void (* from_variant_iter) (
        FwupdCodec* self,
        GVariantIter* iter
      )
| No description available.
`_fwupd_reserved1` |
    void (* _fwupd_reserved1) (
    void
      )
| No description available.
`_fwupd_reserved2` |
    void (* _fwupd_reserved2) (
    void
      )
| No description available.
`_fwupd_reserved3` |
    void (* _fwupd_reserved3) (
    void
      )
| No description available.
`_fwupd_reserved4` |
    void (* _fwupd_reserved4) (
    void
      )
| No description available.
`_fwupd_reserved5` |
    void (* _fwupd_reserved5) (
    void
      )
| No description available.
`_fwupd_reserved6` |
    void (* _fwupd_reserved6) (
    void
      )
| No description available.
`_fwupd_reserved7` |
    void (* _fwupd_reserved7) (
    void
      )
| No description available.

#### Virtual methods

###### Fwupd.Codec.add_json

No description available.

###### Fwupd.Codec.add_string

Converts an object that implements `FwupdCodec` to a debug string, appending it to `str`.

since: 2.0.0

###### Fwupd.Codec.add_variant

No description available.

###### Fwupd.Codec.from_json

Converts an object that implements `FwupdCodec` from a JSON object.

since: 2.0.0

###### Fwupd.Codec.from_variant

Converts an object that implements `FwupdCodec` from a `GVariant` value.

since: 2.0.0

###### Fwupd.Codec.from_variant_iter

No description available.

###### Fwupd.Codec.to_string

Converts an object that implements `FwupdCodec` to a debug string.

since: 2.0.0

###### Fwupd.Codec.to_variant

Converts an object that implements `FwupdCodec` to a `GVariant`.

since: 2.0.0