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


C++ LLString::c_str方法代码示例

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


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

示例1: startRequest

BOOL LLAsyncHostByName::startRequest( const LLString& domain_name, LLAsyncHostByNameCallback callback, void* userdata )
{
	if( isPendingRequest() )
	{
		llwarns << "LLAsyncHostByName::startRequest() cancelled existing request." << llendl;
		cancelPendingRequest();
	}

	mCallback = callback;
	mUserdata = userdata;
	memset(mOutputBuffer, 0, sizeof( mOutputBuffer ) );
	mDomainName = domain_name;

	mRequestHandle = WSAAsyncGetHostByName( 
		(HWND)gViewerWindow->getPlatformWindow(),
		LL_WM_HOST_RESOLVED,
		domain_name.c_str(),
		mOutputBuffer,
		sizeof( mOutputBuffer ) );

	if( !mRequestHandle )
	{
		llwarns << "LLAsyncHostByName::startRequest() failed: " << WSAGetLastError() << llendl;
		return FALSE;
	}

	return TRUE;
}
开发者ID:xinyaojiejie,项目名称:Dale,代码行数:28,代码来源:llasynchostbyname.cpp

示例2: handleEvent

	bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
	{
		LLString size = userdata.asString();
		S32 width, height;
		sscanf(size.c_str(), "%d,%d", &width, &height);
		LLViewerWindow::movieSize(width, height);
		return true;
	}
开发者ID:xinyaojiejie,项目名称:Dale,代码行数:8,代码来源:llviewermenufile.cpp

示例3: performQuery

// virtual
void LLPanelDirPlaces::performQuery()
{
	LLString name = childGetValue("name").asString();
	if (name.length() < mMinSearchChars)
	{
		return;
	}

	LLString catstring = childGetValue("Category").asString();
	
	// Because LLParcel::C_ANY is -1, must do special check
	S32 category = 0;
	if (catstring == "any")
	{
		category = LLParcel::C_ANY;
	}
	else
	{
		category = LLParcel::getCategoryFromString(catstring.c_str());
	}

	U32 flags = 0x0;
	bool adult_enabled = gAgent.canAccessAdult();
	bool mature_enabled = gAgent.canAccessMature();

	if (gSavedSettings.getBOOL("ShowPGSims") ||
	    (!adult_enabled && !mature_enabled)) // if they can't have either of the others checked, force this one true 
	{
		flags |= DFQ_INC_PG;
	}

	if( gSavedSettings.getBOOL("ShowMatureSims") && mature_enabled)
	{
		flags |= DFQ_INC_MATURE;
	}

	if( gSavedSettings.getBOOL("ShowAdultSims") && adult_enabled)
	{
		flags |= DFQ_INC_ADULT;
	}
	
	// Pack old query flag in case we are talking to an old server
	if ( ((flags & DFQ_INC_PG) == DFQ_INC_PG) && !((flags & DFQ_INC_MATURE) == DFQ_INC_MATURE) )
	{
		flags |= DFQ_PG_PARCELS_ONLY;
	}
 
	if (0x0 == flags)
	{
		LLNotifyBox::showXml("NoContentToSearch");
		return; 
	}

	queryCore(name, category, flags);
}
开发者ID:Boy,项目名称:netbook,代码行数:56,代码来源:llpaneldirplaces.cpp

示例4: requestFriendship

// static
void LLFloaterFriends::requestFriendship(const LLUUID& target_id, const LLString& target_name)
{
	// HACK: folder id stored as "message"
	LLUUID calling_card_folder_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_CALLINGCARD);
	std::string message = calling_card_folder_id.asString();
	send_improved_im(target_id,
					 target_name.c_str(),
					 message.c_str(),
					 IM_ONLINE,
					 IM_FRIENDSHIP_OFFERED);
}
开发者ID:Boy,项目名称:netbook,代码行数:12,代码来源:llfloaterfriends.cpp

示例5: loadFile

// Reads a .tga file and creates an LLImageTGA with its data.
bool LLImageTGA::loadFile( const LLString& path )
{
	S32 len = path.size();
	if( len < 5 )
	{
		return false;
	}
	
	LLString extension = path.substr( len - 4, 4 );
	LLString::toLower(extension);
	if( ".tga" != extension )
	{
		return false;
	}
	
	FILE* file = LLFile::fopen(path.c_str(), "rb");	/* Flawfinder: ignore */
	if( !file )
	{
		llwarns << "Couldn't open file " << path << llendl;
		return false;
	}

	S32 file_size = 0;
	if (!fseek(file, 0, SEEK_END))
	{
		file_size = ftell(file);
		fseek(file, 0, SEEK_SET);
	}

	U8* buffer = allocateData(file_size);
	S32 bytes_read = fread(buffer, 1, file_size, file);
	if( bytes_read != file_size )
	{
		deleteData();
		llwarns << "Couldn't read file " << path << llendl;
		return false;
	}

	fclose( file );

	if( !updateData() )
	{
		llwarns << "Couldn't decode file " << path << llendl;
		deleteData();
		return false;
	}
	return true;
}
开发者ID:Boy,项目名称:netbook,代码行数:49,代码来源:llimagetga.cpp

示例6: updateEditor

void LLSpinCtrl::updateEditor()
{
	LLLocale locale(LLLocale::USER_LOCALE);

	// Don't display very small negative values as -0.000
	F32 displayed_value = clamp_precision((F32)getValue().asReal(), mPrecision);

//	if( S32( displayed_value * pow( 10, mPrecision ) ) == 0 )
//	{
//		displayed_value = 0.f;
//	}

	LLString format = llformat("%%.%df", mPrecision);
	LLString text = llformat(format.c_str(), displayed_value);
	mEditor->setText( text );
}
开发者ID:xinyaojiejie,项目名称:Dale,代码行数:16,代码来源:llspinctrl.cpp

示例7: onEditorCommit

void LLSpinCtrl::onEditorCommit( LLUICtrl* caller, void *userdata )
{
	BOOL success = FALSE;
	
	LLSpinCtrl* self = (LLSpinCtrl*) userdata;
	llassert( caller == self->mEditor );

	LLString text = self->mEditor->getText();
	if( LLLineEditor::postvalidateFloat( text ) )
	{
		LLLocale locale(LLLocale::USER_LOCALE);
		F32 val = (F32) atof(text.c_str());

		if (val < self->mMinValue) val = self->mMinValue;
		if (val > self->mMaxValue) val = self->mMaxValue;

		if( self->mValidateCallback )
		{
			F32 saved_val = self->mValue;
			self->mValue = val;
			if( self->mValidateCallback( self, self->mCallbackUserData ) )
			{
				success = TRUE;
				self->onCommit();
			}
			else
			{
				self->mValue = saved_val;
			}
		}
		else
		{
			self->mValue = val;
			self->onCommit();
			success = TRUE;
		}
	}
	self->updateEditor();

	if( !success )
	{
		self->reportInvalidData();		
	}
}
开发者ID:xinyaojiejie,项目名称:Dale,代码行数:44,代码来源:llspinctrl.cpp

示例8: int

BOOL
LLMediaImplGStreamer::
load ( const LLString& urlIn )
{
	llinfos << "Setting media URI: " << urlIn << llendl;

 	if (!mPlaybin)
 	{
		return FALSE;
	}

	// set URI
	g_object_set (G_OBJECT (mPlaybin), "uri", urlIn.c_str(), NULL);
	//g_object_set (G_OBJECT (mPlaybin), "uri", "file:///tmp/movie", NULL);

	// get playbin's bus - perhaps this can/should be done at init()
	GstBus *bus = llgst_pipeline_get_bus (GST_PIPELINE (mPlaybin));
	if (!bus)
	{
		return FALSE;
	}
	llgst_bus_add_watch (bus, my_bus_callback, this);
	llgst_object_unref (bus);

	if (true) // dummy values
	{
		const int fixedsize = 2;
		mMediaRowbytes = mMediaDepthBytes * fixedsize;
		mMediaWidth = fixedsize;
		mMediaHeight = fixedsize;
		mTextureWidth = fixedsize;
		mTextureHeight = fixedsize;
	}

	BOOL rtn = LLMediaMovieBase::load(urlIn);
	llinfos << "load returns " << int(rtn) << llendl;
	return rtn;
}
开发者ID:Boy,项目名称:netbook,代码行数:38,代码来源:llmediaimplgstreamer.cpp

示例9: loadFromFileLegacy

U32 LLControlGroup::loadFromFileLegacy(const LLString& filename, BOOL require_declaration, eControlType declare_as)
{
	U32		item = 0;
	U32		validitems = 0;
	llifstream file;
	S32 version;
	
	file.open(filename.c_str());		/*Flawfinder: ignore*/ 

	if (!file)
	{
		llinfos << "LLControlGroup::loadFromFile unable to open." << llendl;
		return 0;
	}

	// Check file version
	LLString name;
	file >> name;
	file >> version;
	if (name != "version" || version != CURRENT_VERSION)
	{
		llinfos << filename << " does not appear to be a version " << CURRENT_VERSION << " controls file" << llendl;
		return 0;
	}

	while (!file.eof())
	{
		file >> name;
		
		if (name.empty())
		{
			continue;
		}

		if (name.substr(0,2) == "//")
		{
			// This is a comment.
			char buffer[MAX_STRING];		/*Flawfinder: ignore*/
			file.getline(buffer, MAX_STRING);
			continue;
		}

		BOOL declared = mNameTable.find(name) != mNameTable.end();

		if (require_declaration && !declared)
		{
			// Declaration required, but this name not declared.
			// Complain about non-empty names.
			if (!name.empty())
			{
				//read in to end of line
				char buffer[MAX_STRING];		/*Flawfinder: ignore*/
				file.getline(buffer, MAX_STRING);
				llwarns << "LLControlGroup::loadFromFile() : Trying to set \"" << name << "\", setting doesn't exist." << llendl;
			}
			continue;
		}

		// Got an item.  Load it up.
		item++;

		// If not declared, assume it's a string
		if (!declared)
		{
			switch(declare_as)
			{
			case TYPE_COL4:
				declareColor4(name, LLColor4::white, LLString::null, NO_PERSIST);
				break;
			case TYPE_COL4U:
				declareColor4U(name, LLColor4U::white, LLString::null, NO_PERSIST);
				break;
			case TYPE_STRING:
			default:
				declareString(name, LLString::null, LLString::null, NO_PERSIST);
				break;
			}
		}

		// Control name has been declared in code.
		LLControlBase *control = getControl(name);

		llassert(control);

		mLoadedSettings.insert(name);
		
		switch(control->mType)
		{
		case TYPE_F32:
			{
				F32 initial;

				file >> initial;

				control->set(initial);
				validitems++;
			}
			break;
		case TYPE_S32:
			{
//.........这里部分代码省略.........
开发者ID:Boy,项目名称:netbook,代码行数:101,代码来源:llcontrol.cpp

示例10: saveToFile

U32 LLControlGroup::saveToFile(const LLString& filename, BOOL nondefault_only)
{
	const char ENDL = '\n';

	llinfos << "Saving settings to file: " << filename << llendl;

	// place the objects in a temporary container that enforces a sort
	// order to ease manual editing of the file
	LLLinkedList< LLControlBase > controls;
	controls.setInsertBefore( &control_insert_before );
	LLString name;
	for (ctrl_name_table_t::iterator iter = mNameTable.begin();
		 iter != mNameTable.end(); iter++)
	{
		name = iter->first;
		if (name.empty())
		{
			CONTROL_ERRS << "Control with no name found!!!" << llendl;
			break;
		}

		LLControlBase* control = (LLControlBase *)iter->second;
		if (!control)
		{
			llwarns << "Tried to save invalid control: " << name << llendl;
		}

		if( control && control->mPersist )
		{
			if (!(nondefault_only && (control->mIsDefault)))
			{
				controls.addDataSorted( control );
			}
			else
			{
				// Debug spam
				// llinfos << "Skipping " << control->getName() << llendl;
			}
		}
	}

	llofstream file;
	file.open(filename.c_str());		/*Flawfinder: ignore*/

	if (!file.is_open())
	{
		// This is a warning because sometime we want to use settings files which can't be written...
		llwarns << "LLControlGroup::saveToFile unable to open file for writing" << llendl;
		return 0;
	}

	// Write file version
	file << "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>\n";
	file << "<settings version = \"" << CURRENT_VERSION << "\">\n";
    for( LLControlBase* control = controls.getFirstData();
		 control != NULL;
		 control = controls.getNextData() )
	{
		file << "\t<!--" << control->comment() << "-->" << ENDL;
		name = control->name();
		switch (control->type())
		{
			case TYPE_U32:
			{
				file << "\t<" << name << " value=\"" << (U32) control->get().asInteger() << "\"/>\n";
				break;
			}
			case TYPE_S32:
			{
				file << "\t<" << name << " value=\"" << (S32) control->get().asInteger() << "\"/>\n";
				break;
			}
			case TYPE_F32:
			{
				file << "\t<" << name << " value=\"" << (F32) control->get().asReal() << "\"/>\n";
				break;
			}
			case TYPE_VEC3:
			{
				LLVector3 vector(control->get());
				file << "\t<" << name << " value=\"" << vector.mV[VX] << " " << vector.mV[VY] << " " << vector.mV[VZ] << "\"/>\n";
				break;
			}
			case TYPE_VEC3D:
			{
				LLVector3d vector(control->get());
				file << "\t<" << name << " value=\"" << vector.mdV[VX] << " " << vector.mdV[VY] << " " << vector.mdV[VZ] << "\"/>\n";
				break;
			}
			case TYPE_RECT:
			{
				LLRect rect(control->get());
				file << "\t<" << name << " value=\"" << rect.mLeft << " " << rect.mBottom << " " << rect.getWidth() << " " << rect.getHeight() << "\"/>\n";
				break;
			}
			case TYPE_COL4:
			{
				LLColor4 color(control->get());
				file << "\t<" << name << " value=\"" << color.mV[VRED] << ", " << color.mV[VGREEN] << ", " << color.mV[VBLUE] << ", " << color.mV[VALPHA] << "\"/>\n";
				break;
//.........这里部分代码省略.........
开发者ID:Boy,项目名称:netbook,代码行数:101,代码来源:llcontrol.cpp

示例11: upload_new_resource

void upload_new_resource(const LLString& src_filename, std::string name,
						 std::string desc, S32 compression_info,
						 LLAssetType::EType destination_folder_type,
						 LLInventoryType::EType inv_type,
						 U32 next_owner_perm,
						 const LLString& display_name,
						 LLAssetStorage::LLStoreAssetCallback callback,
						 void *userdata)
{	
	// Generate the temporary UUID.
	LLString filename = gDirUtilp->getTempFilename();
	LLTransactionID tid;
	LLAssetID uuid;
	
	LLStringBase<char>::format_map_t args;

	LLString ext = src_filename.substr(src_filename.find_last_of('.'));
	LLAssetType::EType asset_type = LLAssetType::AT_NONE;
	char error_message[MAX_STRING];		/* Flawfinder: ignore */	
	error_message[0] = '\0';
	LLString temp_str;

	BOOL error = FALSE;
	
	if (ext.empty())
	{
		LLString::size_type offset = filename.find_last_of(gDirUtilp->getDirDelimiter());
		if (offset != LLString::npos)
			offset++;
		LLString short_name = filename.substr(offset);
		
		// No extension
		snprintf(error_message,		/* Flawfinder: ignore */
				MAX_STRING,
				"No file extension for the file: '%s'\nPlease make sure the file has a correct file extension",
				short_name.c_str());
		args["[FILE]"] = short_name;
 		upload_error(error_message, "NofileExtension", filename, args);
		return;
	}
	else if( LLString::compareInsensitive(ext.c_str(),".bmp") == 0 )
	{
		asset_type = LLAssetType::AT_TEXTURE;
		if (!LLViewerImageList::createUploadFile(src_filename,
												 filename,
												 IMG_CODEC_BMP ))
		{
			snprintf(error_message, MAX_STRING, "Problem with file %s:\n\n%s\n",		/* Flawfinder: ignore */
					src_filename.c_str(), LLImageBase::getLastError().c_str());
			args["[FILE]"] = src_filename;
			args["[ERROR]"] = LLImageBase::getLastError();
			upload_error(error_message, "ProblemWithFile", filename, args);
			return;
		}
	}
	else if( LLString::compareInsensitive(ext.c_str(),".tga") == 0 )
	{
		asset_type = LLAssetType::AT_TEXTURE;
		if (!LLViewerImageList::createUploadFile(src_filename,
												 filename,
												 IMG_CODEC_TGA ))
		{
			snprintf(error_message, MAX_STRING, "Problem with file %s:\n\n%s\n",		/* Flawfinder: ignore */
					src_filename.c_str(), LLImageBase::getLastError().c_str());
			args["[FILE]"] = src_filename;
			args["[ERROR]"] = LLImageBase::getLastError();
			upload_error(error_message, "ProblemWithFile", filename, args);
			return;
		}
	}
	else if( LLString::compareInsensitive(ext.c_str(),".jpg") == 0 || LLString::compareInsensitive(ext.c_str(),".jpeg") == 0)
	{
		asset_type = LLAssetType::AT_TEXTURE;
		if (!LLViewerImageList::createUploadFile(src_filename,
												 filename,
												 IMG_CODEC_JPEG ))
		{
			snprintf(error_message, MAX_STRING, "Problem with file %s:\n\n%s\n",		/* Flawfinder: ignore */
					src_filename.c_str(), LLImageBase::getLastError().c_str());
			args["[FILE]"] = src_filename;
			args["[ERROR]"] = LLImageBase::getLastError();
			upload_error(error_message, "ProblemWithFile", filename, args);
			return;
		}
	}
	else if(LLString::compareInsensitive(ext.c_str(),".wav") == 0)
	{
		asset_type = LLAssetType::AT_SOUND;  // tag it as audio
		S32 encode_result = 0;

		S32 bitrate = 128;

		if (compression_info)
		{
			bitrate = compression_info;
		}
		llinfos << "Attempting to encode wav as an ogg file at " << bitrate << "kbps" << llendl;

		encode_result = encode_vorbis_file_at(src_filename.c_str(), filename.c_str(), bitrate*1000);
		
//.........这里部分代码省略.........
开发者ID:xinyaojiejie,项目名称:Dale,代码行数:101,代码来源:llviewermenufile.cpp

示例12: sizeof


//.........这里部分代码省略.........
		
		// NOTE: we could add -private at the end of this command line to keep the image from showing up in the Finder,
		//		but if our cleanup fails, this makes it much harder for the user to unmount the image.
		LLString mountOutput;
		FILE* mounter = popen("hdiutil attach SecondLife.dmg -mountpoint mnt", "r");		/* Flawfinder: ignore */
		
		if(mounter == NULL)
		{
			llinfos << "Failed to mount disk image, exiting."<< llendl;
			throw 0;
		}
		
		// We need to scan the output from hdiutil to find the device node it uses to attach the disk image.
		// If we don't have this information, we can't detach it later.
		while(mounter != NULL)
		{
			size_t len = fread(temp, 1, sizeof(temp)-1, mounter);
			temp[len] = 0;
			mountOutput.append(temp);
			if(len < sizeof(temp)-1)
			{
				// End of file or error.
				if(pclose(mounter) != 0)
				{
					llinfos << "Failed to mount disk image, exiting."<< llendl;
					throw 0;
				}
				mounter = NULL;
			}
		}
		
		if(!mountOutput.empty())
		{
			const char *s = mountOutput.c_str();
			char *prefix = "/dev/";
			char *sub = strstr(s, prefix);
			
			if(sub != NULL)
			{
				sub += strlen(prefix);	/* Flawfinder: ignore */
				sscanf(sub, "%1023s", deviceNode);	/* Flawfinder: ignore */
			}
		}
		
		if(deviceNode[0] != 0)
		{
			llinfos << "Disk image attached on /dev/" << deviceNode << llendl;
		}
		else
		{
			llinfos << "Disk image device node not found!" << llendl;
		}
		
		// Get an FSRef to the new application on the disk image
		FSRef sourceRef;
		FSRef mountRef;
		snprintf(temp, sizeof(temp), "%s/mnt", tempDir);		

		llinfos << "Disk image mount point is: " << temp << llendl;

		err = FSPathMakeRef((UInt8 *)temp, &mountRef, NULL);
		if(err != noErr)
		{
			llinfos << "Couldn't make FSRef to disk image mount point." << llendl;
			throw 0;
		}
开发者ID:xinyaojiejie,项目名称:Dale,代码行数:67,代码来源:mac_updater.cpp

示例13: llround

LLCheckBoxCtrl::LLCheckBoxCtrl(const LLString& name, const LLRect& rect, 
							    const LLString& label, 
								const LLFontGL* font,
								void (*commit_callback)(LLUICtrl* ctrl, void* userdata),
								void* callback_user_data,
								BOOL initial_value,
								BOOL use_radio_style,
								const LLString& control_which)
:	LLUICtrl(name, rect, TRUE, commit_callback, callback_user_data, FOLLOWS_LEFT | FOLLOWS_TOP),
	mTextEnabledColor( LLUI::sColorsGroup->getColor( "LabelTextColor" ) ),
	mTextDisabledColor( LLUI::sColorsGroup->getColor( "LabelDisabledColor" ) ),
	mRadioStyle( use_radio_style ),
	mInitialValue( initial_value ),
	mSetValue( initial_value )
{
	if (font)
	{
		mFont = font;
	}
	else
	{
		mFont = LLFontGL::sSansSerifSmall;
	}

	// must be big enough to hold all children
	setUseBoundingRect(TRUE);

	mKeyboardFocusOnClick = TRUE;

	// Label (add a little space to make sure text actually renders)
	const S32 FUDGE = 10;
	S32 text_width = mFont->getWidth( label ) + FUDGE;
	S32 text_height = llround(mFont->getLineHeight());
	LLRect label_rect;
	label_rect.setOriginAndSize(
		LLCHECKBOXCTRL_HPAD + LLCHECKBOXCTRL_BTN_SIZE + LLCHECKBOXCTRL_SPACING,
		LLCHECKBOXCTRL_VPAD + 1, // padding to get better alignment
		text_width + LLCHECKBOXCTRL_HPAD,
		text_height );
	mLabel = new LLTextBox( "CheckboxCtrl Label", label_rect, label.c_str(), mFont );
	mLabel->setFollowsLeft();
	mLabel->setFollowsBottom();
	addChild(mLabel);

	// Button
	// Note: button cover the label by extending all the way to the right.
	LLRect btn_rect;
	btn_rect.setOriginAndSize(
		LLCHECKBOXCTRL_HPAD,
		LLCHECKBOXCTRL_VPAD,
		LLCHECKBOXCTRL_BTN_SIZE + LLCHECKBOXCTRL_SPACING + text_width + LLCHECKBOXCTRL_HPAD,
		llmax( text_height, LLCHECKBOXCTRL_BTN_SIZE ) + LLCHECKBOXCTRL_VPAD);
	LLString active_true_id, active_false_id;
	LLString inactive_true_id, inactive_false_id;
	if (mRadioStyle)
	{
		active_true_id = "UIImgRadioActiveSelectedUUID";
		active_false_id = "UIImgRadioActiveUUID";
		inactive_true_id = "UIImgRadioInactiveSelectedUUID";
		inactive_false_id = "UIImgRadioInactiveUUID";
		mButton = new LLButton(
			"Radio control button", btn_rect,
			active_false_id, active_true_id, control_which,
			&LLCheckBoxCtrl::onButtonPress, this, LLFontGL::sSansSerif ); 
		mButton->setDisabledImages( inactive_false_id, inactive_true_id );
		mButton->setHoverGlowStrength(0.35f);
	}
	else
	{
		active_false_id = "UIImgCheckboxActiveUUID";
		active_true_id = "UIImgCheckboxActiveSelectedUUID";
		inactive_true_id = "UIImgCheckboxInactiveSelectedUUID";
		inactive_false_id = "UIImgCheckboxInactiveUUID";
		mButton = new LLButton(
			"Checkbox control button", btn_rect,
			active_false_id, active_true_id, control_which,
			&LLCheckBoxCtrl::onButtonPress, this, LLFontGL::sSansSerif ); 
		mButton->setDisabledImages( inactive_false_id, inactive_true_id );
		mButton->setHoverGlowStrength(0.35f);
	}
	mButton->setIsToggle(TRUE);
	mButton->setToggleState( initial_value );
	mButton->setFollowsLeft();
	mButton->setFollowsBottom();
	mButton->setCommitOnReturn(FALSE);
	addChild(mButton);
}
开发者ID:Boy,项目名称:netbook,代码行数:87,代码来源:llcheckboxctrl.cpp

示例14: label_rect

LLSpinCtrl::LLSpinCtrl(	const LLString& name, const LLRect& rect, const LLString& label, const LLFontGL* font,
	void (*commit_callback)(LLUICtrl*, void*),
	void* callback_user_data,
	F32 initial_value, F32 min_value, F32 max_value, F32 increment,
	const LLString& control_name,
	S32 label_width)
	:
	LLUICtrl(name, rect, TRUE, commit_callback, callback_user_data, FOLLOWS_LEFT | FOLLOWS_TOP ),
	mValue( initial_value ),
	mInitialValue( initial_value ),
	mMaxValue( max_value ),
	mMinValue( min_value ),
	mIncrement( increment ),
	mPrecision( 3 ),
	mLabelBox( NULL ),
	mTextEnabledColor( LLUI::sColorsGroup->getColor( "LabelTextColor" ) ),
	mTextDisabledColor( LLUI::sColorsGroup->getColor( "LabelDisabledColor" ) ),
	mbHasBeenSet( FALSE )
{
	S32 top = mRect.getHeight();
	S32 bottom = top - 2 * SPINCTRL_BTN_HEIGHT;
	S32 centered_top = top;
	S32 centered_bottom = bottom;
	S32 btn_left = 0;

	// Label
	if( !label.empty() )
	{
		LLRect label_rect( 0, centered_top, label_width, centered_bottom );
		mLabelBox = new LLTextBox( "SpinCtrl Label", label_rect, label.c_str(), font );
		addChild(mLabelBox);

		btn_left += label_rect.mRight + SPINCTRL_SPACING;
	}

	S32 btn_right = btn_left + SPINCTRL_BTN_WIDTH;
	
	// Spin buttons
	LLRect up_rect( btn_left, top, btn_right, top - SPINCTRL_BTN_HEIGHT );
	LLString out_id = "UIImgBtnSpinUpOutUUID";
	LLString in_id = "UIImgBtnSpinUpInUUID";
	mUpBtn = new LLButton(
		"SpinCtrl Up", up_rect,
		out_id,
		in_id,
		"",
		&LLSpinCtrl::onUpBtn, this, LLFontGL::sSansSerif );
	mUpBtn->setFollowsLeft();
	mUpBtn->setFollowsBottom();
	mUpBtn->setHeldDownCallback( &LLSpinCtrl::onUpBtn );
	mUpBtn->setTabStop(FALSE);
	addChild(mUpBtn);

	LLRect down_rect( btn_left, top - SPINCTRL_BTN_HEIGHT, btn_right, bottom );
	out_id = "UIImgBtnSpinDownOutUUID";
	in_id = "UIImgBtnSpinDownInUUID";
	mDownBtn = new LLButton(
		"SpinCtrl Down", down_rect,
		out_id,
		in_id,
		"",
		&LLSpinCtrl::onDownBtn, this, LLFontGL::sSansSerif );
	mDownBtn->setFollowsLeft();
	mDownBtn->setFollowsBottom();
	mDownBtn->setHeldDownCallback( &LLSpinCtrl::onDownBtn );
	mDownBtn->setTabStop(FALSE);
	addChild(mDownBtn);

	LLRect editor_rect( btn_right + 1, centered_top, mRect.getWidth(), centered_bottom );
	mEditor = new LLLineEditor( "SpinCtrl Editor", editor_rect, "",	font,
		MAX_STRING_LENGTH,
		&LLSpinCtrl::onEditorCommit, NULL, NULL, this,
		&LLLineEditor::prevalidateFloat );
	mEditor->setFollowsLeft();
	mEditor->setFollowsBottom();
	mEditor->setFocusReceivedCallback( &LLSpinCtrl::onEditorGainFocus );
	//RN: this seems to be a BAD IDEA, as it makes the editor behavior different when it has focus
	// than when it doesn't.  Instead, if you always have to double click to select all the text, 
	// it's easier to understand
	//mEditor->setSelectAllonFocusReceived(TRUE);
	mEditor->setIgnoreTab(TRUE);
	addChild(mEditor);

	updateEditor();
	setSpanChildren( TRUE );
}
开发者ID:xinyaojiejie,项目名称:Dale,代码行数:86,代码来源:llspinctrl.cpp

示例15: getURLToFile

// blocking asset fetch which bypasses the VFS
// this is a very limited function for use by the simstate loader and other one-offs
S32 LLHTTPAssetStorage::getURLToFile(const LLUUID& uuid, LLAssetType::EType asset_type, const LLString &url, const char *filename, progress_callback callback, void *userdata)
{
	// *NOTE: There is no guarantee that the uuid and the asset_type match
	// - not that it matters. - Doug
	lldebugs << "LLHTTPAssetStorage::getURLToFile() - " << url << llendl;

	FILE *fp = LLFile::fopen(filename, "wb"); /*Flawfinder: ignore*/
	if (! fp)
	{
		llwarns << "Failed to open " << filename << " for writing" << llendl;
		return LL_ERR_ASSET_REQUEST_FAILED;
	}

	// make sure we use the normal curl setup, even though we don't really need a request object
	LLHTTPAssetRequest req(this, uuid, asset_type, RT_DOWNLOAD, url.c_str(), mCurlMultiHandle);
	req.mFP = fp;
	
	req.setupCurlHandle();
	curl_easy_setopt(req.mCurlHandle, CURLOPT_FOLLOWLOCATION, TRUE);
	curl_easy_setopt(req.mCurlHandle, CURLOPT_WRITEFUNCTION, &curlFileDownCallback);
	curl_easy_setopt(req.mCurlHandle, CURLOPT_WRITEDATA, req.mCurlHandle);

	curl_multi_add_handle(mCurlMultiHandle, req.mCurlHandle);
	llinfos << "Requesting as file " << req.mURLBuffer << llendl;

	// braindead curl loop
	int queue_length;
	CURLMsg *curl_msg;
	LLTimer timeout;
	timeout.setTimerExpirySec(GET_URL_TO_FILE_TIMEOUT);
	bool success = false;
	S32 xfer_result = 0;
	do
	{
		curl_multi_perform(mCurlMultiHandle, &queue_length);
		curl_msg = curl_multi_info_read(mCurlMultiHandle, &queue_length);

		if (callback)
		{
			callback(userdata);
		}

		if ( curl_msg && (CURLMSG_DONE == curl_msg->msg) )
		{
			success = true;
		}
		else if (timeout.hasExpired())
		{
			llwarns << "Request for " << url << " has timed out." << llendl;
			success = false;
			xfer_result = LL_ERR_ASSET_REQUEST_FAILED;
			break;
		}
	} while (!success);

	if (success)
	{
		long curl_result = 0;
		curl_easy_getinfo(curl_msg->easy_handle, CURLINFO_HTTP_CODE, &curl_result);
		
		if (curl_result == HTTP_OK && curl_msg->data.result == CURLE_OK)
		{
			S32 size = ftell(req.mFP);
			if (size > 0)
			{
				// everything seems to be in order
				llinfos << "Success downloading " << req.mURLBuffer << " to file, size " << size << llendl;
			}
			else
			{
				llwarns << "Found " << req.mURLBuffer << " to be zero size" << llendl;
				xfer_result = LL_ERR_ASSET_REQUEST_FAILED;
			}
		}
		else
		{
			xfer_result = curl_result == HTTP_MISSING ? LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE : LL_ERR_ASSET_REQUEST_FAILED;
			llinfos << "Failure downloading " << req.mURLBuffer << 
				" with result " << curl_easy_strerror(curl_msg->data.result) << ", http result " << curl_result << llendl;
		}
	}

	fclose(fp);
	if (xfer_result)
	{
		LLFile::remove(filename);
	}
	return xfer_result;
}
开发者ID:xinyaojiejie,项目名称:Dale,代码行数:91,代码来源:llhttpassetstorage.cpp


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