コード例 #1
0
ファイル: command_line.cpp プロジェクト: tantaishan/MyEcho
	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
	}
コード例 #2
0
ファイル: ipc_channel.cpp プロジェクト: Crawping/AsyncIpc
// 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));
}
コード例 #3
0
    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;
    }
コード例 #4
0
ファイル: command_line.cpp プロジェクト: tantaishan/MyEcho
	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);
	}
コード例 #5
0
ファイル: command_line.cpp プロジェクト: kanego/CoreProject
void CommandLine::AppendSwitchASCII(const std::string& switch_string,
                                    const std::string& value_string)
{
    AppendSwitchNative(switch_string, ASCIIToWide(value_string));
}
コード例 #6
0
 // static
 OSExchangeData::CustomFormat OSExchangeData::RegisterCustomFormat(
     const std::string& type)
 {
     return RegisterClipboardFormat(ASCIIToWide(type).c_str());
 }
コード例 #7
0
 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"";
 }