void CommandLine::AppendSwitchASCII(const std::string& switch_string, const std::string& value_string) { #if defined(OS_WIN) AppendSwitchNative(switch_string, ASCIIToWide(value_string)); #elif defined(OS_POSIX) AppendSwitchNative(switch_string, value_string); #endif }
// static const std::wstring Channel::PipeName( const std::string& channel_id, int32* secret) { std::string name("\\\\.\\pipe\\ipc."); // Prevent the shared secret from ending up in the pipe name. size_t index = channel_id.find_first_of('\\'); if (index != std::string::npos) { if (secret) { // Retrieve the secret if asked for. *secret = atoi(channel_id.substr(index + 1).c_str()); } return ASCIIToWide(name.append(channel_id.substr(0, index - 1))); } // This case is here to support predictable named pipes in tests. if (secret) *secret = 0; return ASCIIToWide(name.append(channel_id)); }
void CommandLine::AppendSwitchNative(const std::string& switch_string, const std::wstring& value) { std::wstring combined_switch_string = kSwitchPrefixes[0] + ASCIIToWide(switch_string); if(!value.empty()) { combined_switch_string += kSwitchValueSeparator + WindowsStyleQuote(value); } command_line_string_.append(L" "); command_line_string_.append(combined_switch_string); switches_[switch_string] = value; }
void CommandLine::AppendSwitchNative(const std::string& switch_string, const CommandLine::StringType& value) { std::string switch_key(LowerASCIIOnWindows(switch_string)); #if defined(OS_WIN) StringType combined_switch_string(ASCIIToWide(switch_key)); #elif defined(OS_POSIX) StringType combined_switch_string(switch_string); #endif size_t prefix_length = GetSwitchPrefixLength(combined_switch_string); switches_[switch_key.substr(prefix_length)] = value; // Preserve existing switch prefixes in |argv_|; only append one if necessary. if (prefix_length == 0) combined_switch_string = kSwitchPrefixes[0] + combined_switch_string; if (!value.empty()) combined_switch_string += kSwitchValueSeparator + value; // Append the switch and update the switches/arguments divider |begin_args_|. argv_.insert(argv_.begin() + begin_args_++, combined_switch_string); }
void CommandLine::AppendSwitchASCII(const std::string& switch_string, const std::string& value_string) { AppendSwitchNative(switch_string, ASCIIToWide(value_string)); }
// static OSExchangeData::CustomFormat OSExchangeData::RegisterCustomFormat( const std::string& type) { return RegisterClipboardFormat(ASCIIToWide(type).c_str()); }
void CommandLine::AppendSwitch(const std::string& switch_string) { command_line_string_.append(L" "); command_line_string_.append(kSwitchPrefixes[0]+ASCIIToWide(switch_string)); switches_[switch_string] = L""; }