本文整理汇总了C++中wcstring_list_t类的典型用法代码示例。如果您正苦于以下问题:C++ wcstring_list_t类的具体用法?C++ wcstring_list_t怎么用?C++ wcstring_list_t使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了wcstring_list_t类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
示例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);
}
}
示例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;
}
示例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);
}
}
示例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;
}
示例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);
}
}
示例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;
}
示例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;
}
示例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');
}
}
示例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());
}
}
示例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');
}
}
示例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;
}
示例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());
}
}
示例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;
}
示例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);
}
}