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


C++ PString::GetString方法代码示例

本文整理汇总了C++中PString::GetString方法的典型用法代码示例。如果您正苦于以下问题:C++ PString::GetString方法的具体用法?C++ PString::GetString怎么用?C++ PString::GetString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PString的用法示例。


在下文中一共展示了PString::GetString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SendCommand

PString APServerCommunication::SendCommand(void *handle, PString command)
{
	BMessenger messenger(NULL, serverLooper);
	BMessage message(APSERVER_MSG_DATA);
	BMessage reply;
	const char *replyCmd;
	char *cmdStr;

	// Just add the looper and command to the message
	message.AddPointer("ClientLooper", handle);
	message.AddString("Command", (cmdStr = command.GetString()));
	command.FreeBuffer(cmdStr);

	// Send the command and wait for the reply
	messenger.SendMessage(&message, &reply);

	if (reply.what != APSERVER_MSG_OK)
	{
		// The server couldn't understand or run the command
		//
		// Find the error string
		if (reply.FindString("Result", &replyCmd) == B_OK)
			return (PString("ERR=") + replyCmd);

		return ("ERR=0");
	}

	// Extract the answer from the reply message
	if (reply.FindString("Result", &replyCmd) != B_OK)
		return ("");

	return (replyCmd);
}
开发者ID:pulkomandy,项目名称:APlayer,代码行数:33,代码来源:APServerCommunication.cpp

示例2: GetSettings

void RIFFWAVESettingsWindow::GetSettings(void)
{
	PString tempStr;
	char *tempPoi;
	BMenuItem *item;

	// Set the output format
	tempStr = useSettings->GetStringEntryValue("General", "OutputFormat");
	tempPoi = tempStr.GetString();
	item    = formatPop->FindItem(tempPoi);
	if (item != NULL)
		item->SetMarked(true);

	tempStr.FreeBuffer(tempPoi);
}
开发者ID:pulkomandy,项目名称:APlayer,代码行数:15,代码来源:RIFF-WAVESettingsWindow.cpp

示例3: LoadModule


//.........这里部分代码省略.........

						if (!typeString.IsEmpty())
							file->SetFileType(typeString);
					}
					catch(PFileException e)
					{
						// If we can't set the file type, we ignore the error.
						// An error will occure on e.g. CD-ROM disks
						;
					}
				}

				// Yap, load the module
				convInfo.moduleFile->SeekToBegin();
				apResult = player->LoadModule(playerInfo->index, convInfo.moduleFile, playerError);

				if (apResult != AP_OK)
				{
					// Well, something went wrong when loading the file
					//
					// Build the error string
					errorStr.Format_S3(GetApp()->resource, IDS_CMDERR_LOAD_MODULE, fileName, playerInfo->addOnName, playerError);

					// Delete the player
					playerInfo->loader->DeleteInstance(player);
					player     = NULL;
					playerInfo = NULL;

					result = false;
				}
				else
				{
					// Get module information
					playerName = playerInfo->addOnName;

					if (modConverted)
					{
						moduleFormat = convInfo.modKind;
						if (moduleFormat.IsEmpty())
							moduleFormat = playerInfo->addOnName;
					}
					else
						moduleFormat = playerInfo->addOnName;

					// Should the file still be open?
					if (player->GetSupportFlags(playerInfo->index) & appDontCloseFile)
					{
						// Yes, remember the file pointer
						if (modConverted)
						{
							usingFile = convInfo.newModuleFile;
							convInfo.newModuleFile = NULL;
						}
						else
						{
							usingFile = file;
							file      = NULL;
						}
					}
				}
			}
			else
			{
				// Nup, send an error back
				errorStr.Format_S1(GetApp()->resource, IDS_CMDERR_UNKNOWN_MODULE, fileName);
			}
		}
		catch(...)
		{
			infoList->DoneReading();
			throw;
		}

		// Done with the list
		infoList->DoneReading();
	}
	catch(PFileException e)
	{
		PString err;
		char *fileStr, *errStr;

		// Build error message
		err = PSystem::GetErrorString(e.errorNum);
		errorStr.Format(GetApp()->resource, IDS_CMDERR_FILE, (fileStr = fileName.GetString()), e.errorNum, (errStr = err.GetString()));
		err.FreeBuffer(errStr);
		fileName.FreeBuffer(fileStr);
		result = false;
	}
	catch(...)
	{
		;
	}

	// Close the files again
	delete convInfo.newModuleFile;
	delete file;
	file = NULL;

	return (result);
}
开发者ID:pulkomandy,项目名称:APlayer,代码行数:101,代码来源:APModuleLoader.cpp

示例4: BWindow

RIFFWAVESettingsWindow::RIFFWAVESettingsWindow(PResource *resource, PString title) : BWindow(BRect(0.0f, 0.0f, 0.0f, 0.0f), NULL, B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS)
{
	BRect rect;
	PString label;
	char *labelPtr, *titlePtr;
	float titWidth, winWidth;
	float controlWidth, controlHeight;
	float w, w1, x, y;
	BMessage *message;
	font_height fh;
	float fontHeight;

	// Remember the config information
	res = resource;

	// Set the window title
	SetTitle((titlePtr = title.GetString()));

	// Create background view
	rect    = Bounds();
	topView = new BView(rect, NULL, B_FOLLOW_ALL_SIDES, B_WILL_DRAW);

	// Change the color to light grey
	topView->SetViewColor(BeBackgroundGrey);

	// Add view to the window
	AddChild(topView);

	// Find font height
	topView->GetFontHeight(&fh);
	fontHeight = max(PLAIN_FONT_HEIGHT, ceil(fh.ascent + fh.descent));

	// Create the listbox with the different formats
	formatPop = new BPopUpMenu("");

	label.LoadString(res, IDS_RIFFWAVE_FORMAT_MSADPCM);
	labelPtr = label.GetString();
	w = topView->StringWidth(labelPtr);
	formatPop->AddItem(new BMenuItem(labelPtr, NULL));
	label.FreeBuffer(labelPtr);

	label.LoadString(res, IDS_RIFFWAVE_FORMAT_PCM);
	labelPtr = label.GetString();
	w = max(topView->StringWidth(labelPtr), w);
	formatPop->AddItem(new BMenuItem(labelPtr, NULL));
	label.FreeBuffer(labelPtr);

	label.LoadString(res, IDS_RIFFWAVE_FORMAT);
	labelPtr = label.GetString();
	w1 = topView->StringWidth(labelPtr) + HSPACE;

	formatField = new BMenuField(BRect(HSPACE, VSPACE, HSPACE + w + w1 + HSPACE * 8.0f, VSPACE + 1.0f), NULL, labelPtr, formatPop);
	formatField->SetDivider(w1);
	topView->AddChild(formatField);
	label.FreeBuffer(labelPtr);

	// Find the width of the window
	titWidth = topView->StringWidth(titlePtr);
	winWidth = max(titWidth + HSPACE * 20.0f, w + w1 + HSPACE * 8.0f);
	title.FreeBuffer(titlePtr);

	// Add the "save" button
	y = fontHeight + VSPACE * 5.0f;
	x = winWidth - HSPACE;
	message = new BMessage(APCFG_SAVE);
	label.LoadString(res, IDS_RIFFWAVE_SAVE);
	saveButton = new BButton(BRect(x, y, x, y), NULL, (labelPtr = label.GetString()), message, B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
	label.FreeBuffer(labelPtr);
	saveButton->GetPreferredSize(&controlWidth, &controlHeight);
	x -= controlWidth;
	ResizeTo(winWidth, y + controlHeight + VSPACE);

	saveButton->MoveTo(x, y);
	saveButton->ResizeTo(controlWidth, controlHeight);
	topView->AddChild(saveButton);

	// Add the "Use" button
	message = new BMessage(APCFG_USE);
	label.LoadString(res, IDS_RIFFWAVE_USE);
	useButton = new BButton(BRect(x, y, x, y), NULL, (labelPtr = label.GetString()), message, B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
	label.FreeBuffer(labelPtr);
	useButton->GetPreferredSize(&controlWidth, &controlHeight);
	x -= (controlWidth + HSPACE);
	useButton->MoveTo(x, y);
	useButton->ResizeTo(controlWidth, controlHeight);
	topView->AddChild(useButton);

	// Set the settings in the controls
	GetSettings();

	// Does any window position exists in the settings
	if (useSettings->EntryExist("Window", "WinX") && useSettings->EntryExist("Window", "WinY"))
	{
		// Yes, now set the new window positions
		x = useSettings->GetIntEntryValue("Window", "WinX");
		y = useSettings->GetIntEntryValue("Window", "WinY");
		MoveTo(x, y);
	}
}
开发者ID:pulkomandy,项目名称:APlayer,代码行数:99,代码来源:RIFF-WAVESettingsWindow.cpp


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