本文整理汇总了C++中G_STRINGIFY函数的典型用法代码示例。如果您正苦于以下问题:C++ G_STRINGIFY函数的具体用法?C++ G_STRINGIFY怎么用?C++ G_STRINGIFY使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了G_STRINGIFY函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: test_001
void
test_001(gpointer *fixture, gconstpointer data)
{
GType type = g_type_from_name("Log4gTTCCLayout");
g_assert(type);
Log4gLayout *layout = g_object_new(type, NULL);
g_assert(layout);
log4g_layout_activate_options(layout);
type = g_type_from_name("Log4gRollingFileAppender");
g_assert(type);
Log4gAppender *appender = g_object_new(type,
"file", "rolling-file-appender-test.txt",
"max-backup-index", 4,
"maximum-file-size", 10,
NULL);
g_assert(appender);
log4g_appender_set_layout(appender, layout);
log4g_appender_activate_options(appender);
g_object_unref(layout);
for (gint i = 0; i < 10; ++i) {
va_list ap;
memset(&ap, 0, sizeof ap);
Log4gLoggingEvent *event = log4g_logging_event_new(
"org.gnome.test", log4g_level_DEBUG(),
__func__, __FILE__, G_STRINGIFY(__LINE__),
"test message", ap);
g_assert(event);
log4g_appender_do_append(appender, event);
g_object_unref(event);
usleep(20);
}
g_object_unref(appender);
}
示例2: gst_dshowaudiodec_base_init
static void
gst_dshowaudiodec_base_init (gpointer klass)
{
GstDshowAudioDecClass *audiodec_class = (GstDshowAudioDecClass *) klass;
GstPadTemplate *src, *sink;
GstCaps *srccaps, *sinkcaps;
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
char *description;
audiodec_class->entry = tmp;
description = g_strdup_printf ("DirectShow %s Decoder Wrapper",
tmp->element_longname);
gst_element_class_set_details_simple (element_class, description,
"Codec/Decoder/Audio", description,
"Sebastien Moutte <[email protected]>");
g_free (description);
sinkcaps = gst_caps_from_string (tmp->sinkcaps);
srccaps = gst_caps_from_string (
"audio/x-raw-int,"
"width = (int)[1, 32],"
"depth = (int)[1, 32],"
"rate = (int)[1, MAX],"
"channels = (int)[1, MAX],"
"signed = (boolean)true,"
"endianness = (int)" G_STRINGIFY(G_LITTLE_ENDIAN));
sink = gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, sinkcaps);
src = gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, srccaps);
/* register */
gst_element_class_add_pad_template (element_class, src);
gst_element_class_add_pad_template (element_class, sink);
}
示例3: test_001
void
test_001(G_GNUC_UNUSED gpointer *fixture, G_GNUC_UNUSED gconstpointer data)
{
GType type = g_type_from_name("Log4gSimpleLayout");
g_assert(type);
Log4gLayout *layout = g_object_new(type, NULL);
g_assert(layout);
log4g_layout_activate_options(layout);
va_list ap;
memset(&ap, 0, sizeof ap);
Log4gLoggingEvent *event = log4g_logging_event_new("org.gnome.test",
log4g_level_DEBUG(), __func__, __FILE__,
G_STRINGIFY(__LINE__), "test message", ap);
g_assert(event);
type = g_type_from_name("Log4gConsoleAppender");
g_assert(type);
Log4gAppender *appender = g_object_new(type, "target", "stdout", NULL);
g_assert(appender);
log4g_appender_set_layout(appender, layout);
log4g_appender_activate_options(appender);
g_object_unref(layout);
log4g_appender_do_append(appender, event);
log4g_appender_close(appender);
g_object_unref(event);
g_object_unref(appender);
}
示例4: daemon_init
void
daemon_init (void)
{
GDBusConnection *conn;
GError *error;
setlocale (LC_ALL, "");
bindtextdomain (GETTEXT_PACKAGE, GVFS_LOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
g_log_set_handler (NULL, G_LOG_LEVEL_DEBUG, log_debug, G_STRINGIFY (DEFAULT_BACKEND_TYPE));
gvfs_setup_debug_handler ();
#ifdef SIGPIPE
/* Ignore SIGPIPE to avoid killing daemons on cancelled transfer *
* See https://bugzilla.gnome.org/show_bug.cgi?id=649041 *
*/
signal (SIGPIPE, SIG_IGN);
#endif
error = NULL;
conn = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
if (!conn)
{
g_printerr ("Error connecting to D-Bus: %s (%s, %d)\n",
error->message, g_quark_to_string (error->domain), error->code);
g_error_free (error);
exit (1);
}
g_object_unref (conn);
}
示例5: _rut_pointalism_grid_init_type
void
_rut_pointalism_grid_init_type (void)
{
static RutRefableVTable refable_vtable = {
rut_refable_simple_ref,
rut_refable_simple_unref,
_rut_pointalism_grid_free
};
static RutComponentableVTable componentable_vtable = {
.copy = _rut_pointalism_grid_copy
};
static RutPrimableVTable primable_vtable = {
.get_primitive = rut_pointalism_grid_get_primitive
};
static RutMeshableVTable meshable_vtable = {
.get_mesh = rut_pointalism_grid_get_pick_mesh
};
static RutIntrospectableVTable introspectable_vtable = {
rut_simple_introspectable_lookup_property,
rut_simple_introspectable_foreach_property
};
RutType *type = &rut_pointalism_grid_type;
#define TYPE RutPointalismGrid
rut_type_init (type, G_STRINGIFY (TYPE));
rut_type_add_interface (type,
RUT_INTERFACE_ID_REF_COUNTABLE,
offsetof (TYPE, ref_count),
&refable_vtable);
rut_type_add_interface (type,
RUT_INTERFACE_ID_COMPONENTABLE,
offsetof (TYPE, component),
&componentable_vtable);
rut_type_add_interface (type,
RUT_INTERFACE_ID_PRIMABLE,
0, /* no associated properties */
&primable_vtable);
rut_type_add_interface (type,
RUT_INTERFACE_ID_MESHABLE,
0, /* no associated properties */
&meshable_vtable);
rut_type_add_interface (type,
RUT_INTERFACE_ID_INTROSPECTABLE,
0,
&introspectable_vtable);
rut_type_add_interface (type,
RUT_INTERFACE_ID_SIMPLE_INTROSPECTABLE,
offsetof (TYPE, introspectable),
NULL);
#undef TYPE
}
示例6: gst_omx_audio_dec_class_init
static void
gst_omx_audio_dec_class_init (GstOMXAudioDecClass * klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
GstAudioDecoderClass *audio_decoder_class = GST_AUDIO_DECODER_CLASS (klass);
gobject_class->finalize = gst_omx_audio_dec_finalize;
element_class->change_state =
GST_DEBUG_FUNCPTR (gst_omx_audio_dec_change_state);
audio_decoder_class->open = GST_DEBUG_FUNCPTR (gst_omx_audio_dec_open);
audio_decoder_class->close = GST_DEBUG_FUNCPTR (gst_omx_audio_dec_close);
audio_decoder_class->start = GST_DEBUG_FUNCPTR (gst_omx_audio_dec_start);
audio_decoder_class->stop = GST_DEBUG_FUNCPTR (gst_omx_audio_dec_stop);
audio_decoder_class->flush = GST_DEBUG_FUNCPTR (gst_omx_audio_dec_flush);
audio_decoder_class->set_format =
GST_DEBUG_FUNCPTR (gst_omx_audio_dec_set_format);
audio_decoder_class->handle_frame =
GST_DEBUG_FUNCPTR (gst_omx_audio_dec_handle_frame);
klass->cdata.type = GST_OMX_COMPONENT_TYPE_FILTER;
klass->cdata.default_src_template_caps =
"audio/x-raw, "
"rate = (int) [ 1, MAX ], "
"channels = (int) [ 1, " G_STRINGIFY (OMX_AUDIO_MAXCHANNELS) " ], "
"format = (string) " GST_AUDIO_FORMATS_ALL;
}
示例7: gst_omx_audio_enc_class_init
static void
gst_omx_audio_enc_class_init (GstOMXAudioEncClass * klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
GstAudioEncoderClass *audio_encoder_class = GST_AUDIO_ENCODER_CLASS (klass);
gobject_class->finalize = gst_omx_audio_enc_finalize;
element_class->change_state =
GST_DEBUG_FUNCPTR (gst_omx_audio_enc_change_state);
audio_encoder_class->start = GST_DEBUG_FUNCPTR (gst_omx_audio_enc_start);
audio_encoder_class->stop = GST_DEBUG_FUNCPTR (gst_omx_audio_enc_stop);
audio_encoder_class->flush = GST_DEBUG_FUNCPTR (gst_omx_audio_enc_flush);
audio_encoder_class->set_format =
GST_DEBUG_FUNCPTR (gst_omx_audio_enc_set_format);
audio_encoder_class->handle_frame =
GST_DEBUG_FUNCPTR (gst_omx_audio_enc_handle_frame);
audio_encoder_class->sink_event =
GST_DEBUG_FUNCPTR (gst_omx_audio_enc_sink_event);
klass->cdata.type = GST_OMX_COMPONENT_TYPE_FILTER;
klass->cdata.default_sink_template_caps = "audio/x-raw, "
"rate = (int) [ 1, MAX ], "
"channels = (int) [ 1, " G_STRINGIFY (OMX_AUDIO_MAXCHANNELS) " ], "
"format = (string) { S8, U8, S16LE, S16BE, U16LE, U16BE, "
"S24LE, S24BE, U24LE, U24BE, S32LE, S32BE, U32LE, U32BE }";
}
示例8: c_main_window_get_type
GType
c_main_window_get_type (void)
{
static GType type = 0;
if (G_UNLIKELY (!type))
{
GTypeInfo const info = {
sizeof (CMainWindowIface),
NULL, NULL,
(GClassInitFunc) c_main_window_iface_init,
NULL, NULL,
0, 0,
NULL
};
type = g_type_register_static (G_TYPE_INTERFACE,
G_STRINGIFY (CMainWindow),
&info, 0);
g_type_interface_add_prerequisite (type, GTK_TYPE_WINDOW);
}
return type;
}
示例9: version_get_dbus_cb
/**
* D-Bus callback for the version get method call
*
* @param msg The D-Bus message to reply to
* @return TRUE on success, FALSE on failure
*/
static gboolean version_get_dbus_cb(DBusMessage *const msg)
{
static const gchar *const versionstring = G_STRINGIFY(PRG_VERSION);
DBusMessage *reply = NULL;
gboolean status = FALSE;
mce_log(LL_DEBUG, "Received version information request");
/* Create a reply */
reply = dbus_new_method_reply(msg);
/* Append the version information */
if (dbus_message_append_args(reply,
DBUS_TYPE_STRING, &versionstring,
DBUS_TYPE_INVALID) == FALSE) {
mce_log(LL_CRIT,
"Failed to append reply argument to D-Bus message "
"for %s.%s",
MCE_REQUEST_IF, MCE_VERSION_GET);
dbus_message_unref(reply);
goto EXIT;
}
/* Send the message */
status = dbus_send_message(reply);
EXIT:
return status;
}
示例10: test_001
void
test_001(gpointer *fixture, gconstpointer data)
{
GType type = g_type_from_name("Log4gCouchdbAppender");
g_assert(type);
Log4gAppender *appender = g_object_new(type, "database-name",
"couchdb_appender_test", NULL);
g_assert(appender);
log4g_appender_activate_options(appender);
va_list ap;
memset(&ap, 0, sizeof ap);
for (gint i = 0; i < 5; ++i) {
log4g_mdc_put("couchdb-appender-test", "test in loop %d", i);
log4g_ndc_push("LOOP %d", i);
Log4gLoggingEvent *event = log4g_logging_event_new(
"org.gnome.test", log4g_level_DEBUG(),
__func__, __FILE__, G_STRINGIFY(__LINE__),
"test message", ap);
g_assert(event);
log4g_appender_do_append(appender, event);
g_object_unref(event);
usleep(20);
}
g_object_unref(appender);
}
示例11: test_001
void
test_001(gpointer *fixture, gconstpointer data)
{
GType type = g_type_from_name("Log4gSimpleLayout");
g_assert(type);
Log4gLayout *layout = g_object_new(type, NULL);
g_assert(layout);
log4g_layout_activate_options(layout);
type = g_type_from_name("Log4gSyslogAppender");
g_assert(type);
Log4gAppender *appender = g_object_new(type,
"ident", "syslog-appender-test",
"option", LOG_USER,
"facility", LOG_CONS,
NULL);
g_assert(appender);
log4g_appender_set_layout(appender, layout);
log4g_appender_activate_options(appender);
g_object_unref(layout);
for (gint i = 0; i < 5; ++i) {
log4g_ndc_push("LOOP %d", i);
va_list ap;
memset(&ap, 0, sizeof ap);
Log4gLoggingEvent *event = log4g_logging_event_new(
"org.gnome.test", log4g_level_INFO(),
__func__, __FILE__, G_STRINGIFY(__LINE__),
"test message", ap);
g_assert(event);
log4g_appender_do_append(appender, event);
g_object_unref(event);
usleep(20);
}
g_object_unref(appender);
}
示例12: _rut_fold_init_type
static void
_rut_fold_init_type (void)
{
static RutRefableVTable refable_vtable = {
rut_refable_simple_ref,
rut_refable_simple_unref,
_rut_fold_free
};
static RutGraphableVTable graphable_vtable = {
NULL, /* child removed */
NULL, /* child added */
NULL /* parent changed */
};
static RutSizableVTable sizable_vtable = {
rut_composite_sizable_set_size,
rut_composite_sizable_get_size,
rut_composite_sizable_get_preferred_width,
rut_composite_sizable_get_preferred_height,
rut_composite_sizable_add_preferred_size_callback
};
static RutIntrospectableVTable introspectable_vtable = {
rut_simple_introspectable_lookup_property,
rut_simple_introspectable_foreach_property
};
RutType *type = &rut_fold_type;
#define TYPE RutFold
rut_type_init (type, G_STRINGIFY (TYPE));
rut_type_add_interface (type,
RUT_INTERFACE_ID_REF_COUNTABLE,
offsetof (TYPE, ref_count),
&refable_vtable);
rut_type_add_interface (type,
RUT_INTERFACE_ID_GRAPHABLE,
offsetof (TYPE, graphable),
&graphable_vtable);
rut_type_add_interface (type,
RUT_INTERFACE_ID_SIZABLE,
0, /* no implied properties */
&sizable_vtable);
rut_type_add_interface (type,
RUT_INTERFACE_ID_COMPOSITE_SIZABLE,
offsetof (TYPE, vbox),
NULL); /* no vtable */
rut_type_add_interface (type,
RUT_INTERFACE_ID_INTROSPECTABLE,
0, /* no implied properties */
&introspectable_vtable);
rut_type_add_interface (type,
RUT_INTERFACE_ID_SIMPLE_INTROSPECTABLE,
offsetof (TYPE, introspectable),
NULL); /* no implied vtable */
#undef TYPE
}
示例13: gkr_debug_message
void
gkr_debug_message (GkrDebugFlags flag,
const gchar *format,
...)
{
static gsize initialized_flags = 0;
const gchar *messages_env;
const gchar *debug_env;
va_list args;
if (g_once_init_enter (&initialized_flags)) {
messages_env = g_getenv ("G_MESSAGES_DEBUG");
debug_env = g_getenv ("GKR_DEBUG");
#ifdef GKR_DEBUG
if (debug_env == NULL)
debug_env = G_STRINGIFY (GKR_DEBUG);
#endif
/*
* If the caller is selectively asking for certain debug
* messages with the GKR_DEBUG environment variable, then
* we install our own output handler and only print those
* messages. This happens irrespective of G_MESSAGES_DEBUG
*/
if (messages_env == NULL && debug_env != NULL)
g_log_set_handler (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG,
on_gkr_log_debug, NULL);
/*
* If the caller is using G_MESSAGES_DEBUG then we enable
* all our debug messages, and let Glib filter which ones
* to display.
*/
if (messages_env != NULL && debug_env == NULL)
debug_env = "all";
gkr_debug_set_flags (debug_env);
#ifdef FOR_WHEN_ALL_ELSE_FAILS
openlog ("libgnome-keyring", LOG_NDELAY | LOG_PID, LOG_AUTHPRIV);
gkr_debug_set_flags ("all");
#endif
g_once_init_leave (&initialized_flags, 1);
}
if (flag & current_flags) {
va_start (args, format);
g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, format, args);
va_end (args);
}
#ifdef FOR_WHEN_ALL_ELSE_FAILS
va_start (args, format);
vsyslog (LOG_ERR, format, args);
va_end (args);
#endif
}
示例14: print_version
/**
* Just print version and quit
*/
static void
print_version (void)
{
printf ("XMMS2 version " XMMS_VERSION "\n");
printf ("Copyright (C) 2003-2012 XMMS2 Team\n");
printf ("This is free software; see the source for copying conditions.\n");
printf ("There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A\n");
printf ("PARTICULAR PURPOSE.\n");
printf (" Using glib version %d.%d.%d (compiled against "
G_STRINGIFY (GLIB_MAJOR_VERSION) "."
G_STRINGIFY (GLIB_MINOR_VERSION) "."
G_STRINGIFY (GLIB_MICRO_VERSION) ")\n",
glib_major_version,
glib_minor_version,
glib_micro_version);
exit (EXIT_SUCCESS);
}
示例15: g_get_system_data_dirs
std::vector<std::string> Platform::getConfigPaths()
{
const gchar * const *datadirs = g_get_system_data_dirs();
std::vector<std::string> dirs;
/* Always prefer config files in the current directory */
dirs.push_back(std::string(".") + G_DIR_SEPARATOR);
/* Otherwise prefer the app's current directory */
if (binary_path)
dirs.push_back(std::string(binary_path) + G_DIR_SEPARATOR);
dirs.push_back(std::string(G_STRINGIFY(DATADIR)) + G_DIR_SEPARATOR);
dirs.push_back(std::string(G_STRINGIFY(SYSCONFDIR)) + G_DIR_SEPARATOR);
for(gsize i = 0; datadirs[i] != NULL; ++i)
dirs.push_back(std::string(datadirs[i]) + G_DIR_SEPARATOR + "repsnapper" + G_DIR_SEPARATOR);
return dirs;
}