本文整理汇总了C++中Printer::Remove方法的典型用法代码示例。如果您正苦于以下问题:C++ Printer::Remove方法的具体用法?C++ Printer::Remove怎么用?C++ Printer::Remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Printer
的用法示例。
在下文中一共展示了Printer::Remove方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: reply
void
PrintServerApp::HandleScriptingCommand(BMessage* msg)
{
BString propName;
BMessage spec;
int32 idx;
if (msg->GetCurrentSpecifier(&idx,&spec) == B_OK &&
spec.FindString("property",&propName) == B_OK) {
switch(msg->what) {
case B_GET_PROPERTY:
if (propName == "ActivePrinter") {
BMessage reply(B_REPLY);
reply.AddString("result", fDefaultPrinter
? fDefaultPrinter->Name() : "");
reply.AddInt32("error", B_OK);
msg->SendReply(&reply);
} else if (propName == "UseConfigWindow") {
BMessage reply(B_REPLY);
reply.AddString("result", fUseConfigWindow
? "true" : "false");
reply.AddInt32("error", B_OK);
msg->SendReply(&reply);
}
break;
case B_SET_PROPERTY:
if (propName == "ActivePrinter") {
BString newActivePrinter;
if (msg->FindString("data", &newActivePrinter) == B_OK) {
BMessage reply(B_REPLY);
reply.AddInt32("error",
SelectPrinter(newActivePrinter.String()));
msg->SendReply(&reply);
}
} else if (propName == "UseConfigWindow") {
bool useConfigWindow;
if (msg->FindBool("data", &useConfigWindow) == B_OK) {
fUseConfigWindow = useConfigWindow;
BMessage reply(B_REPLY);
reply.AddInt32("error", fUseConfigWindow);
msg->SendReply(&reply);
}
}
break;
case B_CREATE_PROPERTY:
if (propName == "Printer") {
BString name, driver, transport, config;
if (msg->FindString("name", &name) == B_OK
&& msg->FindString("driver", &driver) == B_OK
&& msg->FindString("transport", &transport) == B_OK
&& msg->FindString("config", &config) == B_OK) {
BMessage reply(B_REPLY);
reply.AddInt32("error", CreatePrinter(name.String(),
driver.String(), "Local", transport.String(),
config.String()));
msg->SendReply(&reply);
}
}
break;
case B_DELETE_PROPERTY: {
Printer* printer = GetPrinterFromSpecifier(&spec);
status_t rc = B_BAD_VALUE;
if (printer != NULL)
rc=printer->Remove();
BMessage reply(B_REPLY);
reply.AddInt32("error", rc);
msg->SendReply(&reply);
}
break;
case B_COUNT_PROPERTIES:
if (propName == "Printers") {
BMessage reply(B_REPLY);
reply.AddInt32("result", Printer::CountPrinters());
reply.AddInt32("error", B_OK);
msg->SendReply(&reply);
} else if (propName == "Transports") {
BMessage reply(B_REPLY);
reply.AddInt32("result", Transport::CountTransports());
reply.AddInt32("error", B_OK);
msg->SendReply(&reply);
}
break;
}
}
}