本文整理汇总了C++中UChar函数的典型用法代码示例。如果您正苦于以下问题:C++ UChar函数的具体用法?C++ UChar怎么用?C++ UChar使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了UChar函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: defined
Vector<String> PluginDatabase::defaultPluginDirectories()
{
Vector<String> paths;
// Add paths specific to each platform
#if defined(XP_UNIX)
String userPluginPath = homeDirectoryPath();
userPluginPath.append(String("/.mozilla/plugins"));
paths.append(userPluginPath);
userPluginPath = homeDirectoryPath();
userPluginPath.append(String("/.netscape/plugins"));
paths.append(userPluginPath);
paths.append("/usr/lib/browser/plugins");
paths.append("/usr/local/lib/mozilla/plugins");
paths.append("/usr/lib/firefox/plugins");
paths.append("/usr/lib64/browser-plugins");
paths.append("/usr/lib/browser-plugins");
paths.append("/usr/lib/mozilla/plugins");
paths.append("/usr/local/netscape/plugins");
paths.append("/opt/mozilla/plugins");
paths.append("/opt/mozilla/lib/plugins");
paths.append("/opt/netscape/plugins");
paths.append("/opt/netscape/communicator/plugins");
paths.append("/usr/lib/netscape/plugins");
paths.append("/usr/lib/netscape/plugins-libc5");
paths.append("/usr/lib/netscape/plugins-libc6");
paths.append("/usr/lib64/netscape/plugins");
paths.append("/usr/lib64/mozilla/plugins");
String mozHome(getenv("MOZILLA_HOME"));
mozHome.append("/plugins");
paths.append(mozHome);
Vector<String> mozPaths;
String mozPath(getenv("MOZ_PLUGIN_PATH"));
mozPath.split(UChar(':'), /* allowEmptyEntries */ false, mozPaths);
paths.append(mozPaths);
#elif defined(XP_MACOSX)
String userPluginPath = homeDirectoryPath();
userPluginPath.append(String("/Library/Internet Plug-Ins"));
paths.append(userPluginPath);
paths.append("/Library/Internet Plug-Ins");
#elif defined(XP_WIN)
String userPluginPath = homeDirectoryPath();
userPluginPath.append(String("\\Application Data\\Mozilla\\plugins"));
paths.append(userPluginPath);
#endif
// Add paths specific to each port
#if PLATFORM(QT)
Vector<String> qtPaths;
String qtPath(getenv("QTWEBKIT_PLUGIN_PATH"));
qtPath.split(UChar(':'), /* allowEmptyEntries */ false, qtPaths);
paths.append(qtPaths);
#endif
return paths;
}
示例2: _nc_msec_cost
_nc_msec_cost(const char *const cap, int affcnt)
/* compute the cost of a given operation */
{
if (cap == 0)
return (INFINITY);
else {
const char *cp;
float cum_cost = 0.0;
for (cp = cap; *cp; cp++) {
/* extract padding, either mandatory or required */
if (cp[0] == '$' && cp[1] == '<' && strchr(cp, '>')) {
float number = 0.0;
for (cp += 2; *cp != '>'; cp++) {
if (isdigit(UChar(*cp)))
number = number * 10 + (*cp - '0');
else if (*cp == '*')
number *= affcnt;
else if (*cp == '.' && (*++cp != '>') && isdigit(UChar(*cp)))
number += (*cp - '0') / 10.0;
}
#if NCURSES_NO_PADDING
if (!(SP->_no_padding))
#endif
cum_cost += number * 10;
} else
cum_cost += SP->_char_padding;
}
return ((int) cum_cost);
}
}
示例3: bcd_expression
/*
* Check for an expression that corresponds to "%B" (BCD):
* (parameter / 10) * 16 + (parameter % 10)
*/
static int
bcd_expression(const char *str)
{
/* leave this non-const for HPUX */
static char fmt[] = "%%p%c%%{10}%%/%%{16}%%*%%p%c%%{10}%%m%%+";
int len = 0;
char ch1, ch2;
if (sscanf(str, fmt, &ch1, &ch2) == 2
&& isdigit(UChar(ch1))
&& isdigit(UChar(ch2))
&& (ch1 == ch2)) {
len = 28;
#ifndef NDEBUG
{
char buffer[80];
int tst;
_nc_SPRINTF(buffer, _nc_SLIMIT(sizeof(buffer)) fmt, ch1, ch2);
tst = strlen(buffer) - 1;
assert(len == tst);
}
#endif
}
return len;
}
示例4: Is_Sub_String
/*---------------------------------------------------------------------------
| Facility : libnmenu
| Function : static bool Is_Sub_String(
| bool IgnoreCaseFlag,
| const char *part,
| const char *string)
|
| Description : Checks whether or not part is a substring of string.
|
| Return Values : TRUE - if it is a substring
| FALSE - if it is not a substring
+--------------------------------------------------------------------------*/
static bool
Is_Sub_String(
bool IgnoreCaseFlag,
const char *part,
const char *string
)
{
assert(part && string);
if (IgnoreCaseFlag)
{
while (*string && *part)
{
if (toupper(UChar(*string++)) != toupper(UChar(*part)))
break;
part++;
}
}
else
{
while (*string && *part)
if (*part != *string++)
break;
part++;
}
return ((*part) ? FALSE : TRUE);
}
示例5: report
static void
report(const char *name, int which, unsigned def)
{
unsigned older, newer;
char *p;
newer = mode.c_cc[which];
older = oldmode.c_cc[which];
if (older == newer && older == def)
return;
(void) fprintf(stderr, "%s %s ", name, older == newer ? "is" : "set to");
if (DISABLED(newer))
(void) fprintf(stderr, "undef.\n");
/*
* Check 'delete' before 'backspace', since the key_backspace value
* is ambiguous.
*/
else if (newer == 0177)
(void) fprintf(stderr, "delete.\n");
else if ((p = key_backspace) != 0
&& newer == (unsigned char) p[0]
&& p[1] == '\0')
(void) fprintf(stderr, "backspace.\n");
else if (newer < 040) {
newer ^= 0100;
(void) fprintf(stderr, "control-%c (^%c).\n", UChar(newer), UChar(newer));
} else
(void) fprintf(stderr, "%c.\n", UChar(newer));
}
示例6: ASSERT_ARG
void NetscapePluginModule::parseMIMEDescription(const String& mimeDescription, Vector<MimeClassInfo>& result)
{
ASSERT_ARG(result, result.isEmpty());
Vector<String> types;
mimeDescription.lower().split(UChar(';'), false, types);
result.reserveInitialCapacity(types.size());
size_t mimeInfoCount = 0;
for (size_t i = 0; i < types.size(); ++i) {
Vector<String> mimeTypeParts;
types[i].split(UChar(':'), true, mimeTypeParts);
if (mimeTypeParts.size() <= 0)
continue;
result.uncheckedAppend(MimeClassInfo());
MimeClassInfo& mimeInfo = result[mimeInfoCount++];
mimeInfo.type = mimeTypeParts[0];
if (mimeTypeParts.size() > 1)
mimeTypeParts[1].split(UChar(','), false, mimeInfo.extensions);
if (mimeTypeParts.size() > 2)
mimeInfo.desc = mimeTypeParts[2];
}
}
示例7: waddnstr
waddnstr(WINDOW *win, const char *astr, int n)
{
const char *str = astr;
int code = ERR;
T((T_CALLED("waddnstr(%p,%s,%d)"), win, _nc_visbufn(astr, n), n));
if (win && (str != 0)) {
TR(TRACE_VIRTPUT | TRACE_ATTRS, ("... current %s", _traceattr(win->_attrs)));
code = OK;
if (n < 0)
n = (int) strlen(astr);
TR(TRACE_VIRTPUT, ("str is not null, length = %d", n));
while ((n-- > 0) && (*str != '\0')) {
NCURSES_CH_T ch;
TR(TRACE_VIRTPUT, ("*str = %#o", UChar(*str)));
SetChar(ch, UChar(*str++), A_NORMAL);
if (_nc_waddch_nosync(win, ch) == ERR) {
code = ERR;
break;
}
}
_nc_synchook(win);
}
TR(TRACE_VIRTPUT, ("waddnstr returns %d", code));
returnCode(code);
}
示例8: determineModuleVersionFromDescription
bool PluginPackage::fetchInfo()
{
if (!load())
return false;
char* buf = 0;
NPError err = m_pluginFuncs.getvalue(0, NPPVpluginNameString, (void *)&buf);
m_name = buf;
err = m_pluginFuncs.getvalue(0, NPPVpluginDescriptionString, (void *)&buf);
m_description = buf;
determineModuleVersionFromDescription();
String s = m_npInterface->NP_GetMIMEDescription();
Vector<String> types;
s.split(UChar('|'), false, types); // <MIME1>;<ext1,ext2,ext3,...>;<Description>|<MIME2>|<MIME3>|...
for (int i = 0; i < types.size(); ++i) {
Vector<String> mime;
types[i].split(UChar(';'), true, mime); // <MIME1>;<ext1,ext2,ext3,...>;<Description>
if (mime.size() > 0) {
Vector<String> exts;
if (mime.size() > 1)
mime[1].split(UChar(','), false, exts); // <ext1,ext2,ext3,...>
m_mimeToExtensions.add(mime[0], exts); // <MIME>,<ext1,ext2,ext3>
if (mime.size() > 2)
m_mimeToDescriptions.add(mime[0], mime[2]); // <MIME>,<Description>
}
}
unload();
return true;
}
示例9: wadd_wch
wadd_wch(WINDOW *win, const cchar_t *wch)
{
PUTC_DATA;
int n;
int code = ERR;
TR(TRACE_VIRTPUT | TRACE_CCALLS, (T_CALLED("wadd_wch(%p, %s)"), win,
_tracech_t(wch)));
if (win != 0) {
PUTC_INIT;
for (PUTC_i = 0; PUTC_i < CCHARW_MAX; ++PUTC_i) {
attr_t attrs = (wch->attr & A_ATTRIBUTES);
if ((PUTC_ch = wch->chars[PUTC_i]) == L'\0')
break;
if ((PUTC_n = wcrtomb(PUTC_buf, PUTC_ch, &PUT_st)) <= 0) {
code = ERR;
if (is8bits(PUTC_ch))
code = waddch(win, UChar(PUTC_ch) | attrs);
break;
}
for (n = 0; n < PUTC_n; n++) {
if ((code = waddch(win, UChar(PUTC_buf[n]) | attrs)) == ERR) {
break;
}
}
if (code == ERR)
break;
}
}
TR(TRACE_VIRTPUT | TRACE_CCALLS, (T_RETURN("%d"), code));
return (code);
}
示例10: _nc_vischar
static char *
_nc_vischar(char *tp, unsigned c)
{
if (c == '"' || c == '\\') {
*tp++ = '\\';
*tp++ = (char) c;
} else if (is7bits(c) && (isgraph(c) || c == ' ')) {
*tp++ = (char) c;
} else if (c == '\n') {
*tp++ = '\\';
*tp++ = 'n';
} else if (c == '\r') {
*tp++ = '\\';
*tp++ = 'r';
} else if (c == '\b') {
*tp++ = '\\';
*tp++ = 'b';
} else if (c == '\033') {
*tp++ = '\\';
*tp++ = 'e';
} else if (UChar(c) == 0x7f) {
*tp++ = '\\';
*tp++ = '^';
*tp++ = '?';
} else if (is7bits(c) && iscntrl(UChar(c))) {
*tp++ = '\\';
*tp++ = '^';
*tp++ = (char) ('@' + c);
} else {
sprintf(tp, "\\%03lo", (unsigned long) ChCharOf(c));
tp += strlen(tp);
}
*tp = 0;
return tp;
}
示例11: trim_suffix
static void
trim_suffix(const char *a, size_t *len)
{
const char ignore[] = SUFFIX_IGNORED;
if (sizeof(ignore) != 0) {
bool trim = FALSE;
size_t need = (sizeof(ignore) - 1);
if (*len > need) {
size_t first = *len - need;
size_t n;
trim = TRUE;
for (n = first; n < *len; ++n) {
if (tolower(UChar(a[n])) != tolower(UChar(ignore[n - first]))) {
trim = FALSE;
break;
}
}
if (trim) {
*len -= need;
}
}
}
}
示例12: ChStr
static chtype *
ChStr(const char *source)
{
if (source != 0) {
size_t need = ChLen(source) + 1;
int n = 0;
if (need > temp_length) {
temp_length = need * 2;
temp_buffer = typeRealloc(chtype, temp_length, temp_buffer);
}
do {
const char *s;
chtype ch = UChar(*source++);
if (!pass_ctls && (s = unctrl(ch)) != 0) {
while (*s != '\0') {
temp_buffer[n++] = UChar(*s++);
}
} else {
temp_buffer[n++] = ch;
}
} while (source[0] != 0);
temp_buffer[n] = 0;
} else if (temp_buffer != 0) {
free(temp_buffer);
temp_buffer = 0;
temp_length = 0;
}
return temp_buffer;
}
示例13: wecho_wchar
wecho_wchar(WINDOW *win, const cchar_t * wch)
{
PUTC_DATA;
int n;
int code = ERR;
TR(TRACE_VIRTPUT | TRACE_CCALLS, (T_CALLED("wecho_wchar(%p, %s)"), win,
_tracech_t(wch)));
if (win != 0) {
PUTC_INIT;
while (PUTC_i < CCHARW_MAX) {
if ((PUTC_ch = wch->chars[PUTC_i++]) == L'\0')
break;
if ((PUTC_n = wcrtomb(PUTC_buf, PUTC_ch, &PUT_st)) <= 0) {
code = ERR;
if (is8bits(PUTC_ch))
code = waddch(win, UChar(PUTC_ch) | wch->attr);
break;
}
for (n = 0; n < PUTC_n; n++) {
if ((code = waddch(win, UChar(PUTC_buf[n]) | wch->attr)) == ERR) {
break;
}
}
if (code == ERR)
break;
}
wrefresh(win);
}
TR(TRACE_VIRTPUT | TRACE_CCALLS, (T_RETURN("%d"), code));
return (code);
}
示例14: _tracecchar_t2
_tracecchar_t2(int bufnum, const cchar_t *ch)
{
char *result = _nc_trace_buf(bufnum, BUFSIZ);
attr_t attr;
const char *found;
if (result != 0) {
strcpy(result, l_brace);
if (ch != 0) {
attr = AttrOfD(ch);
if ((found = _nc_altcharset_name(attr, (chtype) CharOfD(ch))) != 0) {
(void) _nc_trace_bufcat(bufnum, found);
attr &= ~A_ALTCHARSET;
} else if (isWidecExt(CHDEREF(ch))) {
(void) _nc_trace_bufcat(bufnum, "{NAC}");
attr &= ~A_CHARTEXT;
} else {
PUTC_DATA;
int n;
PUTC_INIT;
(void) _nc_trace_bufcat(bufnum, "{ ");
for (PUTC_i = 0; PUTC_i < CCHARW_MAX; ++PUTC_i) {
PUTC_ch = ch->chars[PUTC_i];
if (PUTC_ch == L'\0') {
if (PUTC_i == 0)
result = _nc_trace_bufcat(bufnum, "\\000");
break;
}
PUTC_n = wcrtomb(PUTC_buf, ch->chars[PUTC_i], &PUT_st);
if (PUTC_n <= 0) {
if (PUTC_ch != L'\0') {
/* it could not be a multibyte sequence */
(void) _nc_trace_bufcat(bufnum,
_nc_tracechar(CURRENT_SCREEN,
UChar(ch->chars[PUTC_i])));
}
break;
}
for (n = 0; n < PUTC_n; n++) {
if (n)
(void) _nc_trace_bufcat(bufnum, ", ");
(void) _nc_trace_bufcat(bufnum,
_nc_tracechar(CURRENT_SCREEN,
UChar(PUTC_buf[n])));
}
}
(void) _nc_trace_bufcat(bufnum, " }");
}
if (attr != A_NORMAL) {
(void) _nc_trace_bufcat(bufnum, " | ");
(void) _nc_trace_bufcat(bufnum, _traceattr2(bufnum + 20, attr));
}
}
result = _nc_trace_bufcat(bufnum, r_brace);
}
return result;
}
示例15: decode_attr
static char *
decode_attr(char *source, attr_t *target, int *color)
{
bool found = FALSE;
T(("decode_attr '%s'", source));
while (*source) {
if (source[0] == MARKER && source[1] == L_CURL) {
source += 2;
found = TRUE;
} else if (source[0] == R_CURL) {
source++;
found = FALSE;
} else if (found) {
size_t n;
char *next = source;
if (source[0] == GUTTER) {
++next;
} else if (*next == 'C') {
int value = 0;
unsigned pair;
next++;
while (isdigit(UChar(*next))) {
value = value * 10 + (*next++ - '0');
}
*target &= ~A_COLOR;
pair = (unsigned) ((value > 256)
? COLOR_PAIR(255)
: COLOR_PAIR(value));
*target |= pair;
*color = value;
} else {
while (isalnum(UChar(*next))) {
++next;
}
for (n = 0; n < SIZEOF(scr_attrs); ++n) {
if ((size_t) (next - source) == strlen(scr_attrs[n].name)) {
if (scr_attrs[n].attr) {
*target |= scr_attrs[n].attr;
} else {
*target = A_NORMAL;
}
break;
}
}
}
source = next;
} else {
break;
}
}
return source;
}