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


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

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


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

示例1: ShowError

void CIwGameXmlParser::ShowError(eXMLParserError error, int pos) const
{
#ifdef SHOW_ERRORS
	s3eDebugOutputString(GetErrorString(error));
	s3eDebugOutputString(" at line ");
	CIwGameString num = CIwGameString(m_pDataInput->GetLineNumber(pos));
	s3eDebugOutputString(num.c_str());
#endif
}
开发者ID:marcodeltutto,项目名称:Collider,代码行数:9,代码来源:IwGameXml.cpp

示例2: UpdateAttribute

void CIwGameXmlNode::UpdateAttribute(CIwGameString& name, const char* value)
{
	CIwGameXmlAttribute* old_attribute = GetAttribute(name.c_str());

	if (old_attribute == NULL)
	{
		// Attribute was not present so add
		CIwGameXmlAttribute* attribute = CIwGameXmlParser::AllocAttribute();
		attribute->setName((char*)name.c_str(), name.GetLength());
		attribute->setValue((char*)value, strlen(value));
		Attributes.push_back(attribute);
	}
	else
	{
		// Attribute was present so update it
		old_attribute->setName((char*)name.c_str(), name.GetLength());
		old_attribute->setValue((char*)value, strlen(value));
	}
}
开发者ID:marcodeltutto,项目名称:Collider,代码行数:19,代码来源:IwGameXml.cpp

示例3: IwHashString

CIwGameString::CIwGameString(const CIwGameString &string)
{
	FindIndex = 0;
	Data = NULL;
	AutoHash = true;
	if (string.c_str() == NULL)
	{
		Length = 0;
		Size = 0;
	}
	else
	{
		int len = (int)strlen(string.c_str());
		allocString(len);
		Length = len;
		strcpy(Data, string.c_str());

		if (AutoHash)
			DataHash = IwHashString(Data);
	}
}
开发者ID:agramonte,项目名称:IwGameAds,代码行数:21,代码来源:IwGameString.cpp

示例4: Execute

//
// 
// 
//
// CIwGameCommandIfVar Implementation
// 
// 
// 
//
bool CIwGameCommandIfVar::Execute(float dt)
{
	if (!IIwGameCommandExecutor::Execute(dt))
		return false;

	CIwGame* game = NULL;
	CIwGameScene* scene = NULL;
	CIwGameActor* actor = NULL;
	unsigned int class_hash = Program->getManager()->getParent()->getClassTypeHash();
	if (class_hash == CIwGameXomlNames::Game_Hash)
		game = (CIwGame*)Program->getManager()->getParent();
	else
	if (class_hash == CIwGameXomlNames::Scene_Hash)
		scene = (CIwGameScene*)Program->getManager()->getParent();

	if (game != NULL)
		scene = game->findScene(Params[3].getHash());

	IIwGameXomlResource* cont = (actor != NULL) ? (IIwGameXomlResource*)actor : (IIwGameXomlResource*)scene;
	CIwGameXomlVariable* var = CIwGameXomlVariable::GetVariable(Params[0], scene);
	if (var != NULL)
	{
		CIwGameString op = getParameter2(cont);
		op.ToLower();
		if (op == "==")
			ReturnValue = (int)var->checkCondition(CO_Equal, getParameter3(cont));
		else
		if (op == "!=")
			ReturnValue = (int)var->checkCondition(CO_NotEqual, getParameter3(cont));
		else
		if (op == "gt")
			ReturnValue = (int)var->checkCondition(CO_Greater, getParameter3(cont));
		else
		if (op == "lt")
			ReturnValue = (int)var->checkCondition(CO_Less, getParameter3(cont));
		else
		if (op == "gte")
			ReturnValue = (int)var->checkCondition(CO_GreaterEqual, getParameter3(cont));
		else
		if (op == "lte")
			ReturnValue = (int)var->checkCondition(CO_LessEqual, getParameter3(cont));
		else
		if (op == "and")
			ReturnValue = (int)var->checkCondition(CO_And, getParameter3(cont));
		else
			CIwGameError::LogError("Warning: IfVar command - operator invalid - ", op.c_str());
	}
	else
		CIwGameError::LogError("Warning: IfVar command - variable not found - ", Params[0].c_str());

	return false;
}
开发者ID:marcodeltutto,项目名称:Collider,代码行数:61,代码来源:IwGameProgram.cpp

示例5: InitView

bool CIwGameUITextView::InitView(bool native_res, float min_scale, float max_scale)
{
	TextActor->setTappable(false);
#if defined(_DEBUG)
	CIwGameString name = Name;
	name += "text";
	TextActor->setName(name.c_str());
#endif	// _DEBUG

	Area = TextActor->getSize();

	MinZoom = min_scale;
	MaxZoom = max_scale;

	return true;
}
开发者ID:marcodeltutto,项目名称:Collider,代码行数:16,代码来源:IwGameUITextView.cpp

示例6:

bool CIwGameString::operator==	(const CIwGameString &op)
{
	if (Data == NULL)
		return false;

	if (AutoHash && op.isAutohash())
	{
		if (DataHash == op.getHash())
			return true;
	}
	else
	{
		if (strcmp(op.c_str(), Data) == 0)
			return true;
	}
	return false;
}
开发者ID:agramonte,项目名称:IwGameAds,代码行数:17,代码来源:IwGameString.cpp

示例7: RequestAdMobFox

//
//
//
//	MobFox specific implementation
//
//
//
bool CIwGameAds::RequestAdMobFox()
{
	// Build request URI string
	RequestURI = "http://my.mobfox.com/request.php";

	CIwGameString body;
	CIwGameString urlencoded;

	body = "rt=api";
	body += "&u=";
	urlencoded.URLEncode(UserAgent.c_str());
	body += urlencoded;
	body += "&i=";
	body += IW_GAME_HTTP_MANAGER->getIPAddress();
	body += "&o=";
	body += CIwGameString(UDID);
	body += "&m=live";
	body += "&s=";
	body += ApplicationID;
	if (!ExtraInfo.IsEmpty())
	{
		body += ExtraInfo;
	}

	AdRequest.setPOST();
	AdRequest.setURI(RequestURI.c_str());
	AdRequest.setContentAvailableCallback(&AdInfoRetrievedCallback, NULL);
	AdRequest.SetHeader("User-Agent", UserAgent.c_str());
	AdRequest.SetHeader("Content-Type", "application/x-www-form-urlencoded");
	AdRequest.SetHeader("Content-Length", CIwGameString(body.GetLength()).c_str());
	AdRequest.setBody(body.c_str());
	IW_GAME_HTTP_MANAGER->AddRequest(&AdRequest);
	BusyTimer.setDuration(IW_GAME_ADS_TIMEOUT);

	return true;
}
开发者ID:agramonte,项目名称:IwGameAds,代码行数:43,代码来源:IwGameAds.cpp

示例8: LoadFromXoml

bool CIwGameImage::LoadFromXoml(IIwGameXomlResource* parent, bool load_children, CIwGameXmlNode* node)
{
	// Process image attributes
	CIwGameString* name = NULL;
	CIwGameString* location = NULL;
	bool preload = true;
	bool blocking = false;
	CIwGameString* condition = NULL;

	CIwGameScene* scene = NULL;
	if (parent != NULL && parent->getClassTypeHash() == CIwGameXomlNames::Actor_Hash)
		scene = ((CIwGameActor*)parent)->getScene();
	else
	if (parent != NULL && parent->getClassTypeHash() == CIwGameXomlNames::Scene_Hash)
		scene = (CIwGameScene*)parent;

	for (CIwGameXmlNode::_AttribIterator it = node->attribs_begin(); it != node->attribs_end(); it++)
	{
		unsigned int name_hash = (*it)->getName().getHash();

		if (name_hash == CIwGameXomlNames::Name_Hash)
		{
			name = &(*it)->GetValue();
			setName(name->c_str());
		}
		else
		if (name_hash == CIwGameXomlNames::Tag_Hash)
			setTag((*it)->GetValue().c_str());
		else
		if (name_hash == CIwGameXomlNames::Location_Hash)
			location = &(*it)->GetValue();
		else
 		if (name_hash == CIwGameXomlNames::Preload_Hash)
			preload = (*it)->GetValueAsBool();
		else
 		if (name_hash == CIwGameXomlNames::Blocking_Hash)
			blocking = (*it)->GetValueAsBool();
		else
		if (name_hash == CIwGameXomlNames::Condition_Hash)
			condition = &(*it)->GetValue();
		else
		if (name_hash == CIwGameXomlNames::Format_Hash)
		{
			FormatSet = true;
			unsigned int format_hash = (*it)->GetValue().getHash();
			if (format_hash == IW_GAME_HASH("RGB_565"))
				Format = CIwImage::RGB_565;
			else
			if (format_hash == IW_GAME_HASH("RGBA_4444"))
				Format = CIwImage::RGBA_4444;
			else
			if (format_hash == IW_GAME_HASH("RGBA_5551"))
				Format = CIwImage::RGBA_5551;
			else
			if (format_hash == IW_GAME_HASH("RGB_888"))
				Format = CIwImage::RGB_888;
			else
			if (format_hash == IW_GAME_HASH("RGBA_6666"))
				Format = CIwImage::RGBA_6666;
			else
			if (format_hash == IW_GAME_HASH("RGB_332"))
				Format = CIwImage::RGB_332;
			else
			if (format_hash == IW_GAME_HASH("RGBA_8888"))
				Format = CIwImage::RGBA_8888;
			else
			{
				FormatSet = false;
				CIwGameError::LogError("Warning: Invalid texture format set - ", (*it)->GetValue().c_str());
			}
		}
		else
 		if (name_hash == CIwGameXomlNames::Filter_Hash)
			setFilter((*it)->GetValueAsBool());
	}

	if (location == NULL || name == NULL)
		CIwGameError::LogError("Warning: An Image requires a location and a name to be specified");

	if (condition != NULL)
	{
		// Find the condition variable
		bool condition_not = false;
		CIwGameXomlVariable* var = NULL;
		if (*(condition->c_str()) == '!')
		{
			condition_not = true;
			CIwGameString cond = condition->c_str() + 1;
			var = CIwGameXomlVariable::GetVariable(cond, scene);
		}
		else
			var = CIwGameXomlVariable::GetVariable(*condition, scene);
		if (var != NULL)
		{
			bool res = var->isTrue();
			if (condition_not)
				res = !res;
			if (!res)
			{
				IW_GAME_XOML->setExitOnError(false);
//.........这里部分代码省略.........
开发者ID:marcodeltutto,项目名称:Collider,代码行数:101,代码来源:IwGameImage.cpp

示例9: LoadFromXoml

bool IIwGameBrush::LoadFromXoml(IIwGameXomlResource* parent, bool load_children, CIwGameXmlNode* node)
{
	// Get brush data
	eIwGameBrushType	type = BT_Solid;
	CIwFVec4			colour;
	CIwGameString*		name = NULL;
	CIwGameString*		image_name = NULL;
	CIwRect				rect = CIwRect(0, 0, 0, 0);
	CIwRect				scale_area = CIwRect(0, 0, 0, 0);
	CIwGameString*		condition = NULL;

	CIwGameScene* scene = NULL;
	if (parent != NULL && parent->getClassTypeHash() == CIwGameXomlNames::Actor_Hash)
		scene = ((CIwGameActor*)parent)->getScene();
	else
	if (parent != NULL && parent->getClassTypeHash() == CIwGameXomlNames::Scene_Hash)
		scene = (CIwGameScene*)parent;

	for (CIwGameXmlNode::_AttribIterator it = node->attribs_begin(); it != node->attribs_end(); ++it)
	{
		unsigned int attrib_hash = (*it)->getName().getHash();

		if (attrib_hash == CIwGameXomlNames::Name_Hash)
		{
			name = &(*it)->GetValue();
		}
		else
		if (attrib_hash == CIwGameXomlNames::Type_Hash)
		{
			unsigned int type_hash = (*it)->GetValue().getHash();
			if (type_hash == CIwGameXomlNames::Solid_Hash)
				type = BT_Solid;
			else
			if (type_hash == CIwGameXomlNames::Gradient_Hash)
				type = BT_Gradient;
			else
			if (type_hash == CIwGameXomlNames::Image_Hash)
				type = BT_Image;
			else
			if (type_hash == CIwGameXomlNames::Patch9_Hash)
				type = BT_9Patch;
			else
			{
				CIwGameError::LogError("Error: XOML - Invalid brush type - ", (*it)->GetValue().c_str());
				return false;
			}
		}
		else
		if (attrib_hash == CIwGameXomlNames::Colour_Hash)
		{
			if (!(*it)->GetValueAsPoint4(colour))
				CIwGameError::LogError("Warning: XOML - Brush Colour should be a vec4");
		}
		else
		if (attrib_hash == CIwGameXomlNames::Image_Hash)
		{
			image_name = &(*it)->GetValue();
			type = BT_Image;
		}
		else
		if (attrib_hash == CIwGameXomlNames::SrcRect_Hash)
		{
			if (!(*it)->GetValueAsRect(rect))
				CIwGameError::LogError("Warning: XOML - Brush SrcRect should be a rect");
		}
		else
		if (attrib_hash == CIwGameXomlNames::Tag_Hash)
		{
			setTag((*it)->GetValue().c_str());
		}
		else
		if (attrib_hash == CIwGameXomlNames::ScaleArea_Hash)
		{
			if (!(*it)->GetValueAsRect(scale_area))
				CIwGameError::LogError("Warning: XOML - Brush ScaleArea should be a rect");
		}
		else
		if (attrib_hash == CIwGameXomlNames::Condition_Hash)
		{
			condition = &(*it)->GetValue();
		}
	}

	if (condition != NULL)
	{
		// Find the condition variable
		bool condition_not = false;
		CIwGameXomlVariable* var = NULL;
		if (*(condition->c_str()) == '!')
		{
			condition_not = true;
			CIwGameString cond = condition->c_str() + 1;
			var = CIwGameXomlVariable::GetVariable(cond, scene);
		}
		else
			var = CIwGameXomlVariable::GetVariable(*condition, scene);
		if (var != NULL)
		{
			bool res = var->isTrue();
			if (condition_not)
//.........这里部分代码省略.........
开发者ID:marcodeltutto,项目名称:Collider,代码行数:101,代码来源:IwGameBrush.cpp

示例10: RequestAdInMobi

//
//
//
//	ImMobi specific implementation
//
//
//
bool CIwGameAds::RequestAdInMobi()
{
	// Build M2M request URI string
	RequestURI = "http://w.inmobi.com/showad.asm";				// Live
//	RequestURI = "http://i.w.sandbox.inmobi.com/showad.asm";	// Test
    
    int slotSize = (int)SlotSize;

	CIwGameString body;
	CIwGameString urlencoded;

	body = "mk-siteid=";
	body += ApplicationID;
	body += "&mk-carrier=";
	body += IW_GAME_HTTP_MANAGER->getIPAddress();
	body += "&h-user-agent=";
	urlencoded.URLEncode(UserAgent.c_str());
	urlencoded.ToLower();
	body += urlencoded;
	body += "&u-id=";
	body += CIwGameString(UDID);
	body += "&d-localization=";
	urlencoded.URLEncode(s3eDeviceGetString(S3E_DEVICE_LOCALE));
	urlencoded.ToLower();
	body += urlencoded;
//	body += "&d-netType=wifi";
	body += "&d-netType=carrier";
    body += "&mk-ad-slot=";
    body += CIwGameString(slotSize);
	body += "&mk-version=pr-SPEC-CTATA-20130111";
	if (UserAge != 0)
	{
		body += "&u-age=";
		body += CIwGameString(UserAge);
	}
	if (UserGender != GenderInvalid)
	{
		if (UserGender == GenderFemale)
			body += "&u-gender=f";
		else
			body += "&u-gender=m";
	}
	if (!UserGPSLocation.IsEmpty())
	{
		body += "&u-latlong=";
		body += UserGPSLocation;
	}
	if (!UserKeywords.IsEmpty())
	{
		body += "&u-interests=";
		body += UserKeywords;
	}
	if (!ExtraInfo.IsEmpty())
	{
		body += ExtraInfo;
	}
//	body.ToLower();

	AdRequest.setPOST();
	AdRequest.setURI(RequestURI.c_str());
	AdRequest.setContentAvailableCallback(&AdInfoRetrievedCallback, NULL);
	AdRequest.SetHeader("User-Agent", UserAgent.c_str());
	AdRequest.SetHeader("X-Mkhoj-SiteID", ApplicationID.c_str());
	AdRequest.SetHeader("Content-Type", "application/x-www-form-urlencoded");
	AdRequest.SetHeader("Content-Length", CIwGameString(body.GetLength()).c_str());
	AdRequest.setBody(body.c_str());
	IW_GAME_HTTP_MANAGER->AddRequest(&AdRequest);
	BusyTimer.setDuration(IW_GAME_ADS_TIMEOUT);

	return true;
}
开发者ID:agramonte,项目名称:IwGameAds,代码行数:78,代码来源:IwGameAds.cpp

示例11: RequestAdMadvertise

bool CIwGameAds::RequestAdMadvertise()
{
	// Build M2M request URI string
	RequestURI = "http://ad.madvertise.de/site/";
	RequestURI += ApplicationID;

	CIwGameString body;
	CIwGameString urlencoded;

	body += "ua=";
	urlencoded.URLEncode(UserAgent.c_str());
	body += urlencoded;
//	body += "&ip=";
//	body += IW_GAME_HTTP_MANAGER->getIPAddress();
	body += "&requester=madvertise_api";
	body += "&version=api_2.1";
	body += "&unique_device_id=";
	body += CIwGameString(UDID);
	if (!ExtraInfo.IsEmpty())
	{
		body += ExtraInfo;
	}

/*	CIwGameString local = s3eDeviceGetString(S3E_DEVICE_LOCALE);
	int pos = local.Contains('_');
	if (pos >= 0)
	{
		// Strip language and underscore
		local.setString(local.c_str() + pos + 1, 2);
		local.ToUpper();
		body += "&country=";
		body += local;
	}*/

	if (UserAge != 0)
	{
		body += "&age=";
		body += CIwGameString(UserAge);
	}
	if (UserGender != GenderInvalid)
	{
		if (UserGender == GenderFemale)
			body += "&gender=F";
		else
			body += "&gender=M";
	}
	if (!UserKeywords.IsEmpty())
	{
		body += "&keywords=";
		body += UserKeywords;
	}

	AdRequest.setPOST();
	AdRequest.setURI(RequestURI.c_str());
	AdRequest.setContentAvailableCallback(&AdInfoRetrievedCallback, NULL);
	AdRequest.SetHeader("User-Agent", UserAgent.c_str());
	AdRequest.SetHeader("Accept", "application/xml");
	AdRequest.SetHeader("Content-Type", "application/x-www-form-urlencoded");
	AdRequest.SetHeader("Content-Length", CIwGameString(body.GetLength()).c_str());
	AdRequest.setBody(body.c_str());
	IW_GAME_HTTP_MANAGER->AddRequest(&AdRequest);
	BusyTimer.setDuration(IW_GAME_ADS_TIMEOUT);

	return true;
}
开发者ID:agramonte,项目名称:IwGameAds,代码行数:65,代码来源:IwGameAds.cpp

示例12: Copy

void CIwGameString::Copy(CIwGameString& string)
{
	Copy((char *)string.c_str(), 0, string.GetLength());
}
开发者ID:agramonte,项目名称:IwGameAds,代码行数:4,代码来源:IwGameString.cpp

示例13: LoadFromXoml

bool CIwGameModifierManager::LoadFromXoml(IIwGameXomlResource* parent, bool load_children, CIwGameXmlNode* node)
{
	if (parent->getClassTypeHash() != CIwGameXomlNames::Actor_Hash && parent->getClassTypeHash() != CIwGameXomlNames::Scene_Hash)
	{
		CIwGameError::LogError("Error: XOML - Modifiers list needs to be declared inside an actor or scene");
		return false;
	}
	
	if (parent->getClassTypeHash() == CIwGameXomlNames::Actor_Hash)
	{
		CIwGameActor* actor = (CIwGameActor*)parent;
		actor->setModifiers(this);
	}
	else
	if (parent->getClassTypeHash() == CIwGameXomlNames::Scene_Hash)
	{
		CIwGameScene* scene = (CIwGameScene*)parent;
		scene->setModifiers(this);
	}

	// Process modifiers list attributes
	for (CIwGameXmlNode::_AttribIterator it = node->attribs_begin(); it != node->attribs_end(); it++)
	{
		unsigned int name_hash = (*it)->getName().getHash();

		if (name_hash == CIwGameXomlNames::Name_Hash)
		{
			setName((*it)->GetValue().c_str());
		}
	}

	// Prrocess modifiers
	for (CIwGameXmlNode::_Iterator it2 = node->begin(); it2 != node->end(); ++it2)
	{
		unsigned int name_hash = (*it2)->GetName().getHash();
		if (name_hash == CIwGameXomlNames::Modifier_Hash)
		{
			CIwGameString	name;
			CIwGameString	params[4];
			bool			active = true;

			for (CIwGameXmlNode::_AttribIterator it = (*it2)->attribs_begin(); it != (*it2)->attribs_end(); ++it)
			{
				unsigned int attrib_hash = (*it)->getName().getHash();

				if (attrib_hash == CIwGameXomlNames::Name_Hash)
					name = (*it)->GetValue();
				else
				if (attrib_hash == CIwGameXomlNames::Active_Hash)
					active = (*it)->GetValueAsBool();
				else
				if (attrib_hash == CIwGameXomlNames::Param1_Hash)
					params[0] = (*it)->GetValue();
				else
				if (attrib_hash == CIwGameXomlNames::Param2_Hash)
					params[1] = (*it)->GetValue();
				else
				if (attrib_hash == CIwGameXomlNames::Param3_Hash)
					params[2] = (*it)->GetValue();
				else
				if (attrib_hash == CIwGameXomlNames::Param4_Hash)
					params[3] = (*it)->GetValue();
			}

			// Find the modifiers creator
			IIwGameModifierCreator* creator = IW_GAME_MODS->findCreator(name.getHash());
			if (creator != NULL)
			{
				IIwGameModifier* mod = creator->CreateInstance();
				if (mod != NULL)
				{
					mod->setName(name.c_str());
					mod->setActive(active);
					for (int t = 0; t < 4; t++)
						mod->setParameter(t, params[t]);
					addModifier(mod);
				}
			}
			else
				CIwGameError::LogError("Warning: XOML - Modifier not found - ", name.c_str());

		}
	}

	return true;
}
开发者ID:marcodeltutto,项目名称:Collider,代码行数:86,代码来源:IwGameModifier.cpp


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