本文整理汇总了C++中Argument::get方法的典型用法代码示例。如果您正苦于以下问题:C++ Argument::get方法的具体用法?C++ Argument::get怎么用?C++ Argument::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Argument
的用法示例。
在下文中一共展示了Argument::get方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dropped_uid
static uid_t dropped_uid()
{
uid_t uid = -1;
try
{
uid = boost::lexical_cast<int>(user.get());
}
catch (boost::bad_lexical_cast const &)
{
uid = uid_by_name(user.get());
}
return uid;
}
示例2: on_start_button
void Window::on_start_button ()
{
app.argument.clear();
app.option.clear();
// argument list:
for (Gtk::Box_Helpers::BoxList::iterator it = arguments_box.children().begin(); it != arguments_box.children().end(); ++it) {
Argument* arg = (Argument*) (it->get_widget());
app.argument.push_back (arg->get());
if (app.argument.back().type() == Undefined) {
error (String ("value supplied for argument \"") + arg->arg.lname + "\" is not valid");
return;
}
}
ProgressBar::display = true;
App::log_level = 1 + message_level.get_active_row_number();
stop_button.set_sensitive (true);
start_button.set_sensitive (false);
try {
app.execute();
print ("\nCompleted successfully\n\n");
}
catch (...) { error ("Error during execution!"); }
stop_button.set_sensitive (false);
start_button.set_sensitive (true);
}
示例3: loadConfigFile
bool loadConfigFile()
{
std::string path(config.get());
struct stat st;
if (::stat(path.c_str(), &st) < 0 || !S_ISREG(st.st_mode))
{
std::cerr << "Not a file: " << path << std::endl;
return false;
}
std::ifstream is(path.c_str(), std::ios::binary);
if (!is.is_open())
{
std::cerr << "File not readable: " << path << std::endl;
return false;
}
is.seekg(0, std::ios_base::end);
std::streampos len = is.tellg();
is.seekg(0, std::ios::beg);
std::string data;
if (len > 0)
{
data.resize(len);
is.read(&data[0], len);
std::string error;
if (!ArgumentBase::parseData(data, error))
{
std::cerr << error << std::endl;
return false;
}
}
return true;
}
示例4: printRequest
static void printRequest(HttpRequestHolder const &req, StatServer *ss)
{
if (debugHttp.enabled())
{
LogNotice << "http serving" << req->url();
}
LogDebug << "Serving:" << req->method() << req->url();
boost::shared_ptr<RequestInFlight> rif(new RequestInFlight(req.p_, ss, filesDir.get()));
ss->service().post(boost::bind(&RequestInFlight::go, rif));
}
示例5: drop_privileges
void drop_privileges()
{
LogSpam << "drop_privileges()";
uid_t uid = dropped_uid();
if (uid < 0)
{
throw std::runtime_error("User " + user.get() + " is not known.");
}
if ((geteuid() != uid) && (seteuid(uid) < 0))
{
throw std::runtime_error("Could not seteuid(" + boost::lexical_cast<std::string>(uid) + ").");
}
}