本文整理汇总了C++中cupsArrayFind函数的典型用法代码示例。如果您正苦于以下问题:C++ cupsArrayFind函数的具体用法?C++ cupsArrayFind怎么用?C++ cupsArrayFind使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cupsArrayFind函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: cupsLocalizeDestValue
const char * /* O - Localized string */
cupsLocalizeDestValue(
http_t *http, /* I - Connection to destination */
cups_dest_t *dest, /* I - Destination */
cups_dinfo_t *dinfo, /* I - Destination information */
const char *option, /* I - Option to localize */
const char *value) /* I - Value to localize */
{
_cups_message_t key, /* Search key */
*match; /* Matching entry */
char pair[256]; /* option.value pair */
if (!http || !dest || !dinfo)
return (value);
if (!dinfo->localizations)
cups_create_localizations(http, dinfo);
if (cupsArrayCount(dinfo->localizations) == 0)
return (value);
snprintf(pair, sizeof(pair), "%s.%s", option, value);
key.id = pair;
if ((match = (_cups_message_t *)cupsArrayFind(dinfo->localizations,
&key)) != NULL)
return (match->str);
else
return (value);
}
开发者ID:thangap,项目名称:tizen-release,代码行数:30,代码来源:dest-localization.c
示例2: cupsLocalizeDestOption
const char * /* O - Localized string */
cupsLocalizeDestOption(
http_t *http, /* I - Connection to destination */
cups_dest_t *dest, /* I - Destination */
cups_dinfo_t *dinfo, /* I - Destination information */
const char *option) /* I - Option to localize */
{
_cups_message_t key, /* Search key */
*match; /* Matching entry */
if (!http || !dest || !dinfo)
return (option);
if (!dinfo->localizations)
cups_create_localizations(http, dinfo);
if (cupsArrayCount(dinfo->localizations) == 0)
return (option);
key.id = (char *)option;
if ((match = (_cups_message_t *)cupsArrayFind(dinfo->localizations,
&key)) != NULL)
return (match->str);
else
return (option);
}
开发者ID:thangap,项目名称:tizen-release,代码行数:27,代码来源:dest-localization.c
示例3: mimeType
mime_type_t * /* O - Matching file type definition */
mimeType(mime_t *mime, /* I - MIME database */
const char *super, /* I - Super-type name */
const char *type) /* I - Type name */
{
mime_type_t key, /* MIME type search key */
*mt; /* Matching type */
DEBUG_printf(("mimeType(mime=%p, super=\"%s\", type=\"%s\")", mime, super,
type));
/*
* Range check input...
*/
if (!mime || !super || !type)
{
DEBUG_puts("1mimeType: Returning NULL.");
return (NULL);
}
/*
* Lookup the type in the array...
*/
strlcpy(key.super, super, sizeof(key.super));
strlcpy(key.type, type, sizeof(key.type));
mt = (mime_type_t *)cupsArrayFind(mime->types, &key);
DEBUG_printf(("1mimeType: Returning %p.", mt));
return (mt);
}
开发者ID:thangap,项目名称:tizen-release,代码行数:33,代码来源:type.c
示例4: cupsdFinishProcess
const char * /* O - Process name */
cupsdFinishProcess(int pid, /* I - Process ID */
char *name, /* I - Name buffer */
size_t namelen, /* I - Size of name buffer */
int *job_id) /* O - Job ID pointer or NULL */
{
cupsd_proc_t key, /* Search key */
*proc; /* Matching process */
key.pid = pid;
if ((proc = (cupsd_proc_t *)cupsArrayFind(process_array, &key)) != NULL)
{
if (job_id)
*job_id = proc->job_id;
strlcpy(name, proc->name, namelen);
cupsArrayRemove(process_array, proc);
free(proc);
}
else
{
if (job_id)
*job_id = 0;
strlcpy(name, "unknown", namelen);
}
cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdFinishProcess(pid=%d, name=%p, namelen=" CUPS_LLFMT ", job_id=%p(%d)) = \"%s\"", pid, name, CUPS_LLCAST namelen, job_id, job_id ? *job_id : 0, name);
return (name);
}
开发者ID:Cacauu,项目名称:cups,代码行数:33,代码来源:process.c
示例5: serverFindPrinter
server_printer_t * /* O - Printer or NULL */
serverFindPrinter(const char *resource) /* I - Resource path */
{
server_printer_t key, /* Search key */
*match = NULL; /* Matching printer */
_cupsMutexLock(&printer_mutex);
if (cupsArrayCount(Printers) == 1 || !strcmp(resource, "/ipp/print"))
{
/*
* Just use the first printer...
*/
match = cupsArrayFirst(Printers);
if (strcmp(match->resource, resource) && strcmp(resource, "/ipp/print"))
match = NULL;
}
else
{
key.resource = (char *)resource;
match = (server_printer_t *)cupsArrayFind(Printers, &key);
}
_cupsMutexUnlock(&printer_mutex);
return (match);
}
开发者ID:istopwg,项目名称:ippsample,代码行数:27,代码来源:conf.c
示例6: helpFindNode
help_node_t * /* O - Node pointer or NULL */
helpFindNode(help_index_t *hi, /* I - Index */
const char *filename, /* I - Filename */
const char *anchor) /* I - Anchor */
{
help_node_t key; /* Search key */
DEBUG_printf(("helpFindNode(hi=%p, filename=\"%s\", anchor=\"%s\")",
hi, filename, anchor));
/*
* Range check input...
*/
if (!hi || !filename)
return (NULL);
/*
* Initialize the search key...
*/
key.filename = (char *)filename;
key.anchor = (char *)anchor;
/*
* Return any match...
*/
return ((help_node_t *)cupsArrayFind(hi->nodes, &key));
}
开发者ID:josephgbr,项目名称:cups-pt_BR,代码行数:31,代码来源:help-index.c
示例7: cupsdFindSubscription
cupsd_subscription_t * /* O - Subscription object */
cupsdFindSubscription(int id) /* I - Subscription ID */
{
cupsd_subscription_t sub; /* Subscription template */
sub.id = id;
return ((cupsd_subscription_t *)cupsArrayFind(Subscriptions, &sub));
}
开发者ID:aosm,项目名称:cups,代码行数:10,代码来源:subscriptions.c
示例8: cupsdFindPolicyOp
cupsd_location_t * /* O - Policy operation */
cupsdFindPolicyOp(cupsd_policy_t *p, /* I - Policy */
ipp_op_t op) /* I - IPP operation */
{
cupsd_location_t key, /* Search key... */
*po; /* Current policy operation */
cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdFindPolicyOp(p=%p, op=%x(%s))",
p, op, ippOpString(op));
/*
* Range check...
*/
if (!p)
return (NULL);
/*
* Check the operation against the available policies...
*/
key.op = op;
if ((po = (cupsd_location_t *)cupsArrayFind(p->ops, &key)) != NULL)
{
cupsdLogMessage(CUPSD_LOG_DEBUG2,
"cupsdFindPolicyOp: Found exact match...");
return (po);
}
key.op = IPP_ANY_OPERATION;
if ((po = (cupsd_location_t *)cupsArrayFind(p->ops, &key)) != NULL)
{
cupsdLogMessage(CUPSD_LOG_DEBUG2,
"cupsdFindPolicyOp: Found wildcard match...");
return (po);
}
cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdFindPolicyOp: No match found!");
return (NULL);
}
开发者ID:alfintatorkace,项目名称:osx-10.9-opensource,代码行数:42,代码来源:policy.c
示例9: ppdFindCustomParam
ppd_cparam_t * /* O - Custom parameter or NULL */
ppdFindCustomParam(ppd_coption_t *opt, /* I - Custom option */
const char *name) /* I - Parameter name */
{
ppd_cparam_t key; /* Custom parameter search key */
if (!opt)
return (NULL);
strlcpy(key.name, name, sizeof(key.name));
return ((ppd_cparam_t *)cupsArrayFind(opt->params, &key));
}
开发者ID:syedaunnraza,项目名称:work,代码行数:13,代码来源:custom.c
示例10: ppdFindCustomOption
ppd_coption_t * /* O - Custom option or NULL */
ppdFindCustomOption(ppd_file_t *ppd, /* I - PPD file */
const char *keyword)/* I - Custom option name */
{
ppd_coption_t key; /* Custom option search key */
if (!ppd)
return (NULL);
strlcpy(key.keyword, keyword, sizeof(key.keyword));
return ((ppd_coption_t *)cupsArrayFind(ppd->coptions, &key));
}
开发者ID:thangap,项目名称:tizen-release,代码行数:13,代码来源:custom.c
示例11: help_add_word
static help_word_t * /* O - New word */
help_add_word(help_node_t *n, /* I - Node */
const char *text) /* I - Word text */
{
help_word_t *w, /* New word */
key; /* Search key */
DEBUG_printf(("2help_add_word(n=%p, text=\"%s\")", n, text));
/*
* Create the words array as needed...
*/
if (!n->words)
n->words = cupsArrayNew((cups_array_func_t)help_sort_words, NULL);
/*
* See if the word is already added...
*/
key.text = (char *)text;
if ((w = (help_word_t *)cupsArrayFind(n->words, &key)) == NULL)
{
/*
* Create a new word...
*/
if ((w = calloc(1, sizeof(help_word_t))) == NULL)
return (NULL);
if ((w->text = strdup(text)) == NULL)
{
free(w);
return (NULL);
}
cupsArrayAdd(n->words, w);
}
/*
* Bump the counter for this word and return it...
*/
w->count ++;
return (w);
}
开发者ID:josephgbr,项目名称:cups-pt_BR,代码行数:49,代码来源:help-index.c
示例12: ppdFindAttr
ppd_attr_t * /* O - Attribute or @code [email protected] if not found */
ppdFindAttr(ppd_file_t *ppd, /* I - PPD file data */
const char *name, /* I - Attribute name */
const char *spec) /* I - Specifier string or @code [email protected] */
{
ppd_attr_t key, /* Search key */
*attr; /* Current attribute */
DEBUG_printf(("2ppdFindAttr(ppd=%p, name=\"%s\", spec=\"%s\")", ppd, name,
spec));
/*
* Range check input...
*/
if (!ppd || !name || ppd->num_attrs == 0)
return (NULL);
/*
* Search for a matching attribute...
*/
memset(&key, 0, sizeof(key));
strlcpy(key.name, name, sizeof(key.name));
/*
* Return the first matching attribute, if any...
*/
if ((attr = (ppd_attr_t *)cupsArrayFind(ppd->sorted_attrs, &key)) != NULL)
{
if (spec)
{
/*
* Loop until we find the first matching attribute for "spec"...
*/
while (attr && _cups_strcasecmp(spec, attr->spec))
{
if ((attr = (ppd_attr_t *)cupsArrayNext(ppd->sorted_attrs)) != NULL &&
_cups_strcasecmp(attr->name, name))
attr = NULL;
}
}
}
return (attr);
}
开发者ID:ezeep,项目名称:cups,代码行数:49,代码来源:attr.c
示例13: ppdFindOption
ppd_option_t * /* O - Pointer to option or @code [email protected] */
ppdFindOption(ppd_file_t *ppd, /* I - PPD file data */
const char *option) /* I - Option/Keyword name */
{
/*
* Range check input...
*/
if (!ppd || !option)
return (NULL);
if (ppd->options)
{
/*
* Search in the array...
*/
ppd_option_t key; /* Option search key */
strlcpy(key.keyword, option, sizeof(key.keyword));
return ((ppd_option_t *)cupsArrayFind(ppd->options, &key));
}
else
{
/*
* Search in each group...
*/
int i, j; /* Looping vars */
ppd_group_t *group; /* Current group */
ppd_option_t *optptr; /* Current option */
for (i = ppd->num_groups, group = ppd->groups; i > 0; i --, group ++)
for (j = group->num_options, optptr = group->options;
j > 0;
j --, optptr ++)
if (!_cups_strcasecmp(optptr->keyword, option))
return (optptr);
return (NULL);
}
}
开发者ID:AnotherView,项目名称:cups,代码行数:45,代码来源:mark.c
示例14: serverFindJob
server_job_t * /* O - Job or NULL */
serverFindJob(
server_client_t *client, /* I - Client */
int job_id) /* I - Job ID to find or 0 to lookup */
{
ipp_attribute_t *attr; /* job-id or job-uri attribute */
server_job_t key, /* Job search key */
*job; /* Matching job, if any */
if (job_id > 0)
{
key.id = job_id;
}
else if ((attr = ippFindAttribute(client->request, "job-uri", IPP_TAG_URI)) != NULL)
{
const char *uri = ippGetString(attr, 0, NULL);
/* job-uri value */
char scheme[32], /* URI scheme */
userpass[256], /* username:password */
host[256], /* Hostname/IP */
resource[1024]; /* Resource path */
int port; /* Port number */
if (httpSeparateURI(HTTP_URI_CODING_ALL, uri, scheme, sizeof(scheme), userpass, sizeof(userpass), host, sizeof(host), &port, resource, sizeof(resource)) >= HTTP_URI_STATUS_OK &&
!strncmp(resource, client->printer->resource, client->printer->resourcelen) &&
resource[client->printer->resourcelen] == '/')
key.id = atoi(resource + client->printer->resourcelen + 1);
else
return (NULL);
}
else if ((attr = ippFindAttribute(client->request, "job-id", IPP_TAG_INTEGER)) != NULL)
{
key.id = ippGetInteger(attr, 0);
}
_cupsRWLockRead(&(client->printer->rwlock));
job = (server_job_t *)cupsArrayFind(client->printer->jobs, &key);
_cupsRWUnlock(&(client->printer->rwlock));
return (job);
}
开发者ID:istopwg,项目名称:ippsample,代码行数:42,代码来源:job.c
示例15: _pwgMediaForLegacy
_pwg_media_t * /* O - Matching size or NULL */
_pwgMediaForLegacy(
const char *legacy) /* I - Legacy size name */
{
_pwg_media_t key; /* Search key */
_cups_globals_t *cg = _cupsGlobals(); /* Global data */
/*
* Range check input...
*/
if (!legacy)
return (NULL);
/*
* Build the lookup table for PWG names as needed...
*/
if (!cg->leg_size_lut)
{
int i; /* Looping var */
_pwg_media_t *size; /* Current size */
cg->leg_size_lut = cupsArrayNew((cups_array_func_t)pwg_compare_legacy,
NULL);
for (i = (int)(sizeof(cups_pwg_media) / sizeof(cups_pwg_media[0])),
size = (_pwg_media_t *)cups_pwg_media;
i > 0;
i --, size ++)
if (size->legacy)
cupsArrayAdd(cg->leg_size_lut, size);
}
/*
* Lookup the name...
*/
key.legacy = legacy;
return ((_pwg_media_t *)cupsArrayFind(cg->leg_size_lut, &key));
}
开发者ID:MasterPlexus,项目名称:vendor_goldenve,代码行数:42,代码来源:pwg-media.c
示例16: ppdIsMarked
int /* O - Non-zero if option is marked */
ppdIsMarked(ppd_file_t *ppd, /* I - PPD file data */
const char *option, /* I - Option/Keyword name */
const char *choice) /* I - Choice name */
{
ppd_choice_t key, /* Search key */
*c; /* Choice pointer */
if (!ppd)
return (0);
if ((key.option = ppdFindOption(ppd, option)) == NULL)
return (0);
if ((c = (ppd_choice_t *)cupsArrayFind(ppd->marked, &key)) == NULL)
return (0);
return (!strcmp(c->choice, choice));
}
开发者ID:AnotherView,项目名称:cups,代码行数:20,代码来源:mark.c
示例17: mimeDeleteType
void
mimeDeleteType(mime_t *mime, /* I - MIME database */
mime_type_t *mt) /* I - Type */
{
DEBUG_printf(("mimeDeleteType(mime=%p, mt=%p(%s/%s))", mime, mt,
mt ? mt->super : "???", mt ? mt->type : "???"));
if (!mime || !mt)
return;
#ifdef DEBUG
if (!cupsArrayFind(mime->types, mt))
DEBUG_puts("1mimeDeleteFilter: Type not in MIME database.");
#endif /* DEBUG */
cupsArrayRemove(mime->types, mt);
mime_delete_rules(mt->rules);
free(mt);
}
开发者ID:alfintatorkace,项目名称:osx-10.9-opensource,代码行数:20,代码来源:mime.c
示例18: cupsdFindPolicy
cupsd_policy_t * /* O - Policy */
cupsdFindPolicy(const char *policy) /* I - Name of policy */
{
cupsd_policy_t key; /* Search key */
/*
* Range check...
*/
if (!policy)
return (NULL);
/*
* Look it up...
*/
key.name = (char *)policy;
return ((cupsd_policy_t *)cupsArrayFind(Policies, &key));
}
开发者ID:alfintatorkace,项目名称:osx-10.9-opensource,代码行数:20,代码来源:policy.c
示例19: mimeFilterLookup
mime_filter_t * /* O - Filter for src->dst */
mimeFilterLookup(mime_t *mime, /* I - MIME database */
mime_type_t *src, /* I - Source type */
mime_type_t *dst) /* I - Destination type */
{
mime_filter_t key, /* Key record for filter search */
*filter; /* Matching filter */
DEBUG_printf(("2mimeFilterLookup(mime=%p, src=%p(%s/%s), dst=%p(%s/%s))", mime,
src, src ? src->super : "???", src ? src->type : "???",
dst, dst ? dst->super : "???", dst ? dst->type : "???"));
key.src = src;
key.dst = dst;
filter = (mime_filter_t *)cupsArrayFind(mime->filters, &key);
DEBUG_printf(("3mimeFilterLookup: Returning %p(%s).", filter,
filter ? filter->filter : "???"));
return (filter);
}
开发者ID:alfintatorkace,项目名称:osx-10.9-opensource,代码行数:21,代码来源:filter.c
示例20: cupsdNetIFFind
cupsd_netif_t * /* O - Network interface data */
cupsdNetIFFind(const char *name) /* I - Name of interface */
{
cupsd_netif_t key; /* Search key */
/*
* Update the interface list as needed...
*/
if (NetIFUpdate)
cupsdNetIFUpdate();
/*
* Search for the named interface...
*/
strlcpy(key.name, name, sizeof(key.name));
return ((cupsd_netif_t *)cupsArrayFind(NetIFList, &key));
}
开发者ID:josephgbr,项目名称:cups-pt_BR,代码行数:21,代码来源:network.c
注:本文中的cupsArrayFind函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论