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


C++ LLDate::fromString方法代码示例

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


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

示例1:

	void date_test_object_t::test<2>()
	{
#if LL_DATE_PARSER_CHECKS_BOUNDARY
		LLDate date;
		std::string  expected_string;
		bool result;

		result = date.fromString(INVALID_DATE_24HOUR_BOUNDARY);
		ensure_equals("INVALID_DATE_24HOUR_BOUNDARY should have failed" , result, false);
		ensure_equals("INVALID_DATE_24HOUR_BOUNDARY date still set to old value on failure!" , date.secondsSinceEpoch(), 0);

		result = date.fromString(INVALID_DATE_LEAP);
		ensure_equals("INVALID_DATE_LEAP should have failed" , result, false);

		result = date.fromString(INVALID_DATE_HOUR);
		ensure_equals("INVALID_DATE_HOUR should have failed" , result, false);

		result = date.fromString(INVALID_DATE_MIN);
		ensure_equals("INVALID_DATE_MIN should have failed" , result, false);

		result = date.fromString(INVALID_DATE_SEC);
		ensure_equals("INVALID_DATE_SEC should have failed" , result, false);

		result = date.fromString(INVALID_DATE_YEAR);
		ensure_equals("INVALID_DATE_YEAR should have failed" , result, false);

		result = date.fromString(INVALID_DATE_MONTH);
		ensure_equals("INVALID_DATE_MONTH should have failed" , result, false);

		result = date.fromString(INVALID_DATE_DAY);
		ensure_equals("INVALID_DATE_DAY should have failed" , result, false);
#endif
	}
开发者ID:9skunks,项目名称:imprudence,代码行数:33,代码来源:lldate_tut.cpp

示例2: file

void LLAvatarIconIDCache::load	()
{
	llinfos << "Loading avatar icon id cache." << llendl;
	
	// build filename for each user
	std::string resolved_filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, mFilename);
	llifstream file(resolved_filename);

	if (!file.is_open())
		return;
	
	// add each line in the file to the list
	int uuid_len = UUID_STR_LENGTH-1;
	std::string line;
	while (std::getline(file, line)) 
	{
		LLUUID avatar_id;
		LLUUID icon_id;
		LLDate date;

		std::string avatar_id_str = line.substr(0,uuid_len);
		std::string icon_id_str = line.substr(uuid_len,uuid_len);
		
		std::string date_str = line.substr(uuid_len*2, line.length()-uuid_len*2);

		if(!avatar_id.set(avatar_id_str) || !icon_id.set(icon_id_str) || !date.fromString(date_str))
			continue;

		LLAvatarIconIDCacheItem item = {icon_id,date};
		mCache[avatar_id] = item;
	}

	file.close();
	
}
开发者ID:Krazy-Bish-Margie,项目名称:Thunderstorm,代码行数:35,代码来源:llavatariconctrl.cpp


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