当前位置: 首页>>代码示例>>C++>>正文


C++ Printer::Remove方法代码示例

本文整理汇总了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;
		}
	}
}
开发者ID:looncraz,项目名称:haiku,代码行数:92,代码来源:PrintServerApp.Scripting.cpp


注:本文中的Printer::Remove方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。