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


C++ u16string::end方法代码示例

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


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

示例1:

  // from utf16 tans to utf8(or gbk)
  inline static std::string to_utf8(const std::u16string& in) {
    std::string out;
#ifdef MMSEG_GBK
	gbkTrans(in.begin(), in.end(), out);
#else
	unicodeToUtf8(in.begin(), in.end(), out);
#endif
	return out;
  }
开发者ID:ustcdane,项目名称:mmseg,代码行数:10,代码来源:TransCode.hpp

示例2: renderString

void TextLabels::renderString( const std::u16string &str, vec2 *cursor, float stretch )
{
	std::u16string::const_iterator itr;
	for( itr = str.begin(); itr != str.end(); ++itr ) {
		// retrieve character code
		uint16_t id = (uint16_t)*itr;

		if( mFont->contains( id ) ) {
			// get metrics for this character to speed up measurements
			Font::Metrics m = mFont->getMetrics( id );

			// skip whitespace characters
			if( !isWhitespaceUtf16( id ) ) {
				size_t index = mVertices.size();

				Rectf bounds = mFont->getBounds( m, mFontSize );
				mVertices.push_back( vec3( *cursor + bounds.getUpperLeft(), 0 ) );
				mVertices.push_back( vec3( *cursor + bounds.getUpperRight(), 0 ) );
				mVertices.push_back( vec3( *cursor + bounds.getLowerRight(), 0 ) );
				mVertices.push_back( vec3( *cursor + bounds.getLowerLeft(), 0 ) );

				bounds = mFont->getTexCoords( m );
				mTexcoords.push_back( bounds.getUpperLeft() );
				mTexcoords.push_back( bounds.getUpperRight() );
				mTexcoords.push_back( bounds.getLowerRight() );
				mTexcoords.push_back( bounds.getLowerLeft() );

				mIndices.push_back( index + 0 ); mIndices.push_back( index + 3 ); mIndices.push_back( index + 1 );
				mIndices.push_back( index + 1 ); mIndices.push_back( index + 3 ); mIndices.push_back( index + 2 );

				mOffsets.insert( mOffsets.end(), 4, mOffset );
			}

			if( id == 32 )
				cursor->x += stretch * mFont->getAdvance( m, mFontSize );
			else
				cursor->x += mFont->getAdvance( m, mFontSize );
		}
	}

	//
	mBoundsInvalid = true;
}
开发者ID:roko79,项目名称:Cinder-Samples,代码行数:43,代码来源:TextLabels.cpp

示例3: patternMatch

bool RegexStore::patternMatch(std::u16string& in_string) {
	//No pattern matches when we don't have a valid pattern
	if (not is_compiled) {
    return false;
	}

  //Check for a match
  regmatch_t pmatch;
	std::string tmp_str(in_string.begin(), in_string.end());
  int match = regexec(&exp, tmp_str.c_str(), 1, &pmatch, 0);
	//Make sure that each character was matched and that the entire input string
	//was consumed by the pattern
  if (0 == match and 0 == pmatch.rm_so and in_string.size() == pmatch.rm_eo) {
		return true;
  }
  else {
		return false;
  }
}
开发者ID:OwlPlatform,项目名称:world-model,代码行数:19,代码来源:regex_store.cpp

示例4: preparePattern

/*
 * Create a new regex pattern if necessary, or keep the old one if the
 * pattern has not changed
 * Returns true on success, false on failure.
 */
bool RegexStore::preparePattern(std::u16string& patt) {
	//New pattern? Clear out the existing regex_t
	if (is_compiled and this->pattern != patt) {
		//std::cerr<<"Replacing pattern "<<std::string(pattern.begin(), pattern.end())<<" with "<<std::string(patt.begin(), patt.end())
		regfree(&exp);
		is_compiled = false;
	}
	//Do we need to compile a new regex pattern?
	if (not is_compiled) {
		//Compile a new regex pattern using the ascii string representation
		std::string tmp_string(patt.begin(), patt.end());
		int err = regcomp(&exp, tmp_string.c_str(), REG_EXTENDED);
		//Return without creating an expression if this failed
		if (0 != err) {
			return false;
			//is_compiled remains false
		}
		else {
			pattern = patt;
			is_compiled = true;
		}
	}
	return true;
}
开发者ID:OwlPlatform,项目名称:world-model,代码行数:29,代码来源:regex_store.cpp

示例5:

 path::path( std::u16string const & pathname ) : pathname_( pathname.begin(), pathname.end() )
 {
 }
开发者ID:iamOgunyinka,项目名称:tinydircpp,代码行数:3,代码来源:utilities.cpp

示例6: string

std::string UTF16ToASCII(const std::u16string& utf16) {
#if 0
    DCHECK(isStringASCII(utf16)) << UTF16ToUTF8(utf16);
#endif
    return std::string(utf16.begin(), utf16.end());
}
开发者ID:ShaheedLegion,项目名称:nucleus,代码行数:6,代码来源:string_utf_conversion.cpp

示例7:

std::vector<char16_t> getChar16VectorFromUTF16String(const std::u16string& utf16)
{
    return std::vector<char16_t>(utf16.begin(), utf16.end());
}
开发者ID:c0i,项目名称:cocos2dx-lite,代码行数:4,代码来源:ccUTF8.cpp


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