本文整理汇总了C++中wcstring_list_t类的典型用法代码示例。如果您正苦于以下问题:C++ wcstring_list_t类的具体用法?C++ wcstring_list_t怎么用?C++ wcstring_list_t使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了wcstring_list_t类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: builtin_complete_remove2
/**
Silly function
*/
static void builtin_complete_remove2(const wchar_t *cmd,
int cmd_type,
const wchar_t *short_opt,
const wcstring_list_t &gnu_opt,
const wcstring_list_t &old_opt)
{
const wchar_t *s = (wchar_t *)short_opt;
if (*s)
{
for (; *s; s++)
{
if (old_opt.empty() && gnu_opt.empty())
{
complete_remove(cmd,
cmd_type,
*s,
0,
0);
}
else
{
builtin_complete_remove3(cmd,
cmd_type,
*s,
gnu_opt,
0);
builtin_complete_remove3(cmd,
cmd_type,
*s,
old_opt,
1);
}
}
}
else if (gnu_opt.empty() && old_opt.empty())
{
complete_remove(cmd,
cmd_type,
0,
0,
0);
}
else
{
builtin_complete_remove3(cmd,
cmd_type,
0,
gnu_opt,
0);
builtin_complete_remove3(cmd,
cmd_type,
0,
old_opt,
1);
}
}
开发者ID:FUNK88,项目名称:fish-shell,代码行数:63,代码来源:builtin_complete.cpp
示例2: builtin_complete_remove
/**
Silly function
*/
static void builtin_complete_remove(const wcstring_list_t &cmd,
const wcstring_list_t &path,
const wchar_t *short_opt,
const wcstring_list_t &gnu_opt,
const wcstring_list_t &old_opt)
{
for (size_t i=0; i<cmd.size(); i++)
{
builtin_complete_remove2(cmd.at(i).c_str(),
COMMAND,
short_opt,
gnu_opt,
old_opt);
}
for (size_t i=0; i<path.size(); i++)
{
builtin_complete_remove2(path.at(i).c_str(),
PATH,
short_opt,
gnu_opt,
old_opt);
}
}
开发者ID:ThomasRooney,项目名称:fish-shell,代码行数:28,代码来源:builtin_complete.cpp
示例3: set_var_array
/// This handles the common case of setting the entire var to a set of values.
static int set_var_array(const wchar_t *cmd, set_cmd_opts_t &opts, const wchar_t *varname,
wcstring_list_t &new_values, int argc, wchar_t **argv, parser_t &parser,
io_streams_t &streams) {
UNUSED(cmd);
UNUSED(parser);
UNUSED(streams);
if (opts.prepend || opts.append) {
if (opts.prepend) {
for (int i = 0; i < argc; i++) new_values.push_back(argv[i]);
}
auto var_str = parser.vars().get(varname, ENV_DEFAULT);
wcstring_list_t var_array;
if (var_str) var_str->to_list(var_array);
new_values.insert(new_values.end(), var_array.begin(), var_array.end());
if (opts.append) {
for (int i = 0; i < argc; i++) new_values.push_back(argv[i]);
}
} else {
for (int i = 0; i < argc; i++) new_values.push_back(argv[i]);
}
return STATUS_CMD_OK;
}
开发者ID:kballard,项目名称:fish-shell,代码行数:26,代码来源:builtin_set.cpp
示例4: builtin_complete_remove_cmd
static void builtin_complete_remove_cmd(const wcstring &cmd,
int cmd_type,
const wchar_t *short_opt,
const wcstring_list_t &gnu_opt,
const wcstring_list_t &old_opt)
{
bool removed = false;
size_t i;
for (i=0; short_opt[i] != L'\0'; i++)
{
complete_remove(cmd, cmd_type, wcstring(1, short_opt[i]), option_type_short);
removed = true;
}
for (i=0; i < old_opt.size(); i++)
{
complete_remove(cmd, cmd_type, old_opt.at(i), option_type_single_long);
removed = true;
}
for (i=0; i < gnu_opt.size(); i++)
{
complete_remove(cmd, cmd_type, gnu_opt.at(i), option_type_double_long);
removed = true;
}
if (! removed)
{
// This means that all loops were empty
complete_remove_all(cmd, cmd_type);
}
}
开发者ID:anastiel,项目名称:fish-shell,代码行数:32,代码来源:builtin_complete.cpp
示例5: env_get_names
wcstring_list_t env_get_names(int flags)
{
scoped_lock lock(env_lock);
wcstring_list_t result;
std::set<wcstring> names;
int show_local = flags & ENV_LOCAL;
int show_global = flags & ENV_GLOBAL;
int show_universal = flags & ENV_UNIVERSAL;
env_node_t *n=top;
const bool show_exported = (flags & ENV_EXPORT) || !(flags & ENV_UNEXPORT);
const bool show_unexported = (flags & ENV_UNEXPORT) || !(flags & ENV_EXPORT);
if (!show_local && !show_global && !show_universal)
{
show_local =show_universal = show_global=1;
}
if (show_local)
{
while (n)
{
if (n == global_env)
break;
add_key_to_string_set(n->env, &names, show_exported, show_unexported);
if (n->new_scope)
break;
else
n = n->next;
}
}
if (show_global)
{
add_key_to_string_set(global_env->env, &names, show_exported, show_unexported);
if (show_unexported)
{
result.insert(result.end(), env_electric.begin(), env_electric.end());
}
if (show_exported)
{
result.push_back(L"COLUMNS");
result.push_back(L"LINES");
}
}
if (show_universal && uvars())
{
const wcstring_list_t uni_list = uvars()->get_names(show_exported, show_unexported);
names.insert(uni_list.begin(), uni_list.end());
}
result.insert(result.end(), names.begin(), names.end());
return result;
}
开发者ID:Aulos,项目名称:fish-shell,代码行数:60,代码来源:env.cpp
示例6: function_prepare_environment
void function_prepare_environment(const wcstring &name, const wchar_t *const *argv,
const std::map<wcstring, env_var_t> &inherited_vars) {
// Three components of the environment:
// 1. argv
// 2. named arguments
// 3. inherited variables
env_set_argv(argv);
const wcstring_list_t named_arguments = function_get_named_arguments(name);
if (!named_arguments.empty()) {
const wchar_t *const *arg;
size_t i;
for (i = 0, arg = argv; i < named_arguments.size(); i++) {
env_set(named_arguments.at(i).c_str(), *arg, ENV_LOCAL | ENV_USER);
if (*arg) arg++;
}
}
for (std::map<wcstring, env_var_t>::const_iterator it = inherited_vars.begin(),
end = inherited_vars.end();
it != end; ++it) {
env_set(it->first, it->second.missing() ? NULL : it->second.c_str(), ENV_LOCAL | ENV_USER);
}
}
开发者ID:Mabinogiysk,项目名称:fish-shell,代码行数:25,代码来源:function.cpp
示例7: snapshot_vars
static std::map<wcstring, env_var_t> snapshot_vars(const wcstring_list_t &vars) {
std::map<wcstring, env_var_t> result;
for (wcstring_list_t::const_iterator it = vars.begin(), end = vars.end(); it != end; ++it) {
result.insert(std::make_pair(*it, env_get_string(*it)));
}
return result;
}
开发者ID:Mabinogiysk,项目名称:fish-shell,代码行数:7,代码来源:function.cpp
示例8: update_values
static int update_values( wcstring_list_t &list,
std::vector<long> &indexes,
wcstring_list_t &values )
{
size_t i;
/* Replace values where needed */
for( i = 0; i < indexes.size(); i++ )
{
/*
The '- 1' below is because the indices in fish are
one-based, but the vector uses zero-based indices
*/
long ind = indexes[i] - 1;
const wcstring newv = values[ i ];
if( ind < 0 )
{
return 1;
}
if ( ind >= list.size() )
{
list.resize( ind+1 );
}
// free((void *) al_get(list, ind));
list[ ind ] = newv;
}
return 0;
}
开发者ID:asheidan,项目名称:fish-shell,代码行数:30,代码来源:builtin_set.cpp
示例9: print_colors
static void print_colors(io_streams_t &streams) {
const wcstring_list_t result = rgb_color_t::named_color_names();
size_t i;
for (i = 0; i < result.size(); i++) {
streams.out.append(result.at(i));
streams.out.push_back(L'\n');
}
}
开发者ID:0xicl33n,项目名称:fish-shell,代码行数:8,代码来源:builtin_set_color.cpp
示例10: input_terminfo_get_names
/// Print terminfo key binding names to string buffer used for standard output.
///
/// \param all if set, all terminfo key binding names will be printed. If not set, only ones that
/// are defined for this terminal are printed.
void builtin_bind_t::key_names(bool all, io_streams_t &streams) {
const wcstring_list_t names = input_terminfo_get_names(!all);
for (size_t i = 0; i < names.size(); i++) {
const wcstring &name = names.at(i);
streams.out.append_format(L"%ls\n", name.c_str());
}
}
开发者ID:fish-shell,项目名称:fish-shell,代码行数:12,代码来源:builtin_bind.cpp
示例11: print_colors
static void print_colors(void)
{
const wcstring_list_t result = rgb_color_t::named_color_names();
size_t i;
for (i=0; i < result.size(); i++)
{
stdout_buffer.append(result.at(i));
stdout_buffer.push_back(L'\n');
}
}
开发者ID:Ju2ender,项目名称:fish-shell,代码行数:10,代码来源:builtin_set_color.cpp
示例12: run_test_test
static bool run_test_test(int expected, wcstring_list_t &lst) {
parser_t parser(PARSER_TYPE_GENERAL, true);
size_t i, count = lst.size();
wchar_t **argv = new wchar_t *[count+2];
argv[0] = (wchar_t *)L"test";
for (i=0; i < count; i++) {
argv[i+1] = (wchar_t *)lst.at(i).c_str();
}
argv[i+1] = NULL;
int result = builtin_test(parser, argv);
delete[] argv;
return expected == result;
}
开发者ID:Soares,项目名称:fish-shell,代码行数:13,代码来源:fish_tests.cpp
示例13: builtin_complete_remove3
/**
Silly function
*/
static void builtin_complete_remove3(const wchar_t *cmd,
int cmd_type,
wchar_t short_opt,
const wcstring_list_t &long_opt)
{
for (size_t i=0; i<long_opt.size(); i++)
{
complete_remove(cmd,
cmd_type,
short_opt,
long_opt.at(i).c_str());
}
}
开发者ID:ThomasRooney,项目名称:fish-shell,代码行数:16,代码来源:builtin_complete.cpp
示例14: history_t
void history_tests_t::test_history_races_pound_on_history()
{
/* Called in child process to modify history */
history_t *hist = new history_t(L"race_test");
hist->chaos_mode = true;
const wcstring_list_t lines = generate_history_lines(getpid());
for (size_t idx = 0; idx < lines.size(); idx++)
{
const wcstring &line = lines.at(idx);
hist->add(line);
hist->save();
}
delete hist;
}
开发者ID:dams,项目名称:fish-shell,代码行数:14,代码来源:fish_tests.cpp
示例15: builtin_complete_add
/// Silly function.
static void builtin_complete_add(const wcstring_list_t &cmd, const wcstring_list_t &path,
const wchar_t *short_opt, wcstring_list_t &gnu_opt,
wcstring_list_t &old_opt, int result_mode,
const wchar_t *condition, const wchar_t *comp, const wchar_t *desc,
int flags) {
for (size_t i = 0; i < cmd.size(); i++) {
builtin_complete_add2(cmd.at(i).c_str(), COMMAND, short_opt, gnu_opt, old_opt, result_mode,
condition, comp, desc, flags);
}
for (size_t i = 0; i < path.size(); i++) {
builtin_complete_add2(path.at(i).c_str(), PATH, short_opt, gnu_opt, old_opt, result_mode,
condition, comp, desc, flags);
}
}
开发者ID:fish-shell,项目名称:fish-shell,代码行数:16,代码来源:builtin_complete.cpp
示例16: erase_values
/**
Erase from a list of wcstring values at specified indexes
*/
static void erase_values(wcstring_list_t &list, const std::vector<long> &indexes)
{
// Make a set of indexes.
// This both sorts them into ascending order and removes duplicates.
const std::set<long> indexes_set(indexes.begin(), indexes.end());
// Now walk the set backwards, so we encounter larger indexes first, and remove elements at the given (1-based) indexes.
std::set<long>::const_reverse_iterator iter;
for (iter = indexes_set.rbegin(); iter != indexes_set.rend(); iter++) {
long val = *iter;
if (val > 0 && val <= list.size()) {
// One-based indexing!
list.erase(list.begin() + val - 1);
}
}
}
开发者ID:asheidan,项目名称:fish-shell,代码行数:19,代码来源:builtin_set.cpp
示例17: binary_primary_evaluate
static bool binary_primary_evaluate(test_expressions::token_t token, const wcstring &left, const wcstring &right, wcstring_list_t &errors)
{
using namespace test_expressions;
long long left_num, right_num;
switch (token)
{
case test_string_equal:
return left == right;
case test_string_not_equal:
return left != right;
case test_number_equal:
return parse_number(left, &left_num) && parse_number(right, &right_num) && left_num == right_num;
case test_number_not_equal:
return parse_number(left, &left_num) && parse_number(right, &right_num) && left_num != right_num;
case test_number_greater:
return parse_number(left, &left_num) && parse_number(right, &right_num) && left_num > right_num;
case test_number_greater_equal:
return parse_number(left, &left_num) && parse_number(right, &right_num) && left_num >= right_num;
case test_number_lesser:
return parse_number(left, &left_num) && parse_number(right, &right_num) && left_num < right_num;
case test_number_lesser_equal:
return parse_number(left, &left_num) && parse_number(right, &right_num) && left_num <= right_num;
default:
errors.push_back(format_string(L"Unknown token type in %s", __func__));
return false;
}
}
开发者ID:DarkStarSword,项目名称:fish-shell,代码行数:35,代码来源:builtin_test.cpp
示例18: parse_number
// IEEE 1003.1 says nothing about what it means for two strings to be "algebraically equal". For
// example, should we interpret 0x10 as 0, 10, or 16? Here we use only base 10 and use wcstoll,
// which allows for leading + and -, and whitespace. This is consistent, albeit a bit more lenient
// since we allow trailing whitespace, with other implementations such as bash.
static bool parse_number(const wcstring &arg, long long *out, wcstring_list_t &errors) {
*out = fish_wcstoll(arg.c_str());
if (errno) {
errors.push_back(format_string(_(L"invalid integer '%ls'"), arg.c_str()));
}
return !errno;
}
开发者ID:msteed,项目名称:fish-shell,代码行数:11,代码来源:builtin_test.cpp
示例19: mangle_completions
/**
Replace completion strings with a comp_t structure
*/
static std::vector<comp_t *> mangle_completions( wcstring_list_t &lst, const wchar_t *prefix )
{
std::vector<comp_t *> result;
for( size_t i=0; i<lst.size(); i++ )
{
wcstring &next = lst.at(i);
size_t start, end;
comp_t zerod = {};
comp_t *comp = new comp_t(zerod);
for( start=end=0; 1; end++ )
{
wchar_t c = next.c_str()[end];
if( (c == COMPLETE_ITEM_SEP) || (c==COMPLETE_SEP) || !c)
{
wcstring start2 = wcstring(next, start, end - start);
wcstring str = escape_string(start2, ESCAPE_ALL | ESCAPE_NO_QUOTED);
comp->comp_width += my_wcswidth( str.c_str() );
comp->comp.push_back(str);
start = end+1;
}
if( c == COMPLETE_SEP )
{
comp->desc = next.c_str() + start;
break;
}
if( !c )
break;
}
comp->comp_width += (int)(my_wcswidth(prefix)*comp->comp.size() + 2*(comp->comp.size()-1));
comp->desc_width = comp->desc.empty()?0:my_wcswidth( comp->desc.c_str() );
comp->pref_width = comp->comp_width + comp->desc_width + (comp->desc_width?4:0);
result.push_back(comp);
}
recalc_width( result, prefix );
return result;
}
开发者ID:anbotero,项目名称:fish-shell,代码行数:49,代码来源:fish_pager.cpp
示例20: evaluate
bool unary_operator::evaluate(wcstring_list_t &errors) {
if (token == test_bang) {
assert(subject.get());
return !subject->evaluate(errors);
}
errors.push_back(format_string(L"Unknown token type in %s", __func__));
return false;
}
开发者ID:msteed,项目名称:fish-shell,代码行数:9,代码来源:builtin_test.cpp
注:本文中的wcstring_list_t类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论