<commit_before>/*
 * wocky-data-form.h - Header of WockyDataForm
 * Copyright © 2009–2010 Collabora Ltd.
 * Copyright © 2010 Nokia Corporation
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */

#ifndef WOCKY_DATA_FORM_H
#define WOCKY_DATA_FORM_H

#include <glib-object.h>

#include "wocky-node.h"

G_BEGIN_DECLS

/**
 * WockyDataFormFieldType:
 * @WOCKY_DATA_FORM_FIELD_TYPE_UNSPECIFIED: Unspecified field type
 * @WOCKY_DATA_FORM_FIELD_TYPE_BOOLEAN: Boolean field type
 * @WOCKY_DATA_FORM_FIELD_TYPE_FIXED: Fixed description field type
 * @WOCKY_DATA_FORM_FIELD_TYPE_HIDDEN: Hidden field type
 * @WOCKY_DATA_FORM_FIELD_TYPE_JID_MULTI: A list of multiple JIDs
 * @WOCKY_DATA_FORM_FIELD_TYPE_JID_SINGLE: A single JID
 * @WOCKY_DATA_FORM_FIELD_TYPE_LIST_MULTI: Many options to choose one
 *   or more from
 * @WOCKY_DATA_FORM_FIELD_TYPE_LIST_SINGLE: Many options to choose one
 *   from
 * @WOCKY_DATA_FORM_FIELD_TYPE_TEXT_MULTI: Multiple lines of text
 * @WOCKY_DATA_FORM_FIELD_TYPE_TEXT_PRIVATE: A single line of text
 *   that should be obscured (by, say, asterisks)
 * @WOCKY_DATA_FORM_FIELD_TYPE_TEXT_SINGLE: A single line of text
 *
 * Data form field types, as documented in XEP-0004 §3.3.
 */
/*< prefix=WOCKY_DATA_FORM_FIELD_TYPE >*/
typedef enum
{
  WOCKY_DATA_FORM_FIELD_TYPE_UNSPECIFIED, /*< skip >*/
  WOCKY_DATA_FORM_FIELD_TYPE_BOOLEAN,
  WOCKY_DATA_FORM_FIELD_TYPE_FIXED,
  WOCKY_DATA_FORM_FIELD_TYPE_HIDDEN,
  WOCKY_DATA_FORM_FIELD_TYPE_JID_MULTI,
  WOCKY_DATA_FORM_FIELD_TYPE_JID_SINGLE,
  WOCKY_DATA_FORM_FIELD_TYPE_LIST_MULTI,
  WOCKY_DATA_FORM_FIELD_TYPE_LIST_SINGLE,
  WOCKY_DATA_FORM_FIELD_TYPE_TEXT_MULTI,
  WOCKY_DATA_FORM_FIELD_TYPE_TEXT_PRIVATE,
  WOCKY_DATA_FORM_FIELD_TYPE_TEXT_SINGLE
} WockyDataFormFieldType;

/**
 * WockyDataFormFieldOption:
 * @label: the option label
 * @value: the option value
 *
 * A single data form field option.
 */
typedef struct
{
  gchar *label;
  gchar *value;
} WockyDataFormFieldOption;

/**
 * WockyDataFormField:
 * @type: the type of the field
 * @var: the field name
 * @label: the label of the field
 * @desc: the description of the field
 * @required: %TRUE if the field is required, otherwise %FALSE
 * @default_value: the default of the field
 * @value: the field value
 * @options: a #GSList of #WockyDataFormFieldOption<!-- -->s if @type
 *   if %WOCKY_DATA_FORM_FIELD_TYPE_LIST_MULTI or
 *   %WOCKY_DATA_FORM_FIELD_TYPE_LIST_SINGLE
 *
 * Details about a single data form field in a #WockyDataForm.
 */
typedef struct
{
  WockyDataFormFieldType type;
  gchar *var;
  gchar *label;
  gchar *desc;
  gboolean required;
  GValue *default_value;
  GValue *value;
  /* for LIST_MULTI and LIST_SINGLE only.
   * List of (WockyDataFormFieldOption *)*/
  GSList *options;
} WockyDataFormField;

/**
 * WockyDataForm:
 * @fields: a #GHashTable of strings to #WockyDataFormField<!-- -->s
 * @fields_list: a list of #WockyDataFormField<!-- -->s in the order
 *   they have been presented in the form
 * @results: a list of #GSList<!-- -->s of #WockyDataFormField<!-- -->s
 *   representing one or more sets of result.
 *
 * An object that represents an XMPP data form as described in
 * XEP-0004.
 */
typedef struct _WockyDataForm WockyDataForm;

/**
 * WockyDataFormClass:
 *
 * The class of a #WockyDataForm.
 */
typedef struct _WockyDataFormClass WockyDataFormClass;
typedef struct _WockyDataFormPrivate WockyDataFormPrivate;
<commit_msg>data-form: don't typedef the struct directly<commit_after>/*
 * wocky-data-form.h - Header of WockyDataForm
 * Copyright © 2009–2010 Collabora Ltd.
 * Copyright © 2010 Nokia Corporation
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */

#ifndef WOCKY_DATA_FORM_H
#define WOCKY_DATA_FORM_H

#include <glib-object.h>

#include "wocky-node.h"

G_BEGIN_DECLS

/**
 * WockyDataFormFieldType:
 * @WOCKY_DATA_FORM_FIELD_TYPE_UNSPECIFIED: Unspecified field type
 * @WOCKY_DATA_FORM_FIELD_TYPE_BOOLEAN: Boolean field type
 * @WOCKY_DATA_FORM_FIELD_TYPE_FIXED: Fixed description field type
 * @WOCKY_DATA_FORM_FIELD_TYPE_HIDDEN: Hidden field type
 * @WOCKY_DATA_FORM_FIELD_TYPE_JID_MULTI: A list of multiple JIDs
 * @WOCKY_DATA_FORM_FIELD_TYPE_JID_SINGLE: A single JID
 * @WOCKY_DATA_FORM_FIELD_TYPE_LIST_MULTI: Many options to choose one
 *   or more from
 * @WOCKY_DATA_FORM_FIELD_TYPE_LIST_SINGLE: Many options to choose one
 *   from
 * @WOCKY_DATA_FORM_FIELD_TYPE_TEXT_MULTI: Multiple lines of text
 * @WOCKY_DATA_FORM_FIELD_TYPE_TEXT_PRIVATE: A single line of text
 *   that should be obscured (by, say, asterisks)
 * @WOCKY_DATA_FORM_FIELD_TYPE_TEXT_SINGLE: A single line of text
 *
 * Data form field types, as documented in XEP-0004 §3.3.
 */
/*< prefix=WOCKY_DATA_FORM_FIELD_TYPE >*/
typedef enum
{
  WOCKY_DATA_FORM_FIELD_TYPE_UNSPECIFIED, /*< skip >*/
  WOCKY_DATA_FORM_FIELD_TYPE_BOOLEAN,
  WOCKY_DATA_FORM_FIELD_TYPE_FIXED,
  WOCKY_DATA_FORM_FIELD_TYPE_HIDDEN,
  WOCKY_DATA_FORM_FIELD_TYPE_JID_MULTI,
  WOCKY_DATA_FORM_FIELD_TYPE_JID_SINGLE,
  WOCKY_DATA_FORM_FIELD_TYPE_LIST_MULTI,
  WOCKY_DATA_FORM_FIELD_TYPE_LIST_SINGLE,
  WOCKY_DATA_FORM_FIELD_TYPE_TEXT_MULTI,
  WOCKY_DATA_FORM_FIELD_TYPE_TEXT_PRIVATE,
  WOCKY_DATA_FORM_FIELD_TYPE_TEXT_SINGLE
} WockyDataFormFieldType;

/**
 * WockyDataFormFieldOption:
 * @label: the option label
 * @value: the option value
 *
 * A single data form field option.
 */
typedef struct _WockyDataFormFieldOption WockyDataFormFieldOption;
struct _WockyDataFormFieldOption
{
  gchar *label;
  gchar *value;
};

/**
 * WockyDataFormField:
 * @type: the type of the field
 * @var: the field name
 * @label: the label of the field
 * @desc: the description of the field
 * @required: %TRUE if the field is required, otherwise %FALSE
 * @default_value: the default of the field
 * @value: the field value
 * @options: a #GSList of #WockyDataFormFieldOption<!-- -->s if @type
 *   if %WOCKY_DATA_FORM_FIELD_TYPE_LIST_MULTI or
 *   %WOCKY_DATA_FORM_FIELD_TYPE_LIST_SINGLE
 *
 * Details about a single data form field in a #WockyDataForm.
 */
typedef struct _WockyDataFormField WockyDataFormField;
struct _WockyDataFormField
{
  WockyDataFormFieldType type;
  gchar *var;
  gchar *label;
  gchar *desc;
  gboolean required;
  GValue *default_value;
  GValue *value;
  /* for LIST_MULTI and LIST_SINGLE only.
   * List of (WockyDataFormFieldOption *)*/
  GSList *options;
};

/**
 * WockyDataForm:
 * @fields: a #GHashTable of strings to #WockyDataFormField<!-- -->s
 * @fields_list: a list of #WockyDataFormField<!-- -->s in the order
 *   they have been presented in the form
 * @results: a list of #GSList<!-- -->s of #WockyDataFormField<!-- -->s
 *   representing one or more sets of result.
 *
 * An object that represents an XMPP data form as described in
 * XEP-0004.
 */
typedef struct _WockyDataForm WockyDataForm;

/**
 * WockyDataFormClass:
 *
 * The class of a #WockyDataForm.
 */
typedef struct _WockyDataFormClass WockyDataFormClass;
typedef struct _WockyDataFormPrivate WockyDataFormPrivate;

{'fraction_non_alphanumeric': 0.07673832112405428, 'fraction_numerical': 0.008406388855530203, 'mean_word_length': 4.787352328005559, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5414160', 'n_tokens_mistral': 2977, 'n_tokens_neox': 2867, 'n_words': 845}