当前位置: 首页>>代码示例>>C++>>正文


C++ Q_函数代码示例

本文整理汇总了C++中Q_函数的典型用法代码示例。如果您正苦于以下问题:C++ Q_函数的具体用法?C++ Q_怎么用?C++ Q_使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Q_函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: help_unknown_ref

void help_unknown_ref(const char *ref, const char *cmd, const char *error)
{
	int i;
	struct string_list suggested_refs = guess_refs(ref);

	fprintf_ln(stderr, _("%s: %s - %s"), cmd, ref, error);

	if (suggested_refs.nr > 0) {
		fprintf_ln(stderr,
			   Q_("\nDid you mean this?",
			      "\nDid you mean one of these?",
			      suggested_refs.nr));
		for (i = 0; i < suggested_refs.nr; i++)
			fprintf(stderr, "\t%s\n", suggested_refs.items[i].string);
	}

	string_list_clear(&suggested_refs, 0);
	exit(1);
}
开发者ID:GeertBosch,项目名称:git-stream,代码行数:19,代码来源:help.c

示例2: joy_iterator_next

JoyIterator *
joy_iterator_next(JoyIterator *self)
{
	g_return_val_if_fail(JOY_IS_ITERATOR(self), NULL);
	gpointer next = NULL;
	JoyIteratorClass *klass = JOY_ITERATOR_GET_CLASS(self);
	if (G_LIKELY(klass->next_item)) {
		next = klass->next_item(self);
	} else {
		g_warning(Q_("%s: unsupported operation for type '%s'"),
				G_STRFUNC, G_OBJECT_TYPE_NAME(self));
	}
	if (next) {
		GET_PRIVATE(self)->item = next;
		return self;
	} else {
		g_object_unref(self);
		return NULL;
	}
}
开发者ID:msteinert,项目名称:joybubbles,代码行数:20,代码来源:iterator.c

示例3: events_init

/****************************************************************************
  Initialize events. 
  Now also initialise sorted_events[].
****************************************************************************/
void events_init(void)
{
  int i;
  
  for (i = 0; i < ARRAY_SIZE(event_to_index); i++) {
    event_to_index[i] = 0;
  }

  for (i = 0; events[i].enum_name; i++) {
    int j;

    if (E_S_XYZZY > events[i].esn) {
      const char *event_format = Q_(event_sections[events[i].esn]);
      int l = 1 + strlen(event_format) + strlen(_(events[i].descr_orig));

      events[i].full_descr = fc_malloc(l);
      fc_snprintf(events[i].full_descr, l, event_format,
                  _(events[i].descr_orig));
    } else {
      /* No section part */
      events[i].full_descr = _(events[i].descr_orig);
    }

    event_to_index[events[i].event] = i;
    events[i].tag_name = fc_strdup(events[i].enum_name);
    for (j = 0; j < strlen(events[i].tag_name); j++) {
      events[i].tag_name[j] = fc_tolower(events[i].tag_name[j]);
    }
    log_debug("event[%d]=%d: name='%s' / '%s'\n"
              "\tdescr_orig='%s'\n"
              "\tdescr='%s'",
              i, events[i].event, events[i].enum_name, events[i].tag_name,
              events[i].descr_orig, events[i].full_descr);
  }

  for (i = 0; i < E_LAST; i++)  {
    sorted_events[i] = i;
  }
  qsort(sorted_events, E_LAST, sizeof(*sorted_events),
	compar_event_message_texts);
}
开发者ID:jheusala,项目名称:freeciv-extended,代码行数:45,代码来源:events.c

示例4: xmalloc

static void *get_data_from_pack(struct object_entry *obj)
{
	off_t from = obj[0].idx.offset + obj[0].hdr_size;
	unsigned long len = obj[1].idx.offset - from;
	unsigned char *data, *inbuf;
	git_zstream stream;
	int status;

	data = xmalloc(obj->size);
	inbuf = xmalloc((len < 64*1024) ? len : 64*1024);

	memset(&stream, 0, sizeof(stream));
	git_inflate_init(&stream);
	stream.next_out = data;
	stream.avail_out = obj->size;

	do {
		ssize_t n = (len < 64*1024) ? len : 64*1024;
		n = pread(pack_fd, inbuf, n, from);
		if (n < 0)
			die_errno(_("cannot pread pack file"));
		if (!n)
			die(Q_("premature end of pack file, %lu byte missing",
			       "premature end of pack file, %lu bytes missing",
			       len),
			    len);
		from += n;
		len -= n;
		stream.next_in = inbuf;
		stream.avail_in = n;
		status = git_inflate(&stream, 0);
	} while (len && status == Z_OK && !stream.avail_in);

	/* This has been inflated OK when first encountered, so... */
	if (status != Z_STREAM_END || stream.total_out != obj->size)
		die(_("serious inflate inconsistency"));

	git_inflate_end(&stream);
	free(inbuf);
	return data;
}
开发者ID:CCorreia,项目名称:git,代码行数:41,代码来源:index-pack.c

示例5: serial_read

static gboolean
serial_read(QahiraFormat *self, GInputStream *stream, GCancellable *cancel,
		guchar *buffer, gsize size, GError **error)
{
	while (size) {
		gssize bytes = g_input_stream_read(stream, buffer, size,
				cancel, error);
		if (G_UNLIKELY(-1 == bytes)) {
			return FALSE;
		}
		if (G_UNLIKELY(size && !bytes)) {
			g_set_error(error, QAHIRA_ERROR,
					QAHIRA_ERROR_CORRUPT_IMAGE,
					Q_("serial: truncated format"));
			return FALSE;
		}
		size -= bytes;
		buffer += bytes;
	}
	return TRUE;
}
开发者ID:msteinert,项目名称:qahira,代码行数:21,代码来源:serial.c

示例6: date_pattern_converter_convert

static const gchar *
date_pattern_converter_convert(Log4gPatternConverter *base,
		Log4gLoggingEvent *event)
{
	struct DatePrivate *priv = GET_DATE_PRIVATE(base);
	const GTimeVal *tv = log4g_logging_event_get_time_stamp(event);
	if (!tv) {
		return NULL;
	}
	struct tm tm;
	time_t time = tv->tv_sec;
	if (!localtime_r(&time, &tm)) {
		log4g_log_error("localtime_r(): %s", g_strerror(errno));
		return NULL;
	}
	if (!strftime(priv->buffer, sizeof priv->buffer, priv->format, &tm)) {
		log4g_log_error(Q_("strftime() returned zero (0)"));
		return NULL;
	}
	return priv->buffer;
}
开发者ID:msteinert,项目名称:log4g,代码行数:21,代码来源:pattern-converter.c

示例7: T_

void
FndbManager::ReadDirectory (/*[in]*/ const char *		lpszPath,
			    /*[out]*/ vector<string> &	subDirectoryNames,
			    /*[out]*/ vector<FILENAMEINFO> &	fileNames)
{
  if (! Directory::Exists(lpszPath))
    {
      traceStream->WriteFormattedLine ("core",
				       T_("the directory %s does not exist"),
				       Q_(lpszPath));
      return;
    }
  vector<string> filesToBeIgnored;
  GetIgnorableFiles (lpszPath, filesToBeIgnored);
  auto_ptr<DirectoryLister> pLister (DirectoryLister::Open(lpszPath));
  DirectoryEntry entry;
  while (pLister->GetNext(entry))
    {
      if (binary_search(filesToBeIgnored.begin(),
			filesToBeIgnored.end(),
			entry.name.c_str(),
			StringComparerIgnoringCase()))
	{
	  continue;
	}
      if (entry.isDirectory)
	{
	  subDirectoryNames.push_back (entry.name.c_str());
	}
      else
	{
	  FILENAMEINFO filenameinfo;
	  filenameinfo.FileName = entry.name;
	  fileNames.push_back (filenameinfo);
	}
    }
  pLister->Close ();
}
开发者ID:bngabonziza,项目名称:miktex,代码行数:38,代码来源:makefndb.cpp

示例8: gq_display_clist_class_init

static void
gq_display_clist_class_init(GQDisplayCListClass* self_class) {
	GQTypeDisplayClass* gtd_class = GQ_TYPE_DISPLAY_CLASS(self_class);
	GQDisplayBinaryGenericClass* gdbg_class = GQ_DISPLAY_BINARY_GENERIC_CLASS(self_class);

	gtd_class->name = Q_("displaytype|Column List");
	gtd_class->selectable = FALSE;
	gtd_class->show_in_search_result = FALSE;
	gtd_class->get_widget = dt_clist_get_widget;
	gtd_class->get_data = dt_clist_get_data;
	gtd_class->set_data = dt_generic_binary_set_data; // reused from dt_generic_binary
	gtd_class->buildLDAPMod = bervalLDAPMod;

	gdbg_class->encode = NULL;
	gdbg_class->decode = NULL;
	gdbg_class->get_data_widget = dt_clist_get_data_widget;
	gdbg_class->store_data = dt_clist_store_data;
	gdbg_class->delete_data = dt_clist_delete_data;
	gdbg_class->show_entries = dt_clist_show_entries;

	self_class->fill_clist = NULL;
	self_class->fill_details = NULL;
}
开发者ID:androdev4u,项目名称:GQ-LDAP-client,代码行数:23,代码来源:dt_clist.c

示例9: YapLog

DviDoc::DviFileStatus
DviDoc::GetDviFileStatus ()
{
  if (fileStatus == DVIFILE_LOADED)
    {
      if (! File::Exists(PathName(GetPathName())))
	{
	  fileStatus = DVIFILE_LOST;
	}
      else
	{
	  time_t timeMod = modificationTime;
	  modificationTime = File::GetLastWriteTime(PathName(GetPathName()));
	  if (timeMod != modificationTime)
	    {
	      YapLog (T_("%s has been modified"), Q_(TU_(GetPathName())));
	      modificationTime = timeMod;
	      fileStatus = DVIFILE_MODIFIED;
	    }
	}
    }
  return (fileStatus);
}
开发者ID:bngabonziza,项目名称:miktex,代码行数:23,代码来源:DviDoc.cpp

示例10: T_

bool
Directory::Exists (/*[in]*/ const PathName & path)
{
  struct stat statbuf;
  if (stat(path.Get(), &statbuf) == 0)
    {
      if (S_ISDIR(statbuf.st_mode) == 0)
	{
	  SessionImpl::theSession->trace_access->WriteFormattedLine
	    ("core",
	     T_("%s is not a directory"),
	     Q_(path));
	  return (false);
	}
      return (true);
    }
  int error = errno;
  if (error != ENOENT)
    {
      FATAL_CRT_ERROR ("stat", path.Get());
    }
  return (false);
}
开发者ID:bngabonziza,项目名称:miktex,代码行数:23,代码来源:unxFile.cpp

示例11: die

/*
 * Make sure at least "min" bytes are available in the buffer, and
 * return the pointer to the buffer.
 */
static void *fill(int min)
{
	if (min <= input_len)
		return input_buffer + input_offset;
	if (min > sizeof(input_buffer))
		die(Q_("cannot fill %d byte",
		       "cannot fill %d bytes",
		       min),
		    min);
	flush();
	do {
		ssize_t ret = xread(input_fd, input_buffer + input_len,
				sizeof(input_buffer) - input_len);
		if (ret <= 0) {
			if (!ret)
				die(_("early EOF"));
			die_errno(_("read error on input"));
		}
		input_len += ret;
		if (from_stdin)
			display_throughput(progress, consumed_bytes + input_len);
	} while (input_len < min);
	return input_buffer;
}
开发者ID:CCorreia,项目名称:git,代码行数:28,代码来源:index-pack.c

示例12: log4g_ttcc_layout_class_init

static void
log4g_ttcc_layout_class_init(Log4gTTCCLayoutClass *klass)
{
	GObjectClass *object_class = G_OBJECT_CLASS(klass);
	object_class->finalize = finalize;
	object_class->set_property = set_property;
	Log4gLayoutClass *layout_class = LOG4G_LAYOUT_CLASS(klass);
	layout_class->format = format;
	g_type_class_add_private(klass, sizeof(struct Private));
	/* install properties */
	g_object_class_install_property(object_class, PROP_THREAD_PRINTING,
		g_param_spec_boolean("thread-printing", Q_("Thread Printing"),
			Q_("Toggle thread printing"), TRUE, G_PARAM_WRITABLE));
	g_object_class_install_property(object_class, PROP_CATEGORY_PREFIXING,
		g_param_spec_boolean("category-prefixing",
			Q_("Category Prefixing"),
			Q_("Toggle category prefixing"),
			TRUE, G_PARAM_WRITABLE));
	g_object_class_install_property(object_class, PROP_CONTEXT_PRINTING,
		g_param_spec_boolean("context-printing",
			Q_("Context Printing"), Q_("Toggle context printing"),
			TRUE, G_PARAM_WRITABLE));
}
开发者ID:msteinert,项目名称:log4g,代码行数:23,代码来源:ttcc-layout.c

示例13: log4g_level_range_filter_class_init

static void
log4g_level_range_filter_class_init(Log4gLevelRangeFilterClass *klass)
{
	Log4gFilterClass *filter_class = LOG4G_FILTER_CLASS(klass);
	GObjectClass *object_class = G_OBJECT_CLASS(klass);
	object_class->dispose = dispose;
	object_class->set_property = set_property;
	filter_class->decide = decide;
	g_type_class_add_private(klass, sizeof(struct Private));
	/* install properties */
	g_object_class_install_property(object_class, PROP_LEVEL_MIN,
		g_param_spec_string("level-min", Q_("Minimum Level"),
			Q_("Minimum log level to match"), NULL,
			G_PARAM_WRITABLE));
	g_object_class_install_property(object_class, PROP_LEVEL_MAX,
		g_param_spec_string("level-max", Q_("Maximum Level"),
			Q_("Maximum log level to match"), NULL,
			G_PARAM_WRITABLE));
	g_object_class_install_property(object_class, PROP_ACCEPT_ON_RANGE,
		g_param_spec_boolean("accept-on-range", Q_("Accept on Range"),
			Q_("Accept or deny on log level range match"),
			TRUE, G_PARAM_WRITABLE));
}
开发者ID:msteinert,项目名称:log4g,代码行数:23,代码来源:level-range-filter.c

示例14: panel_place_menu_item_create_menu

static GtkWidget *
panel_place_menu_item_create_menu (PanelPlaceMenuItem *place_item)
{
	GtkWidget *places_menu;
	GtkWidget *item;
	char      *gconf_name;
	char      *name;
	char      *uri;
	GFile     *file;

	places_menu = panel_create_menu ();

	file = g_file_new_for_path (g_get_home_dir ());
	uri = g_file_get_uri (file);
	name = panel_util_get_label_for_uri (uri);
	g_object_unref (file);
	
	panel_menu_items_append_place_item (PANEL_ICON_HOME, NULL,
					    name,
					    _("Open your personal folder"),
					    places_menu,
					    G_CALLBACK (activate_home_uri),
					    uri);
	g_free (name);
	g_free (uri);

	if (!gconf_client_get_bool (panel_gconf_get_client (),
				    DESKTOP_IS_HOME_DIR_KEY,
				    NULL)) {
		file = g_file_new_for_path (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
		uri = g_file_get_uri (file);
		g_object_unref (file);
		
		panel_menu_items_append_place_item (
				PANEL_ICON_DESKTOP, NULL,
				/* Translators: Desktop is used here as in
				 * "Desktop Folder" (this is not the Desktop
				 * environment). Do not keep "Desktop Folder|"
				 * in the translation */
				Q_("Desktop Folder|Desktop"),
				_("Open the contents of your desktop in a folder"),
				places_menu,
				G_CALLBACK (activate_desktop_uri),
				/* FIXME: if the dir changes, we'd need to update the drag data since the uri is not the same */
				uri);
		g_free (uri);
	}

	panel_place_menu_item_append_gtk_bookmarks (places_menu);
	add_menu_separator (places_menu);

	gconf_name = gconf_client_get_string (panel_gconf_get_client (),
					      COMPUTER_NAME_KEY,
					      NULL);
	panel_menu_items_append_from_desktop (places_menu,
					      "nautilus-computer.desktop",
					      gconf_name);
	if (gconf_name)
		g_free (gconf_name);

	panel_menu_items_append_from_desktop (places_menu,
					      "nautilus-cd-burner.desktop",
					      NULL);

	panel_place_menu_item_append_local_gio (place_item, places_menu);
	add_menu_separator (places_menu);

	panel_menu_items_append_from_desktop (places_menu,
					      "network-scheme.desktop",
					      NULL);
	panel_place_menu_item_append_remote_gio (place_item, places_menu);

	if (panel_is_program_in_path ("nautilus-connect-server")) {
		item = panel_menu_items_create_action_item (PANEL_ACTION_CONNECT_SERVER);
		if (item != NULL)
			gtk_menu_shell_append (GTK_MENU_SHELL (places_menu),
					       item);
	}

	add_menu_separator (places_menu);

	panel_menu_items_append_from_desktop (places_menu,
					      "gnome-search-tool.desktop",
					      NULL);

	panel_recent_append_documents_menu (places_menu,
					    place_item->priv->recent_manager);

	return places_menu;
}
开发者ID:guadalinex-archive,项目名称:guadalinex-v5,代码行数:90,代码来源:panel-menu-items.c

示例15: panel_menu_items_append_lock_logout

void
panel_menu_items_append_lock_logout (GtkWidget *menu)
{
	gboolean    separator_inserted;
	GList      *children;
	GList      *last;
	GtkWidget  *item;
	const char *translate;
	char       *label;
	char       *tooltip;

	separator_inserted = FALSE;
	children = gtk_container_get_children (GTK_CONTAINER (menu));
	last = g_list_last (children);
	if (last != NULL) {
		separator_inserted = GTK_IS_SEPARATOR (GTK_WIDGET (last->data));
	}
	g_list_free (children);

	if (panel_lock_screen_action_available ("lock")) {
		item = panel_menu_items_create_action_item (PANEL_ACTION_LOCK);
		if (item != NULL) {
			if (!separator_inserted) {
				add_menu_separator (menu);
				separator_inserted = TRUE;
			}

			gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
		}
	}

	/* Translators: translate "panel:showusername|1" to anything
	 * but "1" if "Log Out %s" doesn't make any sense in your
	 * language (where %s is a username).
	 */
	translate = Q_("panel:showusername|1");
	if (strcmp (translate, "1") == 0) {
		const char *user_name;

		user_name = g_get_real_name ();
		if (!user_name || !user_name [0])
			user_name = g_get_user_name ();

		/* keep those strings in sync with the ones in
		 * panel-action-button.c */
		/* Translators: this string is used ONLY if you translated
		 * "panel:showusername|1" to "1" */
		label = g_strdup_printf (_("Log Out %s..."),
					 g_get_user_name ());
		/* Translators: this string is used ONLY if you translated
		 * "panel:showusername|1" to "1" */
		tooltip = g_strdup_printf (_("Log out %s of this session to "
					     "log in as a different user"),
					   user_name);
	} else {
		label   = NULL;
		tooltip = NULL;
	}

	item = panel_menu_items_create_action_item_full (PANEL_ACTION_LOGOUT,
							 label, tooltip);
	g_free (label);
	g_free (tooltip);

	if (item != NULL) {
		if (!separator_inserted)
			add_menu_separator (menu);

		gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
	}

	item = panel_menu_items_create_action_item (PANEL_ACTION_SHUTDOWN);
	if (item != NULL) {
		if (!separator_inserted)
			add_menu_separator (menu);

		gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
	}
}
开发者ID:guadalinex-archive,项目名称:guadalinex-v5,代码行数:79,代码来源:panel-menu-items.c


注:本文中的Q_函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。