• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ mautil::String类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中mautil::String的典型用法代码示例。如果您正苦于以下问题:C++ String类的具体用法?C++ String怎么用?C++ String使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: eval

/**
 * Evaluate a Lua script.
 * @param script String with Lua code.
 * @return Non-zero if successful, zero on error.
 */
int LuaEngine::eval(const char* script)
{
	lua_State* L = (lua_State*) mLuaState;

	// Evaluate Lua script.
	int result = luaL_dostring(L, script);

	// Was there an error?
	if (0 != result)
	{
		MAUtil::String errorMessage;

    	if (lua_isstring(L, -1))
    	{
    		errorMessage = lua_tostring(L, -1);

            // Pop the error message.
        	lua_pop(L, 1);
    	}
    	else
    	{
    		errorMessage =
    			"There was a Lua error condition, but no error message.";
    	}

        lprintfln("Lua Error: %s\n", errorMessage.c_str());

    	// Print size of Lua stack (debug info).
    	lprintfln("Lua stack size: %i\n", lua_gettop(L));

    	reportLuaError(errorMessage.c_str());
	}

	return result == 0;
}
开发者ID:MoSyncLabs,项目名称:mobilelua,代码行数:40,代码来源:LuaEngine.cpp


示例2: UnescapeHelper

/**
 * Helper function that unescapes a string.
 */
static MAUtil::String UnescapeHelper(const MAUtil::String& str)
{
	// The decoded string.
	MAUtil::String result = "";

	for (int i = 0; i < str.length(); ++i)
	{
		// If the current character is the '%' escape char...
		if ('%' == (char) str[i])
		{
			// Get the char value of the two digit hex value.
			MAUtil::String hex = str.substr(i + 1, 2);
			long charValue = strtol(
				hex.c_str(),
				NULL,
				16);
			// Append to result.
			result += (char) charValue;

			// Skip over the hex chars.
			i += 2;
		}
		else
		{
			// Not encoded, just copy the character.
			result += str[i];
		}
	}

	return result;
}
开发者ID:donggx,项目名称:mobilelua,代码行数:34,代码来源:LuaEngine.cpp


示例3: isPlayingSound

    /**
     * Check if the local notification is playing sound.
     * @return True if the local notification is playing sound when it's
     * shown, false otherwise.
     */
    bool LocalNotification::isPlayingSound() const
    {
        MAUtil::String value =
            this->getPropertyString(MA_NOTIFICATION_LOCAL_PLAY_SOUND);

        return (0 == strcmp(value.c_str(), "true")) ? true : false;
    }
开发者ID:novales35,项目名称:MoSync,代码行数:12,代码来源:LocalNotification.cpp


示例4: isReorderControlShown

	/**
	 * Check if the reorder control is shown.
	 * The reordering control is gray, multiple horizontal bar control
	 * on the right side of the cell.
	 * Platform: iOS.
	 * @return true if it's shown, false otherwise.
	 */
	bool SegmentedListViewItem::isReorderControlShown()
	{
		MAUtil::String value = this->getPropertyString(
			MAW_SEGMENTED_LIST_VIEW_ITEM_SHOW_REORDER_CONTROL);
		bool returnValue = (strcmp(value.c_str(), "true")) ? false : true;
		return returnValue;
	}
开发者ID:,项目名称:,代码行数:14,代码来源:


示例5: tryToRead

// Reads a log file from a s60v3 debug runtime.
static bool tryToRead() {
	MAUtil::String filename = "C:/Data/msrlogold.txt";
	printf("Open '%s'\n", filename.c_str());
	MAHandle file = maFileOpen(filename.c_str(), MA_ACCESS_READ);
	if(file < 0) {
		printf("Error %i\n", file);
		return false;
	}
	int res = maFileExists(file);
	MAASSERT(res >= 0);
	if(!res) {
		printf("File does not exist.\n");
		return false;
	}
	int size = maFileSize(file);
	printf("Size: %i\n", size);
	MAASSERT(size >= 0);
	static char data[32*1024];
	MAASSERT(size < (int)sizeof(data));
	res = maFileRead(file, data, size);
	MAASSERT(res == 0);
	data[32] = 0;
	printf("%s\n", data);
	printf("Closing...\n");
	res = maFileClose(file);
	MAASSERT(res == 0);
	printf("Done.\n");
	return true;
}
开发者ID:Felard,项目名称:MoSync,代码行数:30,代码来源:main.cpp


示例6: customEvent

	/**
	* This function is called when an event that Moblet doesn't recognize is recieved.
	*/
	void TestMoblet::customEvent(const MAEvent& event)
	{
		if ( event.type == EVENT_TYPE_ALERT)
		{
//			printf("\n =========== Alert Event received ======\n");
			MAUtil::String temp = "";
			switch( event.alertButtonIndex)
			{
			case 1:
				temp += "First ";
				break;
			case 2:
				temp += "Second ";
				break;
			case 3:
				temp += "Third ";
				break;
			default:
				temp = "err";
			}
			temp += " button was clicked";
//			maMessageBox("Alert Event received", temp.c_str());
			printf(temp.c_str());
			printf("\n ------------- This was all ------------- \n");
		}

	}
开发者ID:AliSayed,项目名称:MoSync,代码行数:30,代码来源:Main.cpp


示例7: isShowingDeleteConfirmation

	/**
	 * Check if the item is currently showing the delete-confirmation button.
	 * When users tap the deletion control (the red circle to the left of
	 * the cell), the cell displays a "Delete" button on the right side of
	 * the cell.
	 * Platform: iOS.
	 * @return True if it's showing the delete confirmation button, false
	 * otherwise.
	 */
	bool SegmentedListViewItem::isShowingDeleteConfirmation()
	{
		MAUtil::String value = this->getPropertyString(
			MAW_SEGMENTED_LIST_VIEW_ITEM_IS_SHOWING_DELETE_CONFIRMATION);
		bool returnValue = (strcmp(value.c_str(), "true")) ? false : true;
		return returnValue;
	}
开发者ID:,项目名称:,代码行数:16,代码来源:


示例8:

/*
 * Adds a Post object to a to a User wall.
 * @param message - the message to be posted
 * @param link - the link to be included in post.
 * @param pictureUrl - a picture url to be included in post.
 * @param actions - a Vector of Action objects (objects containing name and link) to be included in the post.
 * @param id - the id of the user on which wall the post will be displayed.
 */
void FacebookPublisher2::addPostOnWall(const MAUtil::String &ID, const MAUtil::String &message, const MAUtil::String &link,
			const MAUtil::String &name, const MAUtil::String &caption, const MAUtil::String &description )
{
	MAUtil::Map<MAUtil::String, MAUtil::String> params;

	MAUtil::String postdata = "message=" + message;

	if(link.size()>0)
	{
		postdata += mPostdataSeparator + "link=" + link;
	}

//	if(pictureUrl.size()>0)
//	{
//		postdata += mPostdataSeparator + "picture=" + pictureUrl;
//	}
	if(name.size()>0)
	{
		postdata += mPostdataSeparator + "name=" + name;
	}
	if(caption.size()>0)
	{
		postdata += mPostdataSeparator + "caption=" + caption;
	}
	if(description.size()>0)
	{
		postdata += mPostdataSeparator + "description=" + description;
	}

	mFacebook->requestGraph(PUBLISH, STRING, ID + "/feed", HTTP_POST, postdata);
}
开发者ID:AliSayed,项目名称:MoSync,代码行数:39,代码来源:FacebookPublisher2.cpp


示例9: submitEditBoxContent

	/**
	 * This method is called when the Submit button is clicked, or edit box
	 * return button was hit.
	 */
	void MainScreen::submitEditBoxContent()
	{
		// Get the text from the password box.
		MAUtil::String password = mPasswordBox->getText();

		// Check if the text doesn't fit the buffer( the default size is 256).
		if ( mPasswordBox->getLastError().errorCode ==
				MAW_RES_INVALID_STRING_BUFFER_SIZE )
		{
			// If the password is too long we use the instructions label
			// to inform the user. Note that C automatically concatenates
			// strings split over multiple lines.
			mInstructions->setText("Password too long. "
				"Please enter a shorter password:");
		}
		// Check that the password is at least 6 characters long.
		else if ( password.length() < 6 )
		{
			// If the password is too short we use the instructions label
			// to inform the user. Note that C automatically concatenates
			// strings split over multiple lines.
			mInstructions->setText("Password too short. "
				"Please enter a password of at least 6 characters:");
		}
		else
		{
			// The password is at least 6 characters long,
			// we congratulate user.
			mInstructions->setText("Password OK");
		}
	}
开发者ID:Felard,项目名称:MoSync,代码行数:35,代码来源:MainScreen.cpp


示例10: httpFinished

void ImageCache::httpFinished(MAUtil::HttpConnection* http, int result) {
	if (result == 200) {
		MAUtil::String *contentLengthStr = new MAUtil::String("-1");
		int responseBytes = mHttp.getResponseHeader("content-length", contentLengthStr);
		mContentLength = 0;
		mDataOffset = 0;
		mData = maCreatePlaceholder();
		if(responseBytes == CONNERR_NOHEADER) {

		} else {
			mContentLength = atoi(contentLengthStr->c_str());
		}
		delete contentLengthStr;
		if (maCreateData(mData, mContentLength) == RES_OK){

		}

		if(mContentLength >= 1024 || mContentLength == 0) {
			mHttp.recv(mBuffer, 1024);
		} else {
			mBuffer[mContentLength] = 0;
			mHttp.recv(mBuffer, mContentLength);
		}
	}
	else {
		finishedDownloading();
	}
}
开发者ID:AirBayCreative,项目名称:GameCards,代码行数:28,代码来源:ImageCache.cpp


示例11: isSelectionAllowed

	bool ListView::isSelectionAllowed()
	{
		MAUtil::String value = this->getPropertyString(
			MAW_LIST_VIEW_ALLOW_SELECTION);
		bool returnValue = (strcmp(value.c_str(), "true")) ? false : true;
		return returnValue;
	}
开发者ID:Felard,项目名称:MoSync,代码行数:7,代码来源:ListView.cpp


示例12: buttonClicked

void SMV::buttonClicked(Widget* button)
{
	mEditBox->hideKeyboard();

	MAUtil::String str;
	str = mEditBox->getText();
	strcpy(engine->url_path, str.c_str());
	int str_c = strlen(engine->url_path);
	if(engine->url_path[str_c-1] != '/')
	{
		engine->url_path[str_c++] = '/';
		engine->url_path[str_c] = '\0';
		//mEditBox->setText(engine->url_path);
	}

	MAHandle directory = maFileOpen(engine->url_path, MA_ACCESS_READ);
	if (directory < 0)
		maMessageBox("Uwaga!", "Blad FileOpen!");
	else
	{
		if (!maFileExists(directory))
			maMessageBox("Uwaga!", "Katalog nie istnieje!");
		else
		{
			maWidgetScreenShow(0);
			int res = maLocationStart();
			if(res<0)	maPanic(1, "No GPS available");
			engine->read_conf_file();
			engine->env_init();
			engine->draw();
		}
	}
}
开发者ID:brzeszczot,项目名称:wawa1935,代码行数:33,代码来源:smv.cpp


示例13: actionSubmit

void Login::actionSubmit(const MAUtil::String& mail, const MAUtil::String& pwd)
{
	auth_token = "";
	memset(buffer, 0, sizeof(buffer));

	int res = mHttp.create((MAUtil::String(Manager::main->host) + "/" + qLogin).c_str(), HTTP_POST);

	if (res < 0)
	{
		manager->view->callbackAuthentication();
		return;
	}

	// escape input
	static MAUtil::String jsonQuery;
	jsonQuery = "{\"email\": " + Wormhole::Encoder::JSONStringify(mail.c_str()) + ", \"password\": " + Wormhole::Encoder::JSONStringify(pwd.c_str()) + "}";

	mHttp.setRequestHeader("Accept", "application/json");
	mHttp.setRequestHeader("Content-type", "application/json");

	char buf[32];
	sprintf(buf, "%d", jsonQuery.size());

	mHttp.setRequestHeader("Content-length", buf);

	mHttp.write(jsonQuery.c_str(), jsonQuery.size());
}
开发者ID:Zeitkit,项目名称:smartphone,代码行数:27,代码来源:cLogin.cpp


示例14: readStringFromResource

/*
 * Read the only string from one string resource.
 * Note: The parameter pos is used both for input and output
 * of the position in the resource data.
 * @param resID A valid resource id.
 * @param pos In: The start position. Out: The position
 * after the string in the resource.
 * @param output The resulting string.
 */
bool ScreenImageSwiper::readStringFromResource(
	MAHandle resID,
	int& pos,
	MAUtil::String& output) const
{
	// Get all the characters on one read.

	// Get the length of the string stored as a .pstring
	// (Pascal string). The first byte contains the length.
	byte stringLen = 0;
	maReadData(resID, (void*) &stringLen, pos, sizeof(byte));
	if (stringLen > maGetDataSize(resID) || stringLen <= 0)
	{
		return false;
	}

	// Read the string.
	pos += sizeof(byte);
	output.resize(stringLen);
	maReadData(resID, (void*) output.c_str(), pos, stringLen);

	// Update position to the byte after the string.
	pos += stringLen;

	return true;
}
开发者ID:jaumem,项目名称:MoSync,代码行数:35,代码来源:ScreenImageSwiper.cpp


示例15: readCountryTableFile

	/**
	 * Reads the CountryTable file.
	 * Data will be written into mCountryFileNames.
	 */
	void DatabaseManager::readCountryTableFile()
	{
		// Reset array.
		mCountryFileNames.clear();

		// Open CountryTable file.
		MAUtil::String filePath = mFileUtil->getLocalPath() + COUNTRY_TABLE_FILE_NAME;
		MAUtil::String fileContent;
		if (!mFileUtil->readTextFromFile(filePath, fileContent))
		{
			printf("Cannot read text from CountryTable");
			return;
		}

		//Read file content.
		MAUtil::YAJLDom::Value* root = MAUtil::YAJLDom::parse(
			(const unsigned char*)fileContent.c_str(), fileContent.size());
		MAUtil::YAJLDom::Value* countries = root->getValueForKey(sCountriesKey);
		MAUtil::YAJLDom::ArrayValue* countriesArray = (MAUtil::YAJLDom::ArrayValue*) countries;
		MAUtil::Vector<MAUtil::YAJLDom::Value*> allCountries = countriesArray->getValues();

		// Get all country files that we should read next.
		for (int index = 0; index < allCountries.size(); index++)
		{
			MAUtil::YAJLDom::Value* countryValue = allCountries[index];
			MAUtil::String countryFileName = countryValue->toString();
			mCountryFileNames.add(countryFileName);
		}
		delete root;
	}
开发者ID:Felard,项目名称:MoSync,代码行数:34,代码来源:DatabaseManager.cpp


示例16: modifyAddressField

/**
 * Modify the first value of the address field.
 * Set a custom label for that value.
 */
void PIMContact::modifyAddressField()
{
    printf("==============Modify address field=============\n\n");
    mArgs.field = MA_PIM_FIELD_CONTACT_ADDR;

    // Print new value on the screen.
    for (int i = 0; i < COUNT_ADDRESS_INDICES; i++)
    {
        MAUtil::String addressValueIndex = getAddressIndexString(i);
        const wchar* addressValue = sAddressModified[i];
        printf("%s %S", addressValueIndex.c_str(), addressValue);
    }
    printf("\n");

    // Write the address into the buffer.
    mArgs.bufSize = writeWCharArraysToBuf(
                        mArgs.buf,
                        sAddressModified,
                        COUNT_ADDRESS_INDICES);

    // Set the value for the address field at position 0.
    // Use MA_PIM_ATTR_ADDR_CUSTOM so we can set the label later.
    checkResultCode(maPimItemSetValue(&mArgs, 0, MA_PIM_ATTR_ADDR_CUSTOM));

    // Set custom attribute(label) for the above address.
    printf("\n Set label for the this address.");
    printf("Label: %S", sAddressLabel);

    // Write label value into buffer.
    mArgs.bufSize = copyWCharArray(mArgs.buf, sAddressLabel);

    // Set label value for address field at position 0.
    checkResultCode(maPimItemSetLabel(&mArgs, 0));
    waitForClick();
}
开发者ID:,项目名称:,代码行数:39,代码来源:


示例17: httpFinished

void BenchDBConnector::httpFinished(MAUtil::HttpConnection* http, int result) {
	printf("HTTP %i\n", result);
	if(result == 200){//everything went fine
		lprintfln("MoSync benchmark DONE!");
	}

	MAUtil::String contentLengthStr;
	int responseBytes = mHttp.getResponseHeader("content-length", &contentLengthStr);
	int contentLength = 0;
	if(responseBytes == CONNERR_NOHEADER)
		printf("no content-length response header\n");
	else {
		printf("content-length : %s\n", contentLengthStr.c_str());
		contentLength = atoi(contentLengthStr.c_str());
	}
	if(contentLength >= CONNECTION_BUFFER_SIZE || contentLength == 0) {
		printf("Receive in chunks..\n");
		mHttp.recv(mBuffer, CONNECTION_BUFFER_SIZE);
	} else {
		mBuffer[contentLength] = 0;
		mHttp.read(mBuffer, contentLength);
		printf("response: %s\n", mBuffer);
	}

}
开发者ID:,项目名称:,代码行数:25,代码来源:


示例18: addEmail

/**
 * Add values to email field.
 */
void PIMContact::addEmail()
{
    printf("Add values to email field.\n\n");
    MAUtil::String attribute;
    mArgs.field = MA_PIM_FIELD_CONTACT_EMAIL;

    // Print home email value and attribute for on the screen.
    attribute = getEmailAttributeString(MA_PIM_ATTR_EMAIL_HOME);
    printf("Attribute: %s", attribute.c_str());
    printf("Email: %S", sEmailHome);

    // Write home email value to buffer.
    mArgs.bufSize = copyWCharArray(mArgs.buf, sEmailHome);

    // Add value to the email field.
    checkResultCode(maPimItemAddValue(&mArgs, MA_PIM_ATTR_EMAIL_HOME));
    printf("\n");

    // Print work email value and attribute for on the screen.
    attribute = getEmailAttributeString(MA_PIM_ATTR_EMAIL_WORK);
    printf("Attribute: %s", attribute.c_str());
    printf("Email: %S", sEmailWork);

    // Write work email value to buffer.
    mArgs.bufSize = copyWCharArray(mArgs.buf, sEmailWork);

    // Add value to the email field.
    checkResultCode(maPimItemAddValue(&mArgs, MA_PIM_ATTR_EMAIL_WORK));
}
开发者ID:,项目名称:,代码行数:32,代码来源:


示例19: isHighlighted

	/**
	 * Check if the item is highlighted.
	 * Platform: iOS.
	 * @return True if highlighted, false otherwise.
	 */
	bool SegmentedListViewItem::isHighlighted()
	{
		MAUtil::String value = this->getPropertyString(
			MAW_SEGMENTED_LIST_VIEW_ITEM_IS_HIGHLIGHTED);
		bool returnValue = (strcmp(value.c_str(), "true")) ? false : true;
		return returnValue;
	}
开发者ID:,项目名称:,代码行数:12,代码来源:


示例20: addURL

/**
 * Add values to URL field.
 */
void PIMContact::addURL()
{
    MAUtil::String attribute;
    printf("Add values to URL field.\n\n");
    mArgs.field = MA_PIM_FIELD_CONTACT_URL;

    // Print home URL value and attribute.
    attribute = getWebsiteAttributeString(MA_PIM_ATTR_WEBSITE_HOME);
    printf("Attribute: %s", attribute.c_str());
    printf("URL1: %S", sURLHome);

    // Write home URL value to buffer.
    mArgs.bufSize = copyWCharArray(mArgs.buf, sURLHome);

    // Add value to URL field.
    checkResultCode(maPimItemAddValue(&mArgs, MA_PIM_ATTR_WEBSITE_HOME));
    printf("\n");

    // Print work URL value and attribute.
    attribute = getWebsiteAttributeString(MA_PIM_ATTR_WEBSITE_WORK);
    printf("Attribute: %s", attribute.c_str());
    printf("URL2: %S", sURLWork);

    // Write work URL value to buffer.
    mArgs.bufSize = copyWCharArray(mArgs.buf, sURLWork);

    // Add value to URL field.
    checkResultCode(maPimItemAddValue(&mArgs, MA_PIM_ATTR_WEBSITE_WORK));
}
开发者ID:,项目名称:,代码行数:32,代码来源:



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ mautil::Vector类代码示例发布时间:2022-05-31
下一篇:
C++ matrix::Matrix类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap