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


C++ BString::SetTo方法代码示例

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


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

示例1: _SplitNormalizedPath

	void _SplitNormalizedPath(const BString& path, BString& _directory,
		BString& _name)
	{
		// handle single component (including root dir) cases
		int32 lastSlash = path.FindLast('/');
		if (lastSlash < 0 || path.Length() == 1) {
			_directory = (const char*)NULL;
			_name = path;
			return;
		}

		// handle root dir + one component and multi component cases
		if (lastSlash == 0)
			_directory = "/";
		else
			_directory.SetTo(path, lastSlash);
		_name = path.String() + (lastSlash + 1);
	}
开发者ID:looncraz,项目名称:haiku,代码行数:18,代码来源:FileManager.cpp

示例2:

bool
CDDBData::RenameTrack(const int32 &index, const char *newName)
{
	if (!newName) {
		STRACE(("CDDBData::RenameTrack failed - NULL newName\n"));
		return false;
	}

	BString *name = (BString*)fTrackList.ItemAt(index);
	if (name) {
		STRACE(("CDDBData::RenameTrack(%" B_PRId32 ",%s)\n", index, newName));
		name->SetTo(newName);
		return true;
	}

	STRACE(("CDDBData::RenameTrack failed - invalid index\n"));
	return false;
}
开发者ID:Barrett17,项目名称:haiku-contacts-kit-old,代码行数:18,代码来源:CDDBSupport.cpp

示例3:

status_t
AccelerantHWInterface::GetDriverPath(BString& string)
{
	// TODO: this currently assumes that the accelerant's clone info
	//	is always the path name of its driver (that's the case for
	//	all of our drivers)
	char path[B_PATH_NAME_LENGTH];
	get_accelerant_clone_info getCloneInfo;
	getCloneInfo = (get_accelerant_clone_info)fAccelerantHook(
		B_GET_ACCELERANT_CLONE_INFO, NULL);

	if (getCloneInfo == NULL)
		return B_NOT_SUPPORTED;

	getCloneInfo((void*)path);
	string.SetTo(path);
	return B_OK;
}
开发者ID:naveedasmat,项目名称:haiku,代码行数:18,代码来源:AccelerantHWInterface.cpp

示例4:

char *FindWindow::CreateFindString(char *pBuffer)
{

	BString bsFind;
	
	bsFind.SetTo("FILENAME CONTAINS \"");
	bsFind.Append(myArtist->Text());
	if (strcmp(mySong->Text(), "") != 0)
	{
		bsFind.Append(" ");
		bsFind.Append(mySong->Text());
	}
	bsFind.Append("\" MAX RESULTS ");
	bsFind.Append(myMax->Text());
	
	pBuffer = (char *)malloc(bsFind.Length()+1);
	strcpy(pBuffer, bsFind.String());
	return (pBuffer);
}
开发者ID:HaikuArchives,项目名称:BeNapster,代码行数:19,代码来源:FindWindow.cpp

示例5: sizeof

BString
BStatusView::_FullSpeedString()
{
	BString buffer;
	if (fBytesPerSecond != 0.0) {
		char sizeBuffer[128];
		buffer.SetTo(B_TRANSLATE(
			"%SizeProcessed of %TotalSize, %BytesPerSecond/s"));
		buffer.ReplaceFirst("%SizeProcessed",
			string_for_size((double)fSizeProcessed, sizeBuffer,
			sizeof(sizeBuffer)));
		buffer.ReplaceFirst("%TotalSize",
			string_for_size((double)fTotalSize, sizeBuffer,
			sizeof(sizeBuffer)));
		buffer.ReplaceFirst("%BytesPerSecond",
			string_for_size(fBytesPerSecond, sizeBuffer, sizeof(sizeBuffer)));
	}
	return buffer;
}
开发者ID:Barrett17,项目名称:haiku-contacts-kit-old,代码行数:19,代码来源:StatusWindow.cpp

示例6: strlen

char * BeCheckersWindow::File(const char *fileName) {
	char *f;

	BPath p;
	find_directory(B_USER_DIRECTORY, &p);

	BString path;
	path.SetTo(p.Path()).Append("/").Append(APP_SGP);
	create_directory(path.String(), 0777);

	p.SetTo(path.String());

    if(p.Path() != NULL) {
		f = new char[strlen(p.Path()) + strlen(fileName) + 6] = {'\0'};
		sprintf(f, "%s%s%s%s", p.Path(), "/", fileName, APP_XTN);	// Thanks, Charlie.
	}

	return(p.Path() == NULL ? NULL : f);
}
开发者ID:noryb009,项目名称:BeCheckers,代码行数:19,代码来源:BeCheckersWindow.cpp

示例7: locker

void
StringEditor::_UpdateText()
{
	BAutolock locker(fEditor);

	size_t viewSize = fEditor.ViewSize();
	// that may need some more memory...
	if ((off_t)viewSize < fEditor.FileSize())
		fEditor.SetViewSize(fEditor.FileSize());

	const char *buffer;
	if (fEditor.GetViewBuffer((const uint8 **)&buffer) == B_OK) {
		fTextView->SetText(buffer);
		fPreviousText.SetTo(buffer);
	}

	// restore old view size
	fEditor.SetViewSize(viewSize);
}
开发者ID:DonCN,项目名称:haiku,代码行数:19,代码来源:TypeEditors.cpp

示例8: sizeof

status_t
IntegerValueFormatter::FormatValue(Value* _value, BString& _output)
{
    IntegerValue* value = dynamic_cast<IntegerValue*>(_value);
    if (value == NULL)
        return B_BAD_VALUE;

    // format the value
    integer_format format = fConfig != NULL
                            ? fConfig->IntegerFormat() : INTEGER_FORMAT_DEFAULT;
    char buffer[32];
    if (!IntegerFormatter::FormatValue(value->GetValue(), format,  buffer,
                                       sizeof(buffer))) {
        return B_BAD_VALUE;
    }

    _output.SetTo(buffer);

    return B_OK;
}
开发者ID:kodybrown,项目名称:haiku,代码行数:20,代码来源:IntegerValueFormatter.cpp

示例9:

/*	isCue
*	checks if selected file is a cue file (checks by file extension)
*	if yes, returns true
*/
bool
ProjectTypeSelector::isCue()
{
	BString *SelectedFile = (BString*)FileList->FirstItem();
	BString SelectedFileTMP;
	BString FileExtension;
	BString tmp;
	
	//get file extension
	SelectedFile->CopyInto(SelectedFileTMP, 0, (int)SelectedFile->Length());
	SelectedFileTMP.RemoveAll("/");
	for(int i = 3; i > 0; i--) {
		tmp.SetTo(SelectedFileTMP.ByteAt((SelectedFileTMP.Length() - i)), 1);
		FileExtension.Insert(tmp.String(), FileExtension.Length());
	}
	
	FileExtension.ToUpper();
	if(FileExtension.Compare("CUE") == 0)
		return true;
	
	return false;
}
开发者ID:HaikuArchives,项目名称:Lava,代码行数:26,代码来源:ProjectTypeSelector.cpp

示例10: php_class

void php_class(const char *&txt, PopupList &pul, BString &className, bool sorted)
{
	BString label;

	txt = skip_whitespace(txt+5);
	const char *beg = txt;
	while (isident(*++txt)) ;
	className.SetTo(beg, txt-beg);

	while (*++txt && *txt != '{') ;

//	txt = skip_whitespace(txt);
//	if (*txt == '(') {
//		const char* beg = txt;
//		txt = skip_block(txt+1, '(', ')');
//		params.SetTo(beg+1, txt-beg-2);
//		params.Prepend("  (");
//		params.Append(")");
//	}
	if (!sorted)
		pul.insert(pul.end(), PopupMenu(className, className, beg, true));
} /* php_class */
开发者ID:BackupTheBerlios,项目名称:pe-editor,代码行数:22,代码来源:HtmlCssJsPhp_Popup.cpp

示例11: BString

/*static*/ void
BLayoutUtils::_GetLayoutTreeDump(BView* view, int level, BString& _output)
{
	BString indent;
	indent.SetTo(' ', level * 2);

	if (view == NULL) {
		_output << indent << "<null view>\n";
		return;
	}

	BRect frame = view->Frame();
	BSize min = view->MinSize();
	BSize max = view->MinSize();
	BSize preferred = view->PreferredSize();
	_output << BString().SetToFormat(
		"%sview %p (%s):\n"
		"%s  frame: (%f, %f, %f, %f)\n"
		"%s  min:   (%f, %f)\n"
		"%s  max:   (%f, %f)\n"
		"%s  pref:  (%f, %f)\n",
		indent.String(), view, typeid(*view).name(),
		indent.String(), frame.left, frame.top, frame.right, frame.bottom,
		indent.String(), min.width, min.height,
		indent.String(), max.width, max.height,
		indent.String(), preferred.width, preferred.height);

	if (BLayout* layout = view->GetLayout()) {
		_GetLayoutTreeDump(layout, level, true, _output);
		return;
	}

	int32 count = view->CountChildren();
	for (int32 i = 0; i < count; i++) {
		_output << indent << "  ---\n";
		_GetLayoutTreeDump(view->ChildAt(i), level + 1, _output);
	}
}
开发者ID:naveedasmat,项目名称:haiku,代码行数:38,代码来源:LayoutUtils.cpp

示例12:

status_t
ParseFilter::ProcessMailMessage(BPositionIO **data, BEntry */*entry*/, BMessage *headers,
	BPath */*folder*/, const char */*uid*/)
{
	char byte;
	(*data)->ReadAt(0,&byte, 1);
	(*data)->Seek(SEEK_SET, 0);

	status_t status = parse_header(*headers, **data);
	if (status < B_OK)
		return status;

	//
	// add pseudo-header THREAD, that contains the subject
	// minus stuff in []s (added by mailing lists) and
	// Re: prefixes, added by mailers when you reply.
	// This will generally be the "thread subject".
	//
	BString string;
	string.SetTo(headers->FindString("Subject"));
	SubjectToThread(string);
	headers->AddString("THREAD", string.String());

	// name
	if (headers->FindString(fNameField.String(), 0, &string) == B_OK) {
		extract_address_name(string);
		headers->AddString("NAME", string);
	}

	// header length
	headers->AddInt32(B_MAIL_ATTR_HEADER, (int32)((*data)->Position()));
	// What about content length?  If we do that, we have to D/L the
	// whole message...
	//--NathanW says let the disk consumer do that
	
	(*data)->Seek(0, SEEK_SET);
	return B_OK;
}
开发者ID:luciang,项目名称:haiku,代码行数:38,代码来源:filter.cpp

示例13: message

status_t
BNetworkRoster::AddPersistentNetwork(const wireless_network& network)
{
	BMessage message(kMsgAddPersistentNetwork);
	BString networkName;
	networkName.SetTo(network.name, sizeof(network.name));
	status_t status = message.AddString("name", networkName);
	if (status == B_OK) {
		BNetworkAddress address = network.address;
		status = message.AddFlat("address", &address);
	}

	if (status == B_OK)
		status = message.AddUInt32("flags", network.flags);
	if (status == B_OK) {
		status = message.AddUInt32("authentication_mode",
			network.authentication_mode);
	}
	if (status == B_OK)
		status = message.AddUInt32("cipher", network.cipher);
	if (status == B_OK)
		status = message.AddUInt32("group_cipher", network.group_cipher);
	if (status == B_OK)
		status = message.AddUInt32("key_mode", network.key_mode);

	if (status != B_OK)
		return status;

	BMessenger networkServer(kNetServerSignature);
	BMessage reply;
	status = networkServer.SendMessage(&message, &reply);
	if (status == B_OK)
		reply.FindInt32("status", &status);

	return status;
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:36,代码来源:NetworkRoster.cpp

示例14: Calculate

void PanelView::Calculate(CustomListItem *item)
////////////////////////////////////////////////////////////////////////
{
//	SetMousePointer(CR_HOURGLASS);
	MAINWINDOW->SetMousePointer(GenesisWindow::CR_HOURGLASS);

	if (item->m_Type==FT_DIRECTORY)
	{
		BString file;

		file.SetTo(m_Path.String());
		file+="/";
		file+=item->m_FileName;

		item->m_FileSize = GetDirectorySize(file.String());
		m_CustomListView->InvalidateItem(m_CustomListView->IndexOf(item));
	}
	
	m_CurrentTotalSize = m_CustomListView->GetCurrentTotalSize();
	SelectionChanged();		// Because the total directory size may change...
	
//	SetMousePointer(CR_DEFAULT);
	MAINWINDOW->SetMousePointer(GenesisWindow::CR_DEFAULT);
}
开发者ID:PZsolt27,项目名称:GenesisCommander,代码行数:24,代码来源:GenesisPanelView.cpp

示例15: Load

status_t TConfigFile::Load()
{
	int32 textlen;
	char text[2048], *value;
	BString buff;
	config_t *item;
	FILE *fd = fopen(fPathName.String(), "r");
	if (!fd) return errno;
	while (!feof(fd)) {
		if (fgets(text, sizeof(text), fd) == NULL) break;
		buff.Append(text);
		textlen = strlen(text);
		if (text[textlen - 1] == '\n') {
			buff.RemoveLast("\n");
			value = strchr(buff.String(), ' ');
			if (value != NULL) {
				if ((item = (config_t *)calloc(sizeof(config_t), 1)) == NULL) {
					fclose(fd);
					return ENOMEM;
				}
				if (!fList.AddItem(item)) {
					free(item);
					fclose(fd);
					return ENOMEM;
				}
				*value = 0;
				value++;
				strncpy(item->key, buff.String(), sizeof(item->key));
				strncpy(item->value, value, sizeof(item->value));
			}
			buff.SetTo("");
		}
	}
	fclose(fd);
	return B_OK;
}
开发者ID:HaikuArchives,项目名称:FtpPositive,代码行数:36,代码来源:ConfigFile.cpp


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