text:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>D-Bus Introspection Data: GIO Reference Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
<link rel="home" href="index.html" title="GIO Reference Manual">
<link rel="up" href="gdbus-lowlevel.html" title="Low-level D-Bus Support">
<link rel="prev" href="gio-D-Bus-Addresses.html" title="D-Bus Addresses">
<link rel="next" href="gio-GDBusError.html" title="GDBusError">
<meta name="generator" content="GTK-Doc V1.24 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">

Top  |
                  Description  |
                  Object Hierarchy

D-Bus Introspection Data

D-Bus Introspection Data — Node and interface description data structures

Functions

<colgroup>
<col width="150px" class="functions_return">
<col class="functions_name">
</colgroup>

const gchar *

g_dbus_annotation_info_lookup ()

GDBusMethodInfo *

g_dbus_interface_info_lookup_method ()

GDBusSignalInfo *

g_dbus_interface_info_lookup_signal ()

GDBusPropertyInfo *

g_dbus_interface_info_lookup_property ()

void

g_dbus_interface_info_cache_build ()

void

g_dbus_interface_info_cache_release ()

void

g_dbus_interface_info_generate_xml ()

GDBusNodeInfo *

g_dbus_node_info_new_for_xml ()

GDBusInterfaceInfo *

g_dbus_node_info_lookup_interface ()

void

g_dbus_node_info_generate_xml ()

#define
G_TYPE_DBUS_NODE_INFO

#define
G_TYPE_DBUS_INTERFACE_INFO

#define
G_TYPE_DBUS_METHOD_INFO

#define
G_TYPE_DBUS_SIGNAL_INFO

#define
G_TYPE_DBUS_PROPERTY_INFO

#define
G_TYPE_DBUS_ARG_INFO

#define
G_TYPE_DBUS_ANNOTATION_INFO

GDBusNodeInfo *

g_dbus_node_info_ref ()

GDBusInterfaceInfo *

g_dbus_interface_info_ref ()

GDBusMethodInfo *

g_dbus_method_info_ref ()

GDBusSignalInfo *

g_dbus_signal_info_ref ()

GDBusPropertyInfo *

g_dbus_property_info_ref ()

GDBusArgInfo *

g_dbus_arg_info_ref ()

GDBusAnnotationInfo *

g_dbus_annotation_info_ref ()

void

g_dbus_node_info_unref ()

void

g_dbus_interface_info_unref ()

void

g_dbus_method_info_unref ()

void

g_dbus_signal_info_unref ()

void

g_dbus_property_info_unref ()

void

g_dbus_arg_info_unref ()

void

g_dbus_annotation_info_unref ()

Types and Values

<colgroup>
<col width="150px" class="name">
<col class="description">
</colgroup>

GDBusAnnotationInfo

GDBusArgInfo

GDBusMethodInfo

GDBusSignalInfo

enum
GDBusPropertyInfoFlags

GDBusPropertyInfo

GDBusInterfaceInfo

GDBusNodeInfo

Object Hierarchy

    GBoxed
    ├── GDBusAnnotationInfo
    ├── GDBusArgInfo
    ├── GDBusInterfaceInfo
    ├── GDBusMethodInfo
    ├── GDBusNodeInfo
    ├── GDBusPropertyInfo
    ╰── GDBusSignalInfo

Includes

#include <gio/gio.h>

Description

Various data structures and convenience routines to parse and
generate D-Bus introspection XML. Introspection information is
used when registering objects with g_dbus_connection_register_object().

The format of D-Bus introspection XML is specified in the
D-Bus specification

Functions

g_dbus_annotation_info_lookup ()

const gchar *
g_dbus_annotation_info_lookup (GDBusAnnotationInfo **annotations,
                               const gchar *name);

Looks up the value of an annotation.

The cost of this function is O(n) in number of annotations.

Parameters

<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>

annotations

 A NULL-terminated array of annotations or NULL.

[<acronym title="Parameter points to an array of items.">array</acronym> zero-terminated=1][<acronym title="NULL is OK, both for passing and for returning.">allow-none</acronym>]

name

The name of the annotation to look up.

Returns

 The value or NULL if not found. Do not free, it is owned by annotations
.

Since: 2.26

g_dbus_interface_info_lookup_method ()

GDBusMethodInfo *
g_dbus_interface_info_lookup_method (GDBusInterfaceInfo *info,
                                     const gchar *name);

Looks up information about a method.

The cost of this function is O(n) in number of methods unless
g_dbus_interface_info_cache_build() has been used on info
.

Parameters

<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>

info

A GDBusInterfaceInfo.

name

A D-Bus method name (typically in CamelCase)

Returns

 A GDBusMethodInfo or NULL if not found. Do not free, it is owned by info
.

[<acronym title="Don't free data after the code is done.">transfer none</acronym>]

Since: 2.26

g_dbus_interface_info_lookup_signal ()

GDBusSignalInfo *
g_dbus_interface_info_lookup_signal (GDBusInterfaceInfo *info,
                                     const gchar *name);

Looks up information about a signal.

The cost of this function is O(n) in number of signals unless
g_dbus_interface_info_cache_build() has been used on info
.

Parameters

<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>

info

A GDBusInterfaceInfo.

name

A D-Bus signal name (typically in CamelCase)

Returns

 A GDBusSignalInfo or NULL if not found. Do not free, it is owned by info
.

[<acronym title="Don't free data after the code is done.">transfer none</acronym>]

Since: 2.26

g_dbus_interface_info_lookup_property ()

GDBusPropertyInfo *
g_dbus_interface_info_lookup_property (GDBusInterfaceInfo *info,
                                       const gchar *name);

Looks up information about a property.

The cost of this function is O(n) in number of properties unless
g_dbus_interface_info_cache_build() has been used on info
.

Parameters

<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>

info

A GDBusInterfaceInfo.

name

A D-Bus property name (typically in CamelCase).

Returns

 A GDBusPropertyInfo or NULL if not found. Do not free, it is owned by info
.

[<acronym title="Don't free data after the code is done.">transfer none</acronym>]

Since: 2.26

g_dbus_interface_info_cache_build ()

void
g_dbus_interface_info_cache_build (GDBusInterfaceInfo *info);

Builds a lookup-cache to speed up
g_dbus_interface_info_lookup_method(),
g_dbus_interface_info_lookup_signal() and
g_dbus_interface_info_lookup_property().

If this has already been called with info
, the existing cache is
used and its use count is increased.

Note that info
 cannot be modified until
g_dbus_interface_info_cache_release() is called.

Parameters

<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>

info

A GDBusInterfaceInfo.

Since: 2.30

g_dbus_interface_info_cache_release ()

void
g_dbus_interface_info_cache_release (GDBusInterfaceInfo *info);

Decrements the usage count for the cache for info
 built by
g_dbus_interface_info_cache_build() (if any) and frees the
resources used by the cache if the usage count drops to zero.

Parameters

<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>

info

A GDBusInterfaceInfo

Since: 2.30

g_dbus_interface_info_generate_xml ()

void
g_dbus_interface_info_generate_xml (GDBusInterfaceInfo *info,
                                    guint indent,
                                    GString *string_builder);

Appends an XML representation of info
 (and its children) to string_builder
.

This function is typically used for generating introspection XML
documents at run-time for handling the
org.freedesktop.DBus.Introspectable.Introspect
method.

Parameters

<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>

info

A GDBusNodeInfo

indent

Indentation level.

string_builder

 A GString to to append XML data to.

[<acronym title="Parameter for returning results. Default is transfer full.">out</acronym>]

Since: 2.26

g_dbus_node_info_new_for_xml ()

GDBusNodeInfo *
g_dbus_node_info_new_for_xml (const gchar *xml_data,
                              GError **error);

Parses xml_data
 and returns a GDBusNodeInfo representing the data.

The introspection XML must contain exactly one top-level
<node> element.

Note that this routine is using a
GMarkup-based
parser that only accepts a subset of valid XML documents.

Parameters

<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>

xml_data

Valid D-Bus introspection XML.

error

Return location for error.

Returns

 A GDBusNodeInfo structure or NULL if error
is set. Free
with g_dbus_node_info_unref().

Since: 2.26

g_dbus_node_info_lookup_interface ()

GDBusInterfaceInfo *
g_dbus_node_info_lookup_interface (GDBusNodeInfo *info,
                                   const gchar *name);

Looks up information about an interface.

The cost of this function is O(n) in number of interfaces.

Parameters

<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>

info

A GDBusNodeInfo.

name

A D-Bus interface name.

Returns

 A GDBusInterfaceInfo or NULL if not found. Do not free, it is owned by info
.

[<acronym title="Don't free data after the code is done.">transfer none</acronym>]

Since: 2.26

g_dbus_node_info_generate_xml ()

void
g_dbus_node_info_generate_xml (GDBusNodeInfo *info,
                               guint indent,
                               GString *string_builder);

Appends an XML representation of info
 (and its children) to string_builder
.

This function is typically used for generating introspection XML documents at run-time for
handling the org.freedesktop.DBus.Introspectable.Introspect  method.

Parameters

<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>

info

A GDBusNodeInfo.

indent

Indentation level.

string_builder

 A GString to to append XML data to.

[<acronym title="Parameter for returning results. Default is transfer full.">out</acronym>]

Since: 2.26

G_TYPE_DBUS_NODE_INFO

#define G_TYPE_DBUS_NODE_INFO       (g_dbus_node_info_get_type ())

The GType for a boxed type holding a GDBusNodeInfo.

Since: 2.26

G_TYPE_DBUS_INTERFACE_INFO

#define G_TYPE_DBUS_INTERFACE_INFO  (g_dbus_interface_info_get_type ())

The GType for a boxed type holding a GDBusInterfaceInfo.

Since: 2.26

G_TYPE_DBUS_METHOD_INFO

#define G_TYPE_DBUS_METHOD_INFO     (g_dbus_method_info_get_type ())

The GType for a boxed type holding a GDBusMethodInfo.

Since: 2.26

G_TYPE_DBUS_SIGNAL_INFO

#define G_TYPE_DBUS_SIGNAL_INFO     (g_dbus_signal_info_get_type ())

The GType for a boxed type holding a GDBusSignalInfo.

Since: 2.26

G_TYPE_DBUS_PROPERTY_INFO

#define G_TYPE_DBUS_PROPERTY_INFO   (g_dbus_property_info_get_type ())

The GType for a boxed type holding a GDBusPropertyInfo.

Since: 2.26

G_TYPE_DBUS_ARG_INFO

#define G_TYPE_DBUS_ARG_INFO        (g_dbus_arg_info_get_type ())

The GType for a boxed type holding a GDBusArgInfo.

Since: 2.26

G_TYPE_DBUS_ANNOTATION_INFO

#define G_TYPE_DBUS_ANNOTATION_INFO (g_dbus_annotation_info_get_type ())

The GType for a boxed type holding a GDBusAnnotationInfo.

Since: 2.26

g_dbus_node_info_ref ()

GDBusNodeInfo *
g_dbus_node_info_ref (GDBusNodeInfo *info);

If info
 is statically allocated does nothing. Otherwise increases
the reference count.

Parameters

<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>

info

A GDBusNodeInfo

Returns

 The same info
.

Since: 2.26

g_dbus_interface_info_ref ()

GDBusInterfaceInfo *
g_dbus_interface_info_ref (GDBusInterfaceInfo *info);

If info
 is statically allocated does nothing. Otherwise increases
the reference count.

Parameters

<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>

info

A GDBusInterfaceInfo

Returns

 The same info
.

Since: 2.26

g_dbus_method_info_ref ()

GDBusMethodInfo *
g_dbus_method_info_ref (GDBusMethodInfo *info);

If info
 is statically allocated does nothing. Otherwise increases
the reference count.

Parameters

<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>

info

A GDBusMethodInfo

Returns

 The same info
.

Since: 2.26

g_dbus_signal_info_ref ()

GDBusSignalInfo *
g_dbus_signal_info_ref (GDBusSignalInfo *info);

If info
 is statically allocated does nothing. Otherwise increases
the reference count.

Parameters

<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>

info

A GDBusSignalInfo

Returns

 The same info
.

Since: 2.26

g_dbus_property_info_ref ()

GDBusPropertyInfo *
g_dbus_property_info_ref (GDBusPropertyInfo *info);

If info
 is statically allocated does nothing. Otherwise increases
the reference count.

Parameters

<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>

info

A GDBusPropertyInfo

Returns

 The same info
.

Since: 2.26

g_dbus_arg_info_ref ()

GDBusArgInfo *
g_dbus_arg_info_ref (GDBusArgInfo *info);

If info
 is statically allocated does nothing. Otherwise increases
the reference count.

Parameters

<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>

info

A GDBusArgInfo

Returns

 The same info
.

Since: 2.26

g_dbus_annotation_info_ref ()

GDBusAnnotationInfo *
g_dbus_annotation_info_ref (GDBusAnnotationInfo *info);

If info
 is statically allocated does nothing. Otherwise increases
the reference count.

Parameters

<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>

info

A GDBusNodeInfo

Returns

 The same info
.

Since: 2.26

g_dbus_node_info_unref ()

void
g_dbus_node_info_unref (GDBusNodeInfo *info);

If info
 is statically allocated, does nothing. Otherwise decreases
the reference count of info
. When its reference count drops to 0,
the memory used is freed.

Parameters

<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>

info

A GDBusNodeInfo.

Since: 2.26

g_dbus_interface_info_unref ()

void
g_dbus_interface_info_unref (GDBusInterfaceInfo *info);

If info
 is statically allocated, does nothing. Otherwise decreases
the reference count of info
. When its reference count drops to 0,
the memory used is freed.

Parameters

<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>

info

A GDBusInterfaceInfo.

Since: 2.26

g_dbus_method_info_unref ()

void
g_dbus_method_info_unref (GDBusMethodInfo *info);

If info
 is statically allocated, does nothing. Otherwise decreases
the reference count of info
. When its reference count drops to 0,
the memory used is freed.

Parameters

<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>

info

A GDBusMethodInfo.

Since: 2.26

g_dbus_signal_info_unref ()

void
g_dbus_signal_info_unref (GDBusSignalInfo *info);

If info
 is statically allocated, does nothing. Otherwise decreases
the reference count of info
. When its reference count drops to 0,
the memory used is freed.

Parameters

<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>

info

A GDBusSignalInfo.

Since: 2.26

g_dbus_property_info_unref ()

void
g_dbus_property_info_unref (GDBusPropertyInfo *info);

If info
 is statically allocated, does nothing. Otherwise decreases
the reference count of info
. When its reference count drops to 0,
the memory used is freed.

Parameters

<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>

info

A GDBusPropertyInfo.

Since: 2.26

g_dbus_arg_info_unref ()

void
g_dbus_arg_info_unref (GDBusArgInfo *info);

If info
 is statically allocated, does nothing. Otherwise decreases
the reference count of info
. When its reference count drops to 0,
the memory used is freed.

Parameters

<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>

info

A GDBusArgInfo.

Since: 2.26

g_dbus_annotation_info_unref ()

void
g_dbus_annotation_info_unref (GDBusAnnotationInfo *info);

If info
 is statically allocated, does nothing. Otherwise decreases
the reference count of info
. When its reference count drops to 0,
the memory used is freed.

Parameters

<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>

info

A GDBusAnnotationInfo.

Since: 2.26

Types and Values

GDBusAnnotationInfo

typedef struct {
  volatile gint         ref_count;
  gchar                *key;
  gchar                *value;
  GDBusAnnotationInfo **annotations;
} GDBusAnnotationInfo;

Information about an annotation.

Members

<colgroup>
<col width="300px" class="struct_members_name">
<col class="struct_members_description">
<col width="200px" class="struct_members_annotations">
</colgroup>

volatile gint ref_count;

The reference count or -1 if statically allocated.

gchar *key;

The name of the annotation, e.g. "org.freedesktop.DBus.Deprecated".

gchar *value;

The value of the annotation.

GDBusAnnotationInfo **annotations;

 A pointer to a NULL-terminated array of pointers to GDBusAnnotationInfo structures or NULL if there are no annotations.

[<acronym title="Parameter points to an array of items.">array</acronym> zero-terminated=1]

Since: 2.26

GDBusArgInfo

typedef struct {
  volatile gint         ref_count;
  gchar                *name;
  gchar                *signature;
  GDBusAnnotationInfo **annotations;
} GDBusArgInfo;

Information about an argument for a method or a signal.

Members

<colgroup>
<col width="300px" class="struct_members_name">
<col class="struct_members_description">
<col width="200px" class="struct_members_annotations">
</colgroup>

volatile gint ref_count;

The reference count or -1 if statically allocated.

gchar *name;

Name of the argument, e.g. unix_user_id
.

gchar *signature;

D-Bus signature of the argument (a single complete type).

GDBusAnnotationInfo **annotations;

 A pointer to a NULL-terminated array of pointers to GDBusAnnotationInfo structures or NULL if there are no annotations.

[<acronym title="Parameter points to an array of items.">array</acronym> zero-terminated=1]

Since: 2.26

GDBusMethodInfo

typedef struct {
  volatile gint         ref_count;
  gchar                *name;
  GDBusArgInfo        **in_args;
  GDBusArgInfo        **out_args;
  GDBusAnnotationInfo **annotations;
} GDBusMethodInfo;

Information about a method on an D-Bus interface.

Members

<colgroup>
<col width="300px" class="struct_members_name">
<col class="struct_members_description">
<col width="200px" class="struct_members_annotations">
</colgroup>

volatile gint ref_count;

The reference count or -1 if statically allocated.

gchar *name;

The name of the D-Bus method, e.g. RequestName
.

GDBusArgInfo **in_args;

 A pointer to a NULL-terminated array of pointers to GDBusArgInfo structures or NULL if there are no in arguments.

[<acronym title="Parameter points to an array of items.">array</acronym> zero-terminated=1]

GDBusArgInfo **out_args;

 A pointer to a NULL-terminated array of pointers to GDBusArgInfo structures or NULL if there are no out arguments.

[<acronym title="Parameter points to an array of items.">array</acronym> zero-terminated=1]

GDBusAnnotationInfo **annotations;

 A pointer to a NULL-terminated array of pointers to GDBusAnnotationInfo structures or NULL if there are no annotations.

[<acronym title="Parameter points to an array of items.">array</acronym> zero-terminated=1]

Since: 2.26

GDBusSignalInfo

typedef struct {
  volatile gint         ref_count;
  gchar                *name;
  GDBusArgInfo        **args;
  GDBusAnnotationInfo **annotations;
} GDBusSignalInfo;

Information about a signal on a D-Bus interface.

Members

<colgroup>
<col width="300px" class="struct_members_name">
<col class="struct_members_description">
<col width="200px" class="struct_members_annotations">
</colgroup>

volatile gint ref_count;

The reference count or -1 if statically allocated.

gchar *name;

The name of the D-Bus signal, e.g. "NameOwnerChanged".

GDBusArgInfo **args;

 A pointer to a NULL-terminated array of pointers to GDBusArgInfo structures or NULL if there are no arguments.

[<acronym title="Parameter points to an array of items.">array</acronym> zero-terminated=1]

GDBusAnnotationInfo **annotations;

 A pointer to a NULL-terminated array of pointers to GDBusAnnotationInfo structures or NULL if there are no annotations.

[<acronym title="Parameter points to an array of items.">array</acronym> zero-terminated=1]

Since: 2.26

enum GDBusPropertyInfoFlags

Flags describing the access control of a D-Bus property.

Members

<colgroup>
<col width="300px" class="enum_members_name">
<col class="enum_members_description">
<col width="200px" class="enum_members_annotations">
</colgroup>

G_DBUS_PROPERTY_INFO_FLAGS_NONE

No flags set.

G_DBUS_PROPERTY_INFO_FLAGS_READABLE

Property is readable.

G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE

Property is writable.

Since: 2.26

GDBusPropertyInfo

typedef struct {
  volatile gint             ref_count;
  gchar                    *name;
  gchar                    *signature;
  GDBusPropertyInfoFlags    flags;
  GDBusAnnotationInfo     **annotations;
} GDBusPropertyInfo;

Information about a D-Bus property on a D-Bus interface.

Members

<colgroup>
<col width="300px" class="struct_members_name">
<col class="struct_members_description">
<col width="200px" class="struct_members_annotations">
</colgroup>

volatile gint ref_count;

The reference count or -1 if statically allocated.

gchar *name;

The name of the D-Bus property, e.g. "SupportedFilesystems".

gchar *signature;

The D-Bus signature of the property (a single complete type).

GDBusPropertyInfoFlags flags;

Access control flags for the property.

GDBusAnnotationInfo **annotations;

 A pointer to a NULL-terminated array of pointers to GDBusAnnotationInfo structures or NULL if there are no annotations.

[<acronym title="Parameter points to an array of items.">array</acronym> zero-terminated=1]

Since: 2.26

GDBusInterfaceInfo

typedef struct {
  volatile gint         ref_count;
  gchar                *name;
  GDBusMethodInfo     **methods;
  GDBusSignalInfo     **signals;
  GDBusPropertyInfo   **properties;
  GDBusAnnotationInfo **annotations;
} GDBusInterfaceInfo;

Information about a D-Bus interface.

Members

<colgroup>
<col width="300px" class="struct_members_name">
<col class="struct_members_description">
<col width="200px" class="struct_members_annotations">
</colgroup>

volatile gint ref_count;

The reference count or -1 if statically allocated.

gchar *name;

The name of the D-Bus interface, e.g. "org.freedesktop.DBus.Properties".

GDBusMethodInfo **methods;

 A pointer to a NULL-terminated array of pointers to GDBusMethodInfo structures or NULL if there are no methods.

[<acronym title="Parameter points to an array of items.">array</acronym> zero-terminated=1]

GDBusSignalInfo **signals;

 A pointer to a NULL-terminated array of pointers to GDBusSignalInfo structures or NULL if there are no signals.

[<acronym title="Parameter points to an array of items.">array</acronym> zero-terminated=1]

GDBusPropertyInfo **properties;

 A pointer to a NULL-terminated array of pointers to GDBusPropertyInfo structures or NULL if there are no properties.

[<acronym title="Parameter points to an array of items.">array</acronym> zero-terminated=1]

GDBusAnnotationInfo **annotations;

 A pointer to a NULL-terminated array of pointers to GDBusAnnotationInfo structures or NULL if there are no annotations.

[<acronym title="Parameter points to an array of items.">array</acronym> zero-terminated=1]

Since: 2.26

GDBusNodeInfo

typedef struct {
  volatile gint         ref_count;
  gchar                *path;
  GDBusInterfaceInfo  **interfaces;
  GDBusNodeInfo       **nodes;
  GDBusAnnotationInfo **annotations;
} GDBusNodeInfo;

Information about nodes in a remote object hierarchy.

Members

<colgroup>
<col width="300px" class="struct_members_name">
<col class="struct_members_description">
<col width="200px" class="struct_members_annotations">
</colgroup>

volatile gint ref_count;

The reference count or -1 if statically allocated.

gchar *path;

The path of the node or NULL if omitted. Note that this may be a relative path. See the D-Bus specification for more details.

GDBusInterfaceInfo **interfaces;

 A pointer to a NULL-terminated array of pointers to GDBusInterfaceInfo structures or NULL if there are no interfaces.

[<acronym title="Parameter points to an array of items.">array</acronym> zero-terminated=1]

GDBusNodeInfo **nodes;

 A pointer to a NULL-terminated array of pointers to GDBusNodeInfo structures or NULL if there are no nodes.

[<acronym title="Parameter points to an array of items.">array</acronym> zero-terminated=1]

GDBusAnnotationInfo **annotations;

 A pointer to a NULL-terminated array of pointers to GDBusAnnotationInfo structures or NULL if there are no annotations.

[<acronym title="Parameter points to an array of items.">array</acronym> zero-terminated=1]

Since: 2.26

Generated by GTK-Doc V1.24


text:
package com.benromberg.cordonbleu.main.config;

import com.benromberg.cordonbleu.data.util.jackson.IgnoreSuperClassFields;
import com.benromberg.cordonbleu.service.coderepository.CodeRepositoryService.CodeRepositoryFolderProvider;
import com.benromberg.cordonbleu.service.coderepository.keypair.SshPrivateKeyPasswordProvider;
import com.benromberg.cordonbleu.service.commit.CommitNotificationConsiderationAmount;
import com.benromberg.cordonbleu.service.email.EmailConfiguration;
import com.benromberg.cordonbleu.service.highlight.HighlightingTimeout;
import io.dropwizard.Configuration;

import java.io.File;
import java.util.Optional;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;

public class CordonBleuConfiguration extends Configuration implements CodeRepositoryFolderProvider, HighlightingTimeout,
        CommitNotificationConsiderationAmount, SshPrivateKeyPasswordProvider {
    @JsonProperty
    private final File codeRepositoryFolder;

    @JsonProperty
    private final String mongoUrl;

    @JsonProperty
    private final EmailServer emailServer;

    @JsonProperty
    private final long highlightingTimeoutInMilliseconds;

    @JsonProperty
    private final int commitNotificationConsiderationAmount;

    @JsonProperty
    private final Optional<Credentials> globalCredentials;

    @JsonProperty
    private final String sshPrivateKeyPassword;

    @JsonCreator
    @IgnoreSuperClassFields
    private CordonBleuConfiguration(File codeRepositoryFolder, String mongoUrl, EmailServer emailServer,
            long highlightingTimeoutInMilliseconds, int commitNotificationConsiderationAmount,
            Optional<Credentials> globalCredentials, String sshPrivateKeyPassword) {
        this.codeRepositoryFolder = codeRepositoryFolder;
        this.mongoUrl = mongoUrl;
        this.emailServer = emailServer;
        this.highlightingTimeoutInMilliseconds = highlightingTimeoutInMilliseconds;
        this.commitNotificationConsiderationAmount = commitNotificationConsiderationAmount;
        this.globalCredentials = globalCredentials;
        this.sshPrivateKeyPassword = sshPrivateKeyPassword;
    }

    public String getMongoUrl() {
        return mongoUrl;
    }

    public Optional<Credentials> getGlobalCredentials() {
        return globalCredentials;
    }

    @Override
    public File getCodeRepositoryFolder() {
        codeRepositoryFolder.mkdirs();
        return codeRepositoryFolder;
    }

    public EmailConfiguration getEmailConfiguration() {
        return emailServer.toConfiguration();
    }

    @Override
    public long getHighlightingTimeoutInMillis() {
        return highlightingTimeoutInMilliseconds;
    }

    @Override
    public int getCommitNotificationConsiderationAmount() {
        return commitNotificationConsiderationAmount;
    }

    @Override
    public String getSshPrivateKeyPassword() {
        return sshPrivateKeyPassword;
    }
}

redpajama_set_name: RedPajamaGithub


text:
package org.scalatest.fixture

import org.scalatest._
import words.{CanVerb, ResultOfAfterWordApplication, ShouldVerb, BehaveWord, MustVerb,
  StringVerbBlockRegistration}
import scala.collection.immutable.ListSet
import org.scalatest.exceptions.StackDepthExceptionHelper.getStackDepth
import java.util.concurrent.atomic.AtomicReference
import java.util.ConcurrentModificationException
import org.scalatest.events._
import org.scalatest.Suite.anExceptionThatShouldCauseAnAbort
import org.scalatest.Suite.autoTagClassAnnotations

/**
 * Implementation trait for class fixture.FreeSpec, which is
 * a sister class to org.scalatest.FreeSpec that can pass a
 * fixture object into its tests.
 *
 *

 * fixture.FreeSpec is a class,
 * not a trait, to minimize compile time given there is a slight compiler
 * overhead to mixing in traits compared to extending classes. If you need
 * to mix the behavior of fixture.FreeSpec into some other
 * class, you can use this trait instead, because class
 * fixture.FreeSpec does nothing more than extend this trait and add a nice toString implementation.
 *

 *
 *

 * See the documentation of the class for a detailed
 * overview of fixture.FreeSpec.
 *

 *
 * @author Bill Venners
 */
@Finders(Array("org.scalatest.finders.FreeSpecFinder"))
trait FreeSpecRegistration extends Suite with TestRegistration with Informing with Notifying with Alerting with Documenting { thisSuite =>

  private final val engine = new FixtureEngine[FixtureParam](Resources.concurrentFixtureFreeSpecMod, "FixtureFreeSpec")

  protected[scalatest] def getEngine: FixtureEngine[FixtureParam] = engine

  import engine._

  private[scalatest] val sourceFileName = "FreeSpecRegistration.scala"

  /**
   * Returns an Informer that during test execution will forward strings passed to its
   * apply method to the current reporter. If invoked in a constructor, it
   * will register the passed string for forwarding later during test execution. If invoked from inside a scope,
   * it will forward the information to the current reporter immediately.  If invoked from inside a test function,
   * it will record the information and forward it to the current reporter only after the test completed, as recordedEvents
   * of the test completed event, such as TestSucceeded. If invoked at any other time, it will print to the standard output.
   * This method can be called safely by any thread.
   */
  protected def info: Informer = atomicInformer.get

  /**
   * Returns an Notifier that during test execution will forward strings (and other objects) passed to its
   * apply method to the current reporter. If invoked in a constructor, it
   * will register the passed string for forwarding later during test execution. If invoked while this
   * fixture.FreeSpec is being executed, such as from inside a test function, it will forward the information to
   * the current reporter immediately. If invoked at any other time, it will
   * print to the standard output. This method can be called safely by any thread.
   */
  protected def note: Notifier = atomicNotifier.get

  /**
   * Returns a Alerter that during test execution will forward strings (and other objects) passed to its
   * apply method to the current reporter. If invoked in a constructor, it
   * will register the passed string for forwarding later during test execution. If invoked while this
   * fixture.FreeSpec is being executed, such as from inside a test function, it will forward the information to
   * the current reporter immediately. If invoked at any other time, it will
   * print to the standard output. This method can be called safely by any thread.
   */
  protected def alert: Alerter = atomicAlerter.get

  /**
   * Returns a Documenter that during test execution will forward strings passed to its
   * apply method to the current reporter. If invoked in a constructor, it
   * will register the passed string for forwarding later during test execution. If invoked from inside a scope,
   * it will forward the information to the current reporter immediately.  If invoked from inside a test function,
   * it will record the information and forward it to the current reporter only after the test completed, as recordedEvents
   * of the test completed event, such as TestSucceeded. If invoked at any other time, it will print to the standard output.
   * This method can be called safely by any thread.
   */
  protected def markup: Documenter = atomicDocumenter.get

  final def registerTest(testText: String, testTags: Tag*)(testFun: FixtureParam => Registration) {
    engine.registerTest(testText, transformToOutcome(testFun), Resources.testCannotBeNestedInsideAnotherTest, "FreeSpecRegistration.scala", "registerTest", 5, -2, None, None, None, testTags: _*)
  }

  final def registerIgnoredTest(testText: String, testTags: Tag*)(testFun: FixtureParam => Registration) {
    engine.registerIgnoredTest(testText, transformToOutcome(testFun), Resources.testCannotBeNestedInsideAnotherTest, "FreeSpecRegistration.scala", "registerIgnoredTest", 4, -3, None, testTags: _*)
  }

  /**
   * Register a test with the given spec text, optional tags, and test function value that takes no arguments.
   * An invocation of this method is called an “example.”
   *
   * This method will register the test for later execution via an invocation of one of the execute
   * methods. The name of the test will be a concatenation of the text of all surrounding describers,
   * from outside in, and the passed spec text, with one space placed between each item. (See the documenation
   * for testNames for an example.) The resulting test name must not have been registered previously on
   * this FreeSpec instance.
   *
   * @param specText the specification text, which will be combined with the descText of any surrounding describers
   * to form the test name
   * @param testTags the optional list of tags for this test
   * @param methodName caller's method name
   * @param testFun the test function
   * @throws DuplicateTestNameException if a test with the same name has been registered previously
   * @throws TestRegistrationClosedException if invoked after run has been invoked on this suite
   * @throws NullPointerException if specText or any passed test tag is null
   */
  private def registerTestToRun(specText: String, testTags: List[Tag], methodName: String, testFun: FixtureParam => Registration) {
    engine.registerTest(specText, transformToOutcome(testFun), Resources.inCannotAppearInsideAnotherIn, sourceFileName, methodName, 4, -3, None, None, None, testTags: _*)
  }

  private def registerPendingTestToRun(specText: String, testTags: List[Tag], methodName: String, testFun: FixtureParam => PendingNothing) {
    engine.registerTest(specText, Transformer(testFun), Resources.inCannotAppearInsideAnotherIn, sourceFileName, methodName, 4, -3, None, None, None, testTags: _*)
  }

  /**
   * Register a test to ignore, which has the given spec text, optional tags, and test function value that takes no arguments.
   * This method will register the test for later ignoring via an invocation of one of the execute
   * methods. This method exists to make it easy to ignore an existing test by changing the call to it
   * to ignore without deleting or commenting out the actual test code. The test will not be executed, but a
   * report will be sent that indicates the test was ignored. The name of the test will be a concatenation of the text of all surrounding describers,
   * from outside in, and the passed spec text, with one space placed between each item. (See the documenation
   * for testNames for an example.) The resulting test name must not have been registered previously on
   * this FreeSpec instance.
   *
   * @param specText the specification text, which will be combined with the descText of any surrounding describers
   * to form the test name
   * @param testTags the optional list of tags for this test
   * @param methodName caller's method name
   * @param testFun the test function
   * @throws DuplicateTestNameException if a test with the same name has been registered previously
   * @throws TestRegistrationClosedException if invoked after run has been invoked on this suite
   * @throws NullPointerException if specText or any passed test tag is null
   */
  private def registerTestToIgnore(specText: String, testTags: List[Tag], methodName: String, testFun: FixtureParam => Registration) {
    engine.registerIgnoredTest(specText, transformToOutcome(testFun), Resources.ignoreCannotAppearInsideAnIn, sourceFileName, methodName, 4, -4, None, testTags: _*)
  }

  private def registerPendingTestToIgnore(specText: String, testTags: List[Tag], methodName: String, testFun: FixtureParam => PendingNothing) {
    engine.registerIgnoredTest(specText, Transformer(testFun), Resources.ignoreCannotAppearInsideAnIn, sourceFileName, methodName, 4, -4, None, testTags: _*)
  }
   /*
  private def registerBranch(description: String, childPrefix: Option[String], fun: () => Unit) {

    // TODO: Fix the resource name and method name
    registerNestedBranch(description, childPrefix, fun(), "describeCannotAppearInsideAnIt", sourceFileName, "describe")
  }  */

  /**
   * Class that supports the registration of tagged tests.
   *
   *

   * Instances of this class are returned by the taggedAs method of
   * class FreeSpecStringWrapper.
   *

   *
   * @param specText the specification text
   * @param tags the list of tags
   *
   * @author Bill Venners
   * @author Chee Seng
   */
  protected final class ResultOfTaggedAsInvocationOnString(specText: String, tags: List[Tag]) {

    /**
     * Supports tagged test registration.
     *
     *

     * For example, this method supports syntax such as the following:
     *

     *
     *

     * "complain on peek" taggedAs(SlowTest) in { fixture => ... }
     *                                       ^
     *

     *
     *

     * For more information and examples of this method's use, see the main documentation for trait FreeSpec.
     *

     *
     * @param testFun the test function
     */
    def in(testFun: FixtureParam => Registration) {
      registerTestToRun(specText, tags, "in", testFun)
    }

    /**
     * Supports tagged test registration, for tests that don't take a fixture.
     *
     *

     * For example, this method supports syntax such as the following:
     *

     *
     *

     * "complain on peek" taggedAs(SlowTest) in { () => ... }
     *                                       ^
     *

     *
     *

     * For more information and examples of this method's use, see the main documentation for trait FreeSpec.
     *

     *
     * @param testFun the test function
     */
    def in(testFun: () => Registration) {
      registerTestToRun(specText, tags, "in", new NoArgTestWrapper(testFun))
    }

    /**
     * Supports registration of tagged, pending tests.
     *
     *

     * For example, this method supports syntax such as the following:
     *

     *
     *

     * "complain on peek" taggedAs(SlowTest) is (pending)
     *                                       ^
     *

     *
     *

     * For more information and examples of this method's use, see the main documentation for trait FreeSpec.
     *

     *
     * @param testFun the test function
     */
    def is(testFun: => PendingNothing) {
      registerPendingTestToRun(specText, tags, "is", unusedFixtureParam => testFun)
    }

    /**
     * Supports registration of tagged, ignored tests.
     *
     *

     * For example, this method supports syntax such as the following:
     *

     *
     *

     * "complain on peek" taggedAs(SlowTest) ignore { fixture => ... }
     *                                       ^
     *

     *
     *

     * For more information and examples of this method's use, see the main documentation for trait FreeSpec.
     *

     *
     * @param testFun the test function
     */
    def ignore(testFun: FixtureParam => Registration) {
      registerTestToIgnore(specText, tags, "ignore", testFun)
    }

    /**
     * Supports registration of tagged, ignored tests that take no fixture parameter.
     *
     *

     * For example, this method supports syntax such as the following:
     *

     *
     *

     * "complain on peek" taggedAs(SlowTest) ignore { () => ... }
     *                                       ^
     *

     *
     *

     * For more information and examples of this method's use, see the main documentation for trait FreeSpec.
     *

     *
     * @param testFun the test function
     */
    def ignore(testFun: () => Registration) {
      registerTestToIgnore(specText, tags, "ignore", new NoArgTestWrapper(testFun))
    }
  }

  /**
   * A class that via an implicit conversion (named convertToFreeSpecStringWrapper) enables
   * methods when, that, in, is, taggedAs
   * and ignore to be invoked on Strings.
   *
   *

   * This class provides much of the syntax for fixture.FreeSpec, however, it does not add
   * the verb methods (should, must, and can) to String.
   * Instead, these are added via the ShouldVerb, MustVerb, and CanVerb
   * traits, which fixture.FreeSpec mixes in, to avoid a conflict with implicit conversions provided
   * in ShouldMatchers and MustMatchers.
   *

   *
   * @param string the string that is wrapped
   *
   * @author Bill Venners
   */
  protected final class FreeSpecStringWrapper(string: String) {

    /**
     * Register some text that may surround one or more tests. Thepassed function value may contain surrounding text
     * registrations (defined with dash (-)) and/or tests (defined with in). This trait's
     * implementation of this method will register the text (passed to the contructor of FreeSpecStringWrapper
     * and immediately invoke the passed function.
     */
    def - (fun: => Unit) {
      try {
        registerNestedBranch(string, None, fun, Resources.dashCannotAppearInsideAnIn, sourceFileName, "-", 3, -2, None)
      }
      catch {
        case e: exceptions.TestFailedException => throw new exceptions.NotAllowedException(FailureMessages.assertionShouldBePutInsideInClauseNotDashClause, Some(e), e => 3)
        case e: exceptions.TestCanceledException => throw new exceptions.NotAllowedException(FailureMessages.assertionShouldBePutInsideInClauseNotDashClause, Some(e), e => 3)
        case tgce: exceptions.TestRegistrationClosedException => throw tgce
        case other: Throwable if (!Suite.anExceptionThatShouldCauseAnAbort(other)) => throw new exceptions.NotAllowedException(FailureMessages.exceptionWasThrownInDashClause(UnquotedString(other.getClass.getName), string), Some(other), e => 3)
        case other: Throwable => throw other
      }
    }

    /**
     * Supports test registration.
     *
     *

     * For example, this method supports syntax such as the following:
     *

     *
     *

     * "complain on peek" in { fixture => ... }
     *                    ^
     *

     *
     *

     * For more information and examples of this method's use, see the main documentation for trait FreeSpec.
     *

     *
     * @param testFun the test function
     */
    def in(testFun: FixtureParam => Registration) {
      registerTestToRun(string, List(), "in", testFun)
    }

    /**
     * Supports registration of tests that take no fixture.
     *
     *

     * For example, this method supports syntax such as the following:
     *

     *
     *

     * "complain on peek" in { () => ... }
     *                    ^
     *

     *
     *

     * For more information and examples of this method's use, see the main documentation for trait FreeSpec.
     *

     *
     * @param testFun the test function
     */
    def in(testFun: () => Registration) {
      registerTestToRun(string, List(), "in", new NoArgTestWrapper(testFun))
    }

    /**
     * Supports pending test registration.
     *
     *

     * For example, this method supports syntax such as the following:
     *

     *
     *

     * "complain on peek" is (pending)
     *                    ^
     *

     *
     *

     * For more information and examples of this method's use, see the main documentation for trait FreeSpec.
     *

     *
     * @param testFun the test function
     */
    def is(testFun: => PendingNothing) {
      registerPendingTestToRun(string, List(), "is", unusedFixtureParam => testFun)
    }

    /**
     * Supports ignored test registration.
     *
     *

     * For example, this method supports syntax such as the following:
     *

     *
     *

     * "complain on peek" ignore { fixture => ... }
     *                    ^
     *

     *
     *

     * For more information and examples of this method's use, see the main documentation for trait FreeSpec.
     *

     *
     * @param testFun the test function
     */
    def ignore(testFun: FixtureParam => Registration) {
      registerTestToIgnore(string, List(), "ignore", testFun)
    }

    /**
     * Supports registration of ignored tests that take no fixture.
     *
     *

     * For example, this method supports syntax such as the following:
     *

     *
     *

     * "complain on peek" ignore { () => ... }
     *                    ^
     *

     *
     *

     * For more information and examples of this method's use, see the main documentation for trait FreeSpec.
     *

     *
     * @param testFun the test function
     */
    def ignore(testFun: () => Registration) {
      registerTestToIgnore(string, List(), "ignore", new NoArgTestWrapper(testFun))
    }

    /**
     * Supports tagged test registration.
     *
     *

     * For example, this method supports syntax such as the following:
     *

     *
     *

     * "complain on peek" taggedAs(SlowTest) in { fixture => ... }
     *                    ^
     *

     *
     *

     * For more information and examples of this method's use, see the main documentation for trait FreeSpec.
     *

     *
     * @param firstTestTag the first mandatory test tag
     * @param otherTestTags the others additional test tags
     */
    def taggedAs(firstTestTag: Tag, otherTestTags: Tag*) = {
      val tagList = firstTestTag :: otherTestTags.toList
      new ResultOfTaggedAsInvocationOnString(string, tagList)
    }
  }

  import scala.language.implicitConversions

  /**
   * Implicitly converts Strings to FreeSpecStringWrapper, which enables
   * methods when, that, in, is, taggedAs
   * and ignore to be invoked on Strings.
   */
  protected implicit def convertToFreeSpecStringWrapper(s: String) = new FreeSpecStringWrapper(s)

  /**
   * A Map whose keys are String tag names to which tests in this FreeSpec belong, and values
   * the Set of test names that belong to each tag. If this FreeSpec contains no tags, this method returns an empty Map.
   *
   *

   * This trait's implementation returns tags that were passed as strings contained in Tag objects passed to
   * methods test and ignore.
   *

   *
   *

   * In addition, this trait's implementation will also auto-tag tests with class level annotations.
   * For example, if you annotate @Ignore at the class level, all test methods in the class will be auto-annotated with @Ignore.
   *

   */
  override def tags: Map[String, Set[String]] = autoTagClassAnnotations(atomic.get.tagsMap, this)

  /**
   * Run a test. This trait's implementation runs the test registered with the name specified by
   * testName. Each test's name is a concatenation of the text of all describers surrounding a test,
   * from outside in, and the test's  spec text, with one space placed between each item. (See the documenation
   * for testNames for an example.)
   *
   * @param testName the name of one test to execute.
   * @param args the Args for this run
   * @return a Status object that indicates when the test started by this method has completed, and whether or not it failed .
   * @throws NullPointerException if testName or <args/code> is null.
   */
  protected override def runTest(testName: String, args: Args): Status = {

    def invokeWithFixture(theTest: TestLeaf): AsyncOutcome = {
      PastOutcome(
        theTest.testFun match {
          case transformer: org.scalatest.fixture.Transformer[_] =>
            transformer.exceptionalTestFun match {
              case wrapper: NoArgTestWrapper[_, _] =>
                withFixture(new FixturelessTestFunAndConfigMap(testName, wrapper.test, args.configMap))
              case fun => withFixture(new TestFunAndConfigMap(testName, fun, args.configMap))
            }
          case other =>
            other match {
              case wrapper: NoArgTestWrapper[_, _] =>
                withFixture(new FixturelessTestFunAndConfigMap(testName, wrapper.test, args.configMap))
              case fun => withFixture(new TestFunAndConfigMap(testName, fun, args.configMap))
            }
        }
      )
    }

    runTestImpl(thisSuite, testName, args, true, invokeWithFixture)
  }

  /**
   *

   * Run zero to many of this FreeSpec's tests.
   *

   *
   *

   * This method takes a testName parameter that optionally specifies a test to invoke.
   * If testName is Some, this trait's implementation of this method
   * invokes runTest on this object with passed args.
   *

   *
   *

   * This method takes an args that contains a Set of tag names that should be included (tagsToInclude), and a Set
   * that should be excluded (tagsToExclude), when deciding which of this Suite's tests to execute.
   * If tagsToInclude is empty, all tests will be executed
   * except those those belonging to tags listed in the tagsToExclude Set. If tagsToInclude is non-empty, only tests
   * belonging to tags mentioned in tagsToInclude, and not mentioned in tagsToExclude
   * will be executed. However, if testName is Some, tagsToInclude and tagsToExclude are essentially ignored.
   * Only if testName is None will tagsToInclude and tagsToExclude be consulted to
   * determine which of the tests named in the testNames Set should be run. For more information on trait tags, see the main documentation for this trait.
   *

   *
   *

   * If testName is None, this trait's implementation of this method
   * invokes testNames on this Suite to get a Set of names of tests to potentially execute.
   * (A testNames value of None essentially acts as a wildcard that means all tests in
   * this Suite that are selected by tagsToInclude and tagsToExclude should be executed.)
   * For each test in the testName Set, in the order
   * they appear in the iterator obtained by invoking the elements method on the Set, this trait's implementation
   * of this method checks whether the test should be run based on the tagsToInclude and tagsToExclude Sets.
   * If so, this implementation invokes runTest via passed in args.
   *

   *
   * @param testName an optional name of one test to execute. If None, all relevant tests should be executed.
   *                 I.e., None acts like a wildcard that means execute all relevant tests in this fixture.FreeSpec.
   * @param args the Args for this run
   * @return a Status object that indicates when all tests started by this method have completed, and whether or not a failure occurred.
   * @throws NullPointerException if testName or args is null.
   */
  protected override def runTests(testName: Option[String], args: Args): Status = {
    runTestsImpl(thisSuite, testName, args, info, true, runTest)
  }

  /**
   * An immutable Set of test names. If this fixture.FreeSpec contains no tests, this method returns an
   * empty Set.
   *
   *

   * This trait's implementation of this method will return a set that contains the names of all registered tests. The set's
   * iterator will return those names in the order in which the tests were registered. Each test's name is composed
   * of the concatenation of the text of each surrounding describer, in order from outside in, and the text of the
   * example itself, with all components separated by a space.
   *

   *
   * @return the Set of test names
   */
  override def testNames: Set[String] = {
    // I'm returning a ListSet here so that they tests will be run in registration order
    ListSet(atomic.get.testNamesList.toArray: _*)
  }

  override def run(testName: Option[String], args: Args): Status = {
    runImpl(thisSuite, testName, args, super.run)
  }

  /**
   * Supports shared test registration in fixture.FreeSpecs.
   *
   *

   * This field enables syntax such as the following:
   *

   *
   *

   * behave like nonFullStack(stackWithOneItem)
   * ^
   *

   *
   *

   * For more information and examples of the use of <cod>behave, see the Shared tests section
   * in the main documentation for trait FreeSpec.
   *

   */
  protected val behave = new BehaveWord

  /**
   * Suite style name.
   *
   * @return org.scalatest.fixture.FreeSpec
   */
  final override val styleName: String = "org.scalatest.fixture.FreeSpec"

  override def testDataFor(testName: String, theConfigMap: ConfigMap = ConfigMap.empty): TestData = createTestDataFor(testName, theConfigMap, this)
}


text:
package com.linecorp.armeria.server.http;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatCode;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

import com.linecorp.armeria.client.BlockingWebClient;
import com.linecorp.armeria.client.ClientFactory;
import com.linecorp.armeria.client.WebClient;
import com.linecorp.armeria.client.logging.LoggingClient;
import com.linecorp.armeria.common.HttpResponse;
import com.linecorp.armeria.common.HttpStatus;
import com.linecorp.armeria.server.ServerBuilder;
import com.linecorp.armeria.server.logging.LoggingService;
import com.linecorp.armeria.testing.junit5.server.SelfSignedCertificateExtension;
import com.linecorp.armeria.testing.junit5.server.ServerExtension;

import io.netty.handler.ssl.ClientAuth;
import io.netty.handler.ssl.util.InsecureTrustManagerFactory;

class MutualTlsTest {

    @RegisterExtension
    static SelfSignedCertificateExtension serverCert = new SelfSignedCertificateExtension();

    @RegisterExtension
    static SelfSignedCertificateExtension clientCert = new SelfSignedCertificateExtension();

    @RegisterExtension
    static ServerExtension server = new ServerExtension() {
        @Override
        protected void configure(ServerBuilder sb) throws Exception {
            sb.tls(serverCert.certificateFile(), serverCert.privateKeyFile());
            sb.tlsCustomizer(sslCtxBuilder -> {
                sslCtxBuilder.trustManager(InsecureTrustManagerFactory.INSTANCE)
                             .clientAuth(ClientAuth.REQUIRE);
            });

            sb.service("/", (ctx, req) -> HttpResponse.of("success"));
            sb.decorator(LoggingService.builder().newDecorator());
        }
    };

    @Test
    void normal() {
        try (ClientFactory clientFactory =
                     ClientFactory.builder()
                                  .tls(clientCert.certificateFile(), clientCert.privateKeyFile())
                                  .tlsNoVerify()
                                  .build()) {
            final BlockingWebClient client = WebClient.builder(server.httpsUri())
                                                      .factory(clientFactory)
                                                      .decorator(LoggingClient.newDecorator())
                                                      .build()
                                                      .blocking();
            assertThat(client.get("/").status()).isEqualTo(HttpStatus.OK);
        }
    }

    @Test
    void shouldAllowOverridingTlsKey() {
        assertThatCode(() -> {
            ClientFactory.builder()
                         .tls(clientCert.certificateFile(), clientCert.privateKeyFile())
                         .tls(clientCert.privateKey(), clientCert.certificate());
        }).doesNotThrowAnyException();
    }
}


text:
using Spyder.Client.Common;
using System.Collections.Generic;

namespace Spyder.Client.FunctionKeys
{
    public abstract class RelativeFunctionKey : FunctionKey, IRelativeFunctionKey
    {
        private bool isAbsolute;
        public bool IsAbsolute
        {
            get { return isAbsolute; }
            set
            {
                if (isAbsolute != value)
                {
                    isAbsolute = value;
                    OnPropertyChanged();
                }
            }
        }

        private List<int> absoluteLayerIDs = new List<int>();
        public List<int> AbsoluteLayerIDs
        {
            get { return absoluteLayerIDs; }
            set
            {
                if (absoluteLayerIDs != value)
                {
                    absoluteLayerIDs = value;
                    OnPropertyChanged();
                }
            }
        }

        public override void CopyFrom(IRegister copyFrom)
        {
            base.CopyFrom(copyFrom);

            var myCopyFrom = copyFrom as IRelativeFunctionKey;
            if (myCopyFrom != null)
            {
                this.IsAbsolute = myCopyFrom.IsAbsolute;
                this.AbsoluteLayerIDs = new List<int>(myCopyFrom.AbsoluteLayerIDs);
            }
        }
    }
}


text:
module Api
  class AuthController < BaseController

    before_filter :authenticate_user_from_token!

    protected

    def if_authenticated
      if params[:auth_token] && user_signed_in?
        yield
      end

      render json: {}, status: 401
    end

    def validate_token!
      false unless resource_from_auth_token
    end

    def authenticate_user_from_token!
      user = resource_from_auth_token
      if user
        # We bypass to avoid the callback chain which inappropriately inflates our signin numbers
        sign_in user, store: false, bypass: true
      end
    end

    private

    def resource_from_auth_token
      return unless params[:auth_token]
      id, token = params[:auth_token].split('$')
      user = User.find_by_id(id)

      if user && Devise.secure_compare(user.authentication_token, token)
        user
      end
    end

  end
end


text:
package http_logrus

import (
	"github.com/improbable-eng/go-httpwares"
	"github.com/improbable-eng/go-httpwares/logging/logrus/ctxlogrus"
	"github.com/sirupsen/logrus"
	"net/http"
)

func ExampleMiddleware() {
	h := http.NewServeMux()
	h.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		ctxlogrus.Extract(r.Context()).Info("logging")
	})
	hm := Middleware(logrus.WithField("test", "abc"))(h)
	if err := http.ListenAndServe(":8080", hm); err != nil {
		panic(err)
	}
}

func ExampleWithRequestFieldExtractor() {
	Middleware(logrus.WithField("foo", "bar"),
		WithRequestFieldExtractor(func(req *http.Request) map[string]interface{} {
			return map[string]interface{}{
				"http.request.customFieldA": req.Header.Get("x-custom-header"),
				"http.request.customFieldB": req.Header.Get("x-another-custom-header"),
			}
		}),
	)
}

func ExampleWithResponseFieldExtractor() {
	Middleware(logrus.WithField("foo", "bar"),
		WithResponseFieldExtractor(func(res httpwares.WrappedResponseWriter) map[string]interface{} {
			return map[string]interface{}{
				"http.response.customFieldC": res.StatusCode(),
			}
		}),
	)
}


text:
\section{Umsetzung\label{sec:implementation}}
\begin{table}
\caption{\label{tab:project}Projektaufbau der Implementierung}
\begin{tabular}{lp{2cm}p{8cm}}
cdr-main &             & \\
|\_      & cdr-lib     & \ac{CDR}"=Komponenten.\\
|\_      & service-api & \textit{Service}"=Schnittstelle.\\
|\_      & service-lib & Implementierung der \textit{Service}"=Schnittstelle.\\
|\_      & cdr-poc     & Beinhaltet die Testfälle zur Veranschaulichung des \ac{CDR}"=Entwurfsmusters und die für \textit{Service} spezifische \textit{CDR hooks}.\\
\end{tabular}
\end{table}
Eine Beispielimplementierung des \ac{CDR}"=Entwurfsmusters in Java ist unter \href{https://github.com/Robotregent/cdr}{https://github.com/Robotregent/cdr} zu finden.
Tabelle \ref{tab:project} zeigt den Aufbau des Mavenprojekts und den Zweck der einzelnen Module.
Die Funktionsweise der Beispielimplementierung wird an Hand zweier Testfälle aufgezeigt. Der erste Testfall zeigt wie eine lokale Bereitstellung für die Beispielkomponenten aufgebaut ist, der zweite Testfall zeigt die entfernte Bereitstellung nach dem \ac{CDR}"=Entwurfsmusters.
Um die Testfälle ausführen zu können, muss ein JBoss Anwendungsserver in der Version 7.1.1\footnote{\href{http://download.jboss.org/jbossas/7.1/jboss-as-7.1.1.Final/jboss-as-7.1.1.Final.zip}{{http://download.jboss.org/jbossas/7.1/jboss-as-7.1.1.Final/jboss-as-7.1.1.Final.zip}}} verfügbar sein.
Der Befehl \colorbox{mygray}{\lstinline!mvn install!}, ausgeführt im Ordner \textit{cdr-main}, installiert alle restlichen Abhängigkeiten, übersetzt das Projekt und führt die Testfälle aus.\\
Im Folgenden werden die notwendigen Anpassungen für eine Umsetzung des \ac{CDR}"=Entwurfsmusters aufgezeigt.
\paragraph{Aktivierung}
Um eine Schnittstelle für das \ac{CDR}"=Entwurfsmuster zu aktivieren, muss diese mit \ac{JAX-RS} Annotationen erweitert werden.
Beispielcode \ref{lst:activation} zeigt dies für die \textit{Service}"=Komponente.
\begin{lstlisting}[caption={Aktivierung},captionpos=b,label=lst:activation]
@Path("/")
public interface Service {
	@GET
	@Path("/item")
	@Produces(MediaType.APPLICATION_JSON)
	public TodoItem[] getItems();

	@POST
	@Path("/item")
	@Consumes(MediaType.APPLICATION_JSON)
	public Integer takeItem(TodoItem tdi);
}
\end{lstlisting}
Die Methoden der Komponente werden mit Hilfe der Annotationen \colorbox{mygray}{\lstinline!@GET!} und \colorbox{mygray}{\lstinline!@POST!} den entsprechenden \ac{HTTP}"=Methoden zugeordnet. \colorbox{mygray}{\lstinline!@Path!} bestimmt unter welcher \ac{URI} die annotierten Elemente zu erreichen sind. Weiterführende Informationen über die Gestaltung von \ac{REST}"=Schnittstellen und die Implementierung dieser mit \ac{JAX-RS} liefern Tilkov \cite{Tilkov2011} und Burke \cite{Burke2010}. \\
Die Annotationen \colorbox{mygray}{\lstinline!@Consumes!} und \colorbox{mygray}{\lstinline!@Produces!} steuern die Serialisierung der Parameter und werden im entsprechenden Abschnitt noch näher behandelt.
\newpage
\paragraph{Stellvertreterobjekt}
Der Beispielcode \ref{lst:factory} zeigt mit einem Ausschnitt der abstrakte Klasse \colorbox{mygray}{\lstinline!CDRFactory <T>!} die zentrale Komponente im \ac{CDR}"=Entwurfsmuster.
Die Methode \colorbox{mygray}{\lstinline!T produces()!} muss für jede Ausprägung der abstrakten Klasse implementiert werden und agiert als \textit{Producer}"=Methode des \ac{CDI}"=Mechanismus. Bei der Implementierung genügt es, die Methode \colorbox{mygray}{\lstinline!T getService (Class<T> clazz)!} aufzurufen, um das Stellvertreterobjekt zu erzeugen.
Die \ac{CDI}"=Spezifikation legt in §3.3 fest, dass eine \textit{Producer}"=Methode keine Typvariable als Rückgabewert haben darf. Daher ist diese Indirektion notwendig. Siehe dazu auch \cite{group2009jsr299}.\\
In der Beispielimplementierung wird die \ac{URI} der entfernten Komponente über eine \textit{Properties}"=Datei aufgelöst. Hier sind auch andere Mechanismen wie z.B. Annotationen denkbar.\\
Die Methoden \colorbox{mygray}{\lstinline!registerClientInterceptor()!} und \colorbox{mygray}{\lstinline!registerClientExceptionMapper()!} sind die \textit{CDR hooks} Für den Client.
\begin{lstlisting}[caption={Abstrakte CDR"=Fabrik},captionpos=b,label=lst:factory]
public abstract class CDRFactory <T> {

	protected abstract T produces();

	protected T getService (Class<T> clazz){

		URI uri = getUri(clazz.getCanonicalName());
		ClientRequestFactory crf = new ClientRequestFactory(UriBuilder.fromUri(uri).build());

		registerClientInterceptor(crf);

		ResteasyProviderFactory pf = ResteasyProviderFactory.getInstance();

		registerClientExceptionMapper(pf);

		return crf.createProxy(clazz);
	}

	protected void registerClientInterceptor(ClientRequestFactory crf){
	}

	protected void registerClientExceptionMapper(ResteasyProviderFactory pf){
	}
}
\end{lstlisting}
\newpage
\paragraph{Methodensignaturen}
Die Konfiguration der \ac{HTTP}"=Kommunikation erfolgt bei \ac{JAX-RS} durch Annotation der Komponenten. Dies ermöglicht es, die Geschäftslogik frei von den Details der Bereitstellung zu halten.
Allerdings muss hier eine Abwägung zwischen Transparenz der Methodensignaturen und Aussagekraft der \ac{REST}"=Schnittstelle getroffen werden.
Die Beispielimplementierung nutzt die Möglichkeiten von \ac{JAX-RS} und \textit{resteasy}, um \ac{HTTP}"=Anfragen und "=Antworten unabhängig von der Geschäftslogik manipulieren zu können. Im Konzept werden diese Komponenten als \textit{CDR hooks} bezeichnet.
Durch diesen Mechanismus können beide Ziele erreicht werden.\\
Das Manipulieren der \ac{HTTP}"=Anfrage ist über die in Beispielcode \ref{lst:factory} gezeigte Methode \colorbox{mygray}{\lstinline!registerClientInterceptor()!} möglich. Hier kann ein \textit{resteasy ClientExecutionInterceptor} registriert werden. Siehe dazu auch \cite{resteasy}.\\
Beispielcode \ref{lst:serverinterceptor} zeigt, wie die \ac{HTTP}"=Antwort durch einen \textit{CDR hook} auf der Serverseite manipuliert wird. Um die Aussagekraft der \ac{REST}"=Schnittstelle zu vergrößern, wird nach dem Erzeugen einer Ressource der entsprechende \ac{HTTP}"=Statuscode und \textit{Location"=Header} gesetzt.
\begin{lstlisting}[caption={ServerPostProcessInterceptor},captionpos=b,label=lst:serverinterceptor]
@Provider
@ServerInterceptor
public class ServerPostProcessInterceptor implements PostProcessInterceptor, AcceptedByMethod {

	@Context
	HttpServletRequest request;

	public void postProcess(ServerResponse response) {
		Integer id = (Integer) response.getEntity();
		response.setStatus(201);
		MultivaluedMap<String, Object> headers = response.getMetadata();

		String url = request.getRequestURL().toString();

		headers.add("Location", url );
	}
}
\end{lstlisting}

\paragraph{Exceptions}
Damit die Fehlerbehandlung transparent zur Bereitstellung bleibt, müssen die entsprechenden \textit{CDR hooks} implementiert werden. Ohne diese zusätzlichen Komponenten erzeugt die \ac{JAX-RS}"=Laufzeitumgebung nur eine generische Fehlernachricht.
Der \ac{HTTP}"=Statuscode wäre 500 und auf der Seite des Clients würde der \textit{resteasy}"=Fehlertyp \textit{ClientResponseFailure} erzeugt werden.
Dadurch würde die Semantik der Fehlerbehandlung in der Anwendung verloren gehen und die Geschäftslogik wäre nicht mehr frei von den Details der Bereitstellung. Diese Problematik kann durch die folgenden \textit{CDR hooks} umgangen werden:
\begin{description}
\item [ServerExceptionMapper] Wird von der \ac{JAX-RS}"=Laufzeitumgebung aufgerufen, wenn der entsprechende Fehler auftritt. Der Fehlertyp kann durch einen individuellen Statuscode in der \ac{HTTP}"=Antwort repräsentiert werden.
\item [ClientExceptionMapper] In der \ac{JVM} des Clients kann der Statuscode ausgelesen und der entsprechende Fehlertyp erzeugt werden. Allerdings ist dies nur für Fehlertypen möglich, die den Typ \textit{RuntimeExpetion} erweitern. Beispielcode \ref{lst:ClientExceptionMapper} zeigt einen Ausschnitt aus der Implementierung.
\end{description}
\begin{lstlisting}[caption={ClientExceptionMapper},captionpos=b,label=lst:ClientExceptionMapper]
public class ClientExceptionMapper implements ClientErrorInterceptor{

	public void handle(ClientResponse response) throws RuntimeException{

		if (response.getStatus() == 523){
			throw new SomeApplicationException();
		}
	}
}
\end{lstlisting}
\paragraph{Serialisierung}
Die Annotationen \colorbox{mygray}{\lstinline!@Consumes!} und \colorbox{mygray}{\lstinline!@Produces!} steuern die Serialisierung der Parameter und Rückgabewerte durch die \ac{JAX-RS}"=Laufzeitumgebung.
Werden für diese Annotationen die Werte \textit{application/xml} oder \textit{application/json} gesetzt, kann die \ac{JAX-RS}"=Laufzeitumgebung alle Klassen serialisieren, die entsprechend dem \ac{JAXB}"=Standard annotiert sind.
\newpage


text:
/*
 * U-boot - Configuration file for BF537 PNAV board
 */

#ifndef __CONFIG_BF537_PNAV_H__
#define __CONFIG_BF537_PNAV_H__

#include <asm/config-pre.h>

/*
 * Processor Settings
 */
#define CONFIG_BFIN_CPU             bf537-0.2
#define CONFIG_BFIN_BOOT_MODE       BFIN_BOOT_SPI_MASTER

/*
 * Clock Settings
 *	CCLK = (CLKIN * VCO_MULT) / CCLK_DIV
 *	SCLK = (CLKIN * VCO_MULT) / SCLK_DIV
 */
/* CONFIG_CLKIN_HZ is any value in Hz					*/
#define CONFIG_CLKIN_HZ			24576000
/* CLKIN_HALF controls the DF bit in PLL_CTL      0 = CLKIN		*/
/*                                                1 = CLKIN / 2		*/
#define CONFIG_CLKIN_HALF		0
/* PLL_BYPASS controls the BYPASS bit in PLL_CTL  0 = do not bypass	*/
/*                                                1 = bypass PLL	*/
#define CONFIG_PLL_BYPASS		0
/* VCO_MULT controls the MSEL (multiplier) bits in PLL_CTL		*/
/* Values can range from 0-63 (where 0 means 64)			*/
#define CONFIG_VCO_MULT			20
/* CCLK_DIV controls the core clock divider				*/
/* Values can be 1, 2, 4, or 8 ONLY					*/
#define CONFIG_CCLK_DIV			1
/* SCLK_DIV controls the system clock divider				*/
/* Values can range from 1-15						*/
#define CONFIG_SCLK_DIV			4

/*
 * Memory Settings
 */
#define CONFIG_MEM_ADD_WDTH	10
#define CONFIG_MEM_SIZE		64

#define CONFIG_EBIU_SDRRC_VAL	0x3b7
#define CONFIG_EBIU_SDGCTL_VAL	0x9111cd

#define CONFIG_EBIU_AMGCTL_VAL	0xFF
#define CONFIG_EBIU_AMBCTL0_VAL	0x7BB033B0
#define CONFIG_EBIU_AMBCTL1_VAL	0xFFC27BB0

#define CONFIG_SYS_MONITOR_LEN		(512 * 1024)
#define CONFIG_SYS_MALLOC_LEN		(128 * 1024)

/*
 * Network Settings
 */
#ifndef __ADSPBF534__
#define ADI_CMDS_NETWORK	1
#define CONFIG_BFIN_MAC
#define CONFIG_RMII
#define CONFIG_NET_MULTI	1
#endif
#define CONFIG_HOSTNAME		bf537-pnav
/* Uncomment next line to use fixed MAC address */
/* #define CONFIG_ETHADDR	02:80:ad:24:21:18 */

/*
 * Flash Settings
 */
#define CONFIG_FLASH_CFI_DRIVER
#define CONFIG_SYS_FLASH_BASE		0x20000000
#define CONFIG_SYS_FLASH_CFI
#define CONFIG_SYS_MAX_FLASH_BANKS	1
#define CONFIG_SYS_MAX_FLASH_SECT	71

/*
 * SPI Settings
 */
#define CONFIG_BFIN_SPI
#define CONFIG_ENV_SPI_MAX_HZ	30000000
#define CONFIG_SF_DEFAULT_SPEED	30000000
#define CONFIG_SPI_FLASH
#define CONFIG_SPI_FLASH_STMICRO

/*
 * Env Storage Settings
 */
#if (CONFIG_BFIN_BOOT_MODE == BFIN_BOOT_SPI_MASTER)
#define CONFIG_ENV_IS_EMBEDDED_IN_LDR
#define CONFIG_ENV_IS_IN_SPI_FLASH
#define CONFIG_ENV_OFFSET	0x4000
#else
#define ENV_IS_EMBEDDED
#define CONFIG_ENV_IS_IN_FLASH	1
#define CONFIG_ENV_ADDR		0x20004000
#define CONFIG_ENV_OFFSET	0x4000
#endif
#define CONFIG_ENV_SIZE		0x1000
#define CONFIG_ENV_SECT_SIZE	0x2000
#ifdef ENV_IS_EMBEDDED
/* WARNING - the following is hand-optimized to fit within
 * the sector before the environment sector. If it throws
 * an error during compilation remove an object here to get
 * it linked after the configuration sector.
 */
# define LDS_BOARD_TEXT \
	arch/blackfin/lib/libblackfin.o (.text*); \
	arch/blackfin/cpu/libblackfin.o (.text*); \
	. = DEFINED(env_offset) ? env_offset : .; \
	common/env_embedded.o (.text*);
#endif

/*
 * NAND Settings
 */
#define CONFIG_NAND_PLAT

#define CONFIG_SYS_NAND_BASE		0x20100000
#define CONFIG_SYS_MAX_NAND_DEVICE	1

#define BFIN_NAND_CLE(chip) ((unsigned long)(chip)->IO_ADDR_W | (1 << 2))
#define BFIN_NAND_ALE(chip) ((unsigned long)(chip)->IO_ADDR_W | (1 << 1))
#define BFIN_NAND_WRITE(addr, cmd) \
	do { \
		bfin_write8(addr, cmd); \
		SSYNC(); \
	} while (0)

#define NAND_PLAT_WRITE_CMD(chip, cmd) BFIN_NAND_WRITE(BFIN_NAND_CLE(chip), cmd)
#define NAND_PLAT_WRITE_ADR(chip, cmd) BFIN_NAND_WRITE(BFIN_NAND_ALE(chip), cmd)
#define NAND_PLAT_GPIO_DEV_READY       GPIO_PF12

/*
 * I2C settings
 */
#define CONFIG_BFIN_TWI_I2C	1
#define CONFIG_HARD_I2C		1

/*
 * Misc Settings
 */
#define CONFIG_BAUDRATE		115200
#define CONFIG_MISC_INIT_R
#define CONFIG_RTC_BFIN
#define CONFIG_UART_CONSOLE	0

/* JFFS Partition offset set  */
#define CONFIG_SYS_JFFS2_FIRST_BANK	0
#define CONFIG_SYS_JFFS2_NUM_BANKS	1
/* 512k reserved for u-boot */
#define CONFIG_SYS_JFFS2_FIRST_SECTOR	15

#define CONFIG_BOOTCOMMAND	"run nandboot"
#define CONFIG_BOOTARGS_ROOT	"/dev/mtdblock1 rw rootfstype=yaffs"

/*
 * Pull in common ADI header for remaining command/environment setup
 */
#include <configs/bfin_adi_common.h>

#endif


text:
namespace RestaurantManager.Engine
{
    using System;
    using System.Collections.Generic;
    using System.Text;
    using RestaurantManager.Interfaces.Engine;

    public class ConsoleInterface : IUserInterface
    {
        public IEnumerable<string> Input()
        {
            string currentLine = Console.ReadLine();
            while (currentLine != "End")
            {
                yield return currentLine;
                currentLine = Console.ReadLine();
            }
        }

        public void Output(IEnumerable<string> output)
        {
            var result = new StringBuilder();
            foreach (string line in output)
            {
                result.AppendLine(line);
            }

            Console.Write(result.ToString());
        }
    }
}


text:
/*!
 * Module dependencies.
 */

var SchemaType = require('../schematype')
  , CastError = SchemaType.CastError
  , NumberSchema = require('./number')
  , Types = {
        Boolean: require('./boolean')
      , Date: require('./date')
      , Number: require('./number')
      , String: require('./string')
      , ObjectId: require('./objectid')
      , Buffer: require('./buffer')
    }
  , MongooseArray = require('../types').Array
  , EmbeddedDoc = require('../types').Embedded
  , Mixed = require('./mixed')
  , Query = require('../query')
  , isMongooseObject = require('../utils').isMongooseObject

/**
 * Array SchemaType constructor
 *
 * @param {String} key
 * @param {SchemaType} cast
 * @param {Object} options
 * @inherits SchemaType
 * @api private
 */

function SchemaArray (key, cast, options) {
  if (cast) {
    var castOptions = {};

    if ('Object' === cast.constructor.name) {
      if (cast.type) {
        // support { type: Woot }
        castOptions = cast;
        cast = cast.type;
        delete castOptions.type;
      } else {
        cast = Mixed;
      }
    }

    var caster = cast.name in Types ? Types[cast.name] : cast;
    this.casterConstructor = caster;
    this.caster = new caster(null, castOptions);
    if (!(this.caster instanceof EmbeddedDoc)) {
      this.caster.path = key;
    }
  }

  SchemaType.call(this, key, options);

  var self = this
    , defaultArr
    , fn;

  if (this.defaultValue) {
    defaultArr = this.defaultValue;
    fn = 'function' == typeof defaultArr;
  }

  this.default(function(){
    var arr = fn ? defaultArr() : defaultArr || [];
    return new MongooseArray(arr, self.path, this);
  });
};

/*!
 * Inherits from SchemaType.
 */

SchemaArray.prototype.__proto__ = SchemaType.prototype;

/**
 * Check required
 *
 * @param {Array} value
 * @api private
 */

SchemaArray.prototype.checkRequired = function (value) {
  return !!(value && value.length);
};

/**
 * Overrides the getters application for the population special-case
 *
 * @param {Object} value
 * @param {Object} scope
 * @api private
 */

SchemaArray.prototype.applyGetters = function (value, scope) {
  if (this.caster.options && this.caster.options.ref) {
    // means the object id was populated
    return value;
  }

  return SchemaType.prototype.applyGetters.call(this, value, scope);
};

/**
 * Casts contents
 *
 * @param {Object} value
 * @param {Document} doc document that triggers the casting
 * @param {Boolean} init whether this is an initialization cast
 * @api private
 */

SchemaArray.prototype.cast = function (value, doc, init) {
  if (Array.isArray(value)) {
    if (!(value instanceof MongooseArray)) {
      value = new MongooseArray(value, this.path, doc);
    }

    if (this.caster) {
      try {
        for (var i = 0, l = value.length; i < l; i++) {
          value[i] = this.caster.cast(value[i], doc, init);
        }
      } catch (e) {
        // rethrow
        throw new CastError(e.type, value, this.path);
      }
    }

    return value;
  } else {
    return this.cast([value], doc, init);
  }
};

/**
 * Casts contents for queries.
 *
 * @param {String} $conditional
 * @param {any} [value]
 * @api private
 */

SchemaArray.prototype.castForQuery = function ($conditional, value) {
  var handler
    , val;
  if (arguments.length === 2) {
    handler = this.$conditionalHandlers[$conditional];
    if (!handler)
      throw new Error("Can't use " + $conditional + " with Array.");
    val = handler.call(this, value);
  } else {
    val = $conditional;
    var proto = this.casterConstructor.prototype;
    var method = proto.castForQuery || proto.cast;

    var caster = this.caster;
    if (Array.isArray(val)) {
      val = val.map(function (v) {
        if (method) v = method.call(caster, v);

        return isMongooseObject(v)
          ? v.toObject()
          : v;
      });
    } else if (method) {
      val = method.call(caster, val);
    }
  }
  return val && isMongooseObject(val)
    ? val.toObject()
    : val;
};

/*!
 * @ignore
 */

function castToNumber (val) {
  return Types.Number.prototype.cast.call(this, val);
}

SchemaArray.prototype.$conditionalHandlers = {
    '$all': function handle$all (val) {
      if (!Array.isArray(val)) {
        val = [val];
      }

      val = val.map(function (v) {
        if (v && 'Object' === v.constructor.name) {
          var o = {};
          o[this.path] = v;
          var query = new Query(o);
          query.cast(this.casterConstructor);
          return query._conditions[this.path];
        }
        return v;
      }, this);

      return this.castForQuery(val);
    }
  , '$elemMatch': function (val) {
      if (val.$in) {
        val.$in = this.castForQuery('$in', val.$in);
        return val;
      }

      var query = new Query(val);
      query.cast(this.casterConstructor);
      return query._conditions;
    }
  , '$size': castToNumber
  , '$ne': SchemaArray.prototype.castForQuery
  , '$in': SchemaArray.prototype.castForQuery
  , '$nin': SchemaArray.prototype.castForQuery
  , '$regex': SchemaArray.prototype.castForQuery
  , '$near': SchemaArray.prototype.castForQuery
  , '$nearSphere': SchemaArray.prototype.castForQuery
  , '$gt': SchemaArray.prototype.castForQuery
  , '$gte': SchemaArray.prototype.castForQuery
  , '$lt': SchemaArray.prototype.castForQuery
  , '$lte': SchemaArray.prototype.castForQuery
  , '$within': function (val) {
      var self = this;

      if (val.$maxDistance) {
        val.$maxDistance = castToNumber.call(this, val.$maxDistance);
      }

      if (val.$box || val.$polygon) {
        var type = val.$box ? '$box' : '$polygon';
        val[type].forEach(function (arr) {
          if (!Array.isArray(arr)) {
            var msg = 'Invalid $within $box argument. '
                    + 'Expected an array, received ' + arr;
            throw new TypeError(msg);
          }
          arr.forEach(function (v, i) {
            arr[i] = castToNumber.call(this, v);
          });
        })
      } else if (val.$center || val.$centerSphere) {
        var type = val.$center ? '$center' : '$centerSphere';
        val[type].forEach(function (item, i) {
          if (Array.isArray(item)) {
            item.forEach(function (v, j) {
              item[j] = castToNumber.call(this, v);
            });
          } else {
            val[type][i] = castToNumber.call(this, item);
          }
        })
      }

      return val;
    }
  , '$maxDistance': castToNumber
};

/*!
 * Module exports.
 */

module.exports = SchemaArray;


text:
// It includes skill, equipment, card and so on
package main

import (
	//"database/sql"
	"flag"
	"fmt"
	"time"

	//"net/http"
	"runtime"

	//"gokvstore/common/goredis"
	"gokvstore/common/libutil"
	"gokvstore/common/logging"
	"gokvstore/tcpserver"
	"gokvstore/core"
	//_ "github.com/go-sql-driver/mysql"
)

var cfg = struct {
	Log struct {
		File   string
		Level  string
		Name   string
		Suffix string
	}

	Prog struct {
		CPU        int
		Daemon     bool
		HealthPort string
	}

	Server struct {
		//Redis    string
		//Mysql    string
		PortInfo string
		SendChannelLimit uint32
		RecvChannelLimit uint32
		SendTimeoutSec uint32
		RecvTimeoutSec uint32
	}
}{}

func main() {

	//配置解析
	config := flag.String("c", "conf/config.json", "config file")
	flag.Parse()
	if err := libutil.ParseJSON(*config, &cfg); err != nil {
		fmt.Printf("parse config %s error: %s\n", *config, err.Error())
		return
	}

	//日志
	if err := libutil.TRLogger(cfg.Log.File, cfg.Log.Level, cfg.Log.Name, cfg.Log.Suffix, cfg.Prog.Daemon); err != nil {
		fmt.Printf("init time rotate logger error: %s\n", err.Error())
		return
	}
	//if cfg.Prog.CPU == 0 {
	//	runtime.GOMAXPROCS(runtime.NumCPU()) //配0就用所有核
	//} else {
	//	runtime.GOMAXPROCS(cfg.Prog.CPU)
	//}
	runtime.GOMAXPROCS(1)

	//日志
    logging.Debug("server start")

	//Mysql
	//InitMysql()
	//TestMysql()

	//Redis
	//InitRedis()
	//TestRedis()

	libutil.InitSignal()
/*
	go func() {
		err := http.ListenAndServe(cfg.Prog.HealthPort, nil)
		if err != nil {
			logging.Error("ListenAndServe: %s", err.Error())
		}
	}()
*/
	//registerHttpHandle()
	//httpclient
	//TestHttpClient()

	GeneralTest()

	core.CoreMemMap=core.NewCoreMem()

	go tcpserver.StartTcpServer(cfg.Server.PortInfo, cfg.Server.SendChannelLimit,
	cfg.Server.RecvChannelLimit,cfg.Server.SendTimeoutSec,
	cfg.Server.RecvTimeoutSec)

	//go func(){
	//	http.ListenAndServe(cfg.Server.PortInfo, nil)
	//}()

	file, err := libutil.DumpPanic("gsrv")
	if err != nil {
		logging.Error("init dump panic error: %s", err.Error())
	}

	defer func() {
		logging.Info("server stop...:%d", runtime.NumGoroutine())
		time.Sleep(time.Second)
		logging.Info("server stop...,ok")
		if err := libutil.ReviewDumpPanic(file); err != nil {
			logging.Error("review dump panic error: %s", err.Error())
		}

	}()
	<-libutil.ChanRunning

}