本文整理汇总了C++中DebuggerClient::getCurrentUser方法的典型用法代码示例。如果您正苦于以下问题:C++ DebuggerClient::getCurrentUser方法的具体用法?C++ DebuggerClient::getCurrentUser怎么用?C++ DebuggerClient::getCurrentUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DebuggerClient
的用法示例。
在下文中一共展示了DebuggerClient::getCurrentUser方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AttachSandbox
bool CmdMachine::AttachSandbox(DebuggerClient &client,
const char *user /* = NULL */,
const char *name /* = NULL */,
bool force /* = false */) {
string login;
if (user == nullptr) {
user = client.getCurrentUser().c_str();
}
DSandboxInfoPtr sandbox(new DSandboxInfo());
sandbox->m_user = user ? user : "";
sandbox->m_name = (name && *name) ? name : "default";
return AttachSandbox(client, sandbox, force);
}
示例2: onClientImpl
void CmdMachine::onClientImpl(DebuggerClient &client) {
if (DebuggerCommand::displayedHelp(client)) return;
if (client.argCount() == 0) {
help(client);
return;
}
bool rpc = client.arg(1, "rpc");
if (rpc || client.arg(1, "connect")) {
if (client.argCount() != 2) {
help(client);
return;
}
string host = client.argValue(2);
int port = 0;
size_t pos = host.find(":");
if (pos != string::npos) {
if (!DebuggerClient::IsValidNumber(host.substr(pos + 1))) {
client.error("Port needs to be a number");
help(client);
return;
}
port = atoi(host.substr(pos + 1).c_str());
host = host.substr(0, pos);
}
if (rpc) {
if (client.connectRPC(host, port)) {
throw DebuggerConsoleExitException();
}
} else {
if (client.connect(host, port)) {
throw DebuggerConsoleExitException();
}
}
if (!client.initializeMachine()) {
throw DebuggerConsoleExitException();
}
return;
}
if (client.arg(1, "disconnect")) {
if (client.disconnect()) {
throw DebuggerConsoleExitException();
}
if (!client.initializeMachine()) {
throw DebuggerConsoleExitException();
}
return;
}
if (client.arg(1, "list")) {
processList(client);
return;
}
if (client.arg(1, "attach")) {
DSandboxInfoPtr sandbox;
string snum = client.argValue(2);
if (DebuggerClient::IsValidNumber(snum)) {
int num = atoi(snum.c_str());
sandbox = client.getSandbox(num);
if (!sandbox) {
processList(client, false);
sandbox = client.getSandbox(num);
if (!sandbox) {
client.error("\"%s\" is not a valid sandbox index. Choose one from "
"this list:", snum.c_str());
processList(client);
return;
}
}
} else {
int argBase = 2;
if (client.argCount() >= 2 && client.arg(2, "force")) {
m_force = true;
argBase++;
}
sandbox = DSandboxInfoPtr(new DSandboxInfo());
if (client.argCount() < argBase) {
sandbox->m_user = client.getCurrentUser();
sandbox->m_name = "default";
} else if (client.argCount() == argBase) {
sandbox->m_user = client.getCurrentUser();
sandbox->m_name = client.argValue(argBase);
} else if (client.argCount() == argBase + 1) {
sandbox->m_user = client.argValue(argBase);
sandbox->m_name = client.argValue(argBase + 1);
} else {
help(client);
return;
}
}
if (AttachSandbox(client, sandbox, m_force)) {
// Attach succeed, wait for next interrupt
throw DebuggerConsoleExitException();
}
return;
}
//.........这里部分代码省略.........