Branch data Line data Source code
1 : : /* 2 : : * Copyright 2021 Collabora Ltd. 3 : : * Copyright Corentin Noël <corentin.noel@collabora.com> 4 : : * SPDX-License-Identifier: LGPL-2.1-or-later 5 : : */ 6 : : 7 : : #ifndef __GCR_CERTIFICATE_FIELD_PRIVATE_H__ 8 : : #define __GCR_CERTIFICATE_FIELD_PRIVATE_H__ 9 : : 10 : : #if !defined (__GCR_INSIDE_HEADER__) && !defined (GCR_COMPILATION) 11 : : #error "Only <gcr/gcr.h> can be included directly." 12 : : #endif 13 : : 14 : : #include "gcr-types.h" 15 : : #include "gcr-certificate-field.h" 16 : : 17 : : #include <glib-object.h> 18 : : 19 : : G_BEGIN_DECLS 20 : : 21 : : GcrCertificateSection *_gcr_certificate_section_new (const char *label, 22 : : gboolean important); 23 : : void _gcr_certificate_section_append_field (GcrCertificateSection *section, 24 : : GcrCertificateField *field); 25 : : GcrCertificateField *_gcr_certificate_field_new_take_value (GcrCertificateSection *section, 26 : : const char *label, 27 : : char *value); 28 : : GcrCertificateField *_gcr_certificate_field_new_take_values (GcrCertificateSection *section, 29 : : const char *label, 30 : : GStrv value); 31 : : GcrCertificateField *_gcr_certificate_field_new_take_bytes (GcrCertificateSection *section, 32 : : const char *label, 33 : : GBytes *bytes); 34 : : 35 : : static inline void 36 : 34 : _gcr_certificate_section_new_field_take_value (GcrCertificateSection *section, 37 : : const char *label, 38 : : char *value) 39 : : { 40 : 34 : GcrCertificateField *field = _gcr_certificate_field_new_take_value (section, label, value); 41 : 34 : _gcr_certificate_section_append_field (section, field); 42 : 34 : g_object_unref (field); 43 : 34 : } 44 : : 45 : : static inline void 46 : 2 : _gcr_certificate_section_new_field_take_values (GcrCertificateSection *section, 47 : : const char *label, 48 : : GStrv values) 49 : : { 50 : 2 : GcrCertificateField *field = _gcr_certificate_field_new_take_values (section, label, values); 51 : 2 : _gcr_certificate_section_append_field (section, field); 52 : 2 : g_object_unref (field); 53 : 2 : } 54 : : 55 : : static inline void 56 : 11 : _gcr_certificate_section_new_field_take_bytes (GcrCertificateSection *section, 57 : : const char *label, 58 : : GBytes *bytes) 59 : : { 60 : 11 : GcrCertificateField *field = _gcr_certificate_field_new_take_bytes (section, label, bytes); 61 : 11 : _gcr_certificate_section_append_field (section, field); 62 : 11 : g_object_unref (field); 63 : 11 : } 64 : : 65 : : static inline void 66 : 17 : _gcr_certificate_section_new_field (GcrCertificateSection *section, 67 : : const char *label, 68 : : const char *value) 69 : : { 70 : 17 : _gcr_certificate_section_new_field_take_value (section, label, g_strdup (value)); 71 : 17 : } 72 : : 73 : : G_END_DECLS 74 : : 75 : : #endif /* __GCR_CERTIFICATE_FIELD_PRIVATE_H__ */