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


C++ VString::AppendUniChar方法代码示例

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


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

示例1: _GetJSONString

VError VValueBag::_GetJSONString(VString& outJSONString, sLONG& curlevel, bool prettyformat, JSONOption inModifier) const
{
	AppendBeginJSONObject(outJSONString, curlevel, prettyformat);

	VIndex nbatt = GetAttributesCount();
	VIndex nbelem = GetElementNamesCount();
	bool first = true;
	for (VIndex i = 1; i <= nbatt; i++)
	{
		VStr255 s;
		const VValueSingle* val = GetNthAttribute(i, &s);
		if ( !s.EqualToUSASCIICString( "____objectunic") && !s.EqualToUSASCIICString( "____property_name_in_jsarray"))
		{
			if (first)
				first = false;
			else
				outJSONString.AppendUniChar(',');
			if (s.EqualToUSASCIICString( "<>"))
				s = "__CDATA";
			AppendJSONPropertyName(outJSONString, curlevel, prettyformat, s);
			if (val == NULL || val->IsNull())
				outJSONString += "null";
			else
			{
				val->GetJSONString(s, JSON_WithQuotesIfNecessary);
				outJSONString += s;
			}
		}
	}

	for (VIndex i = 1; i <= nbelem; i++)
	{
		if (first)
			first = false;
		else
			outJSONString.AppendUniChar(',');

		VStr255 s;
		const VBagArray* subelems = GetNthElementName(i, &s);
		AppendJSONPropertyName(outJSONString, curlevel, prettyformat, s);
		
		if ((inModifier & JSON_UniqueSubElementsAreNotArrays) != 0 && subelems->GetCount() == 1)
		{
			subelems->GetNth(1)->_GetJSONString(outJSONString, curlevel, prettyformat, inModifier);
		}
		else if (subelems->GetNth(1)->GetAttribute("____objectunic"))
		{
			subelems->GetNth(1)->_GetJSONString(outJSONString, curlevel, prettyformat, inModifier);
		}
		else
			subelems->_GetJSONString(outJSONString, curlevel, prettyformat, inModifier);

	}

	AppendEndJSONObject(outJSONString, curlevel, prettyformat);
	return VE_OK;
}
开发者ID:StephaneH,项目名称:core-XToolbox,代码行数:57,代码来源:VValueBag.cpp

示例2: AppendEndJSONArray

void AppendEndJSONArray(VString& outJSONString, sLONG& curlevel, bool prettyformat)
{
	AppendJSONNewline(outJSONString, prettyformat);
	curlevel--;
	AjustJSONTab(outJSONString, curlevel, prettyformat);
	outJSONString.AppendUniChar(']');
}
开发者ID:StephaneH,项目名称:core-XToolbox,代码行数:7,代码来源:VValueBag.cpp

示例3: ConsumeName

bool ScriptDocLexer::ConsumeName( VString &outName, bool &outIsOptional, bool &outDoFurtherProcessing )
{
	outIsOptional = false;
	outDoFurtherProcessing = true;
	while (true) {
		if (!fLexerInput->HasMoreChars())	return false;
		UniChar ch = fLexerInput->MoveToNextChar();

		if (CHAR_LEFT_SQUARE_BRACKET == ch) {
			// If the name is enclosed in [], then it's considered to be an optional
			// parameter.
			if (outName.GetLength() == 0) {
				outIsOptional = true;
			} else {
				return false;
			}
		} else if (IsLineEnding( ch )) {
			// We've reached the end of the tag, and the user has not specified a comment, which
			// is fine.  We'll just break out now and not do any further processing.
			ConsumeLineEnding( ch );
			outDoFurtherProcessing = false;
			break;
		} else if (IsWhitespace( ch ) || (outIsOptional && CHAR_RIGHT_SQUARE_BRACKET == ch)) {
			break;
		} else {
			outName.AppendUniChar( ch );
		}
	}
	return true; 
}
开发者ID:sanyaade-iot,项目名称:core-Components,代码行数:30,代码来源:ScriptDoc.cpp

示例4: ConsumeExceptionTag

bool ScriptDocLexer::ConsumeExceptionTag()
{
	// The exception tag takes the form: @exception {name} description, and we've already
	// handled the @exception clause.  So we want to skip over whitespace and look for the
	// {name} clause next.
	UniChar ch;
	bool toss;
	if (!SkipWhitespaces( toss ))		return false;
	if (!fLexerInput->HasMoreChars())	return false;

	// We expect the next character to be an open curly bracket.
	if (CHAR_LEFT_CURLY_BRACKET != fLexerInput->MoveToNextChar())	return false;
	if (!fLexerInput->HasMoreChars())	return false;

	// Now we expect to read the name of the exception
	VString exceptionName;
	while (true) {
		if (!fLexerInput->HasMoreChars())	return false;
		ch = fLexerInput->MoveToNextChar();

		if (IsLineEnding( ch )) { ConsumeLineEnding( ch ); return false; }
		if (CHAR_RIGHT_CURLY_BRACKET == ch) break;
		exceptionName.AppendUniChar( ch );
	}

	// Now that we have the exception name clause, we can skip whitespaces and look
	// for the description
	if (!SkipWhitespaces( toss ))		return false;

	VString description;
	if (!ConsumeComment( description ))	return false;

	fLastElement = new ExceptionElement( exceptionName, description );
	return true;
}
开发者ID:sanyaade-iot,项目名称:core-Components,代码行数:35,代码来源:ScriptDoc.cpp

示例5: GetTimeSeparator

VString XLinuxIntlMgr::GetTimeSeparator() const
{
	VString timeSeparator;

	VString timePattern=GetDateOrTimePattern(SHORT_TIME);

	bool isQuoted=false;

	for(int i=0 ; i<timePattern.GetLength() ; i++)
	{
		UniChar c=timePattern[i];

		if(c=='\'')
			isQuoted=!isQuoted;

		if(isQuoted)
			continue;

		if(!(c>='A' && c<='Z') && !(c>='a' && c<='z'))
		{
			timeSeparator.AppendUniChar(c);
			break;
		}
	}

	if(timeSeparator.IsEmpty())
		return VString(":");

	return timeSeparator;
}
开发者ID:sanyaade-mobiledev,项目名称:core-XToolbox,代码行数:30,代码来源:XLinuxIntlMgr.cpp

示例6: AppendBeginJSONObject

void AppendBeginJSONObject(VString& outJSONString, sLONG& curlevel, bool prettyformat)
{
	AppendJSONNewline(outJSONString, prettyformat);
	AjustJSONTab(outJSONString, curlevel, prettyformat);
	outJSONString.AppendUniChar('{');
	curlevel++;
	//AppendJSONNewline(outJSONString, prettyformat);
}
开发者ID:StephaneH,项目名称:core-XToolbox,代码行数:8,代码来源:VValueBag.cpp

示例7:

VFolder::VFolder( const FSRef& inRef)
{
	VString fullPath;
	XMacFile::FSRefToHFSPath( inRef, fullPath);
	fullPath.AppendUniChar( FOLDER_SEPARATOR);
	fPath.FromFullPath(fullPath);
	xbox_assert( fPath.IsFolder());
	fFolder.Init( this);
}
开发者ID:sanyaade-webdev,项目名称:core-XToolbox,代码行数:9,代码来源:VFolder.cpp

示例8: _filterParents

void VJSGroup::_filterParents( XBOX::VJSParms_callStaticFunction& ioParms, CUAGGroup* inGroup)
{
	VString s;
	ioParms.GetStringParam(1,s);
	s.AppendUniChar(ioParms.GetWildChar());
	CUAGGroupVector groups;
	bool firstlevel = ioParms.GetBoolParam(2, "firstLevel", "allLevels");
	inGroup->RetainOwners(groups, firstlevel);
	ioParms.ReturnValue(buildArrFromGroups(ioParms, groups, &s));
}
开发者ID:StephaneH,项目名称:core-Components,代码行数:10,代码来源:JsUAG.cpp

示例9: AppendJSONPropertyName

void AppendJSONPropertyName(VString& outJSONString, sLONG& curlevel, bool prettyformat, const VString name)
{
	VString name2;
	AppendJSONNewline(outJSONString, prettyformat);
	AjustJSONTab(outJSONString, curlevel, prettyformat);
	name.GetJSONString(name2, JSON_WithQuotesIfNecessary);
	outJSONString += name2;
	if (prettyformat)
		outJSONString += " : ";
	else
		outJSONString.AppendUniChar(':');
}
开发者ID:StephaneH,项目名称:core-XToolbox,代码行数:12,代码来源:VValueBag.cpp

示例10: GetDateSeparator

VString XLinuxIntlMgr::GetDateSeparator() const
{
	VString dateSeparator;

	icu::DateFormat* dateFmt=icu::DateFormat::createDateInstance(icu::DateFormat::SHORT, fLocale);
	xbox_assert(dateFmt!=NULL);

	icu::SimpleDateFormat* simpleDateFmt=reinterpret_cast<icu::SimpleDateFormat*>(dateFmt);
	xbox_assert(simpleDateFmt!=NULL);

	if(simpleDateFmt!=NULL)
	{
		UErrorCode err=U_ZERO_ERROR;

		UnicodeString tmpPattern;
		simpleDateFmt->toLocalizedPattern(tmpPattern, err);
		xbox_assert(err==U_ZERO_ERROR);

		VString datePattern(tmpPattern.getTerminatedBuffer());
		bool isQuoted=false;

		for(int i=0 ; i<datePattern.GetLength() ; i++)
		{
			UniChar c=datePattern[i];

			if(c=='\'')
				isQuoted=!isQuoted;

			if(isQuoted)
				continue;

			//ICU works with patterns ("M/d/yy" for ex.) and doesn't have a notion of date separator.
			//As a work around, we try to get a localized date pattern and pick the first char that looks like a separator.
			if(!(c>='A' && c<='Z') && !(c>='a' && c<='z'))
			{
				dateSeparator.AppendUniChar(c);
				break;
			}
		}
	}

	if(dateFmt!=NULL)
		delete dateFmt;

	xbox_assert(!dateSeparator.IsEmpty());

	if(dateSeparator.IsEmpty())
		return VString("/");

	return dateSeparator;
}
开发者ID:sanyaade-mobiledev,项目名称:core-XToolbox,代码行数:51,代码来源:XLinuxIntlMgr.cpp

示例11: ConsumeReturnTag

bool ScriptDocLexer::ConsumeReturnTag()
{
	UniChar	ch;
	bool	toss;

	if ( ! SkipWhitespaces( toss ) )
		return false;

	if ( ! fLexerInput->HasMoreChars() )
		return false;

	// We expect the next character to be an open curly bracket.
	if ( CHAR_LEFT_CURLY_BRACKET != fLexerInput->MoveToNextChar() )
		return false;

	if ( ! fLexerInput->HasMoreChars() )
		return false;

	// Now we expect to read the type list
	VString typeList;
	while (true)
	{
		if ( ! fLexerInput->HasMoreChars() )
			return false;

		ch = fLexerInput->MoveToNextChar();

		if ( IsLineEnding( ch ) )
		{
			ConsumeLineEnding( ch );
			return false; 
		}

		if (CHAR_RIGHT_CURLY_BRACKET == ch)
			break;
		typeList.AppendUniChar( ch );
	}

	if ( ! SkipWhitespaces( toss ) )
		return false;

	// Now we can find the description of the return value
	VString description;
	ConsumeComment( description );

	fLastElement = new ReturnElement( typeList, description );
	return true;
}
开发者ID:sanyaade-iot,项目名称:core-Components,代码行数:48,代码来源:ScriptDoc.cpp

示例12: ConsumeTypes

bool ScriptDocLexer::ConsumeTypes( VString &outTypes, bool &outDoFurtherProcessing )
{
	outDoFurtherProcessing = true;

	// We expect the next character to be an open curly bracket if the user has specified
	// type information for the parameter
	bool curlyBracketMode = CHAR_LEFT_CURLY_BRACKET == fLexerInput->PeekAtNextChar();

	if ( curlyBracketMode )
	{
		fLexerInput->MoveToNextChar();
		if ( ! fLexerInput->HasMoreChars() )
			return false;
	}

	// Now we expect to read the type list
	while (true)
	{
		if ( ! fLexerInput->HasMoreChars() )
			return false;

		UniChar ch = fLexerInput->MoveToNextChar();

		if ( IsLineEnding( ch ) )
		{ 
			ConsumeLineEnding( ch );
			if (curlyBracketMode)
				outDoFurtherProcessing = false; 
			break;
		}

		if (curlyBracketMode && CHAR_RIGHT_CURLY_BRACKET == ch)
			break;

		outTypes.AppendUniChar( ch );
	}
	return true;
}
开发者ID:sanyaade-iot,项目名称:core-Components,代码行数:38,代码来源:ScriptDoc.cpp

示例13: GetNextJSONToken


//.........这里部分代码省略.........
									The application/json Media Type for JavaScript Object Notation (JSON)
									. . .
									Any character may be escaped.  If the character is in the Basic
									Multilingual Plane (U+0000 through U+FFFF), then it may be
									represented as a six-character sequence: a reverse solidus, followed
									by the lowercase letter u, followed by four hexadecimal digits that
									encode the character's code point.  The hexadecimal letters A though
									F can be upper or lowercase.  So, for example, a string containing
									only a single reverse solidus character may be represented as
									"\u005C".
									. . .
							   */
										if ( testAssert( fCurChar - fStartChar + 4 <= fInputLen))
										{
											c = 0;
											for(sLONG i_fromHex = 1; i_fromHex <= 4; ++i_fromHex)
											{
												UniChar theChar = *fCurChar++;
												if (theChar >= CHAR_DIGIT_ZERO && theChar <= CHAR_DIGIT_NINE)
												{
													c *= 16L;
													c += (theChar - CHAR_DIGIT_ZERO);
												}
												else if (theChar >= CHAR_LATIN_CAPITAL_LETTER_A && theChar <= CHAR_LATIN_CAPITAL_LETTER_F)
												{
													c *= 16L;
													c += (theChar - CHAR_LATIN_CAPITAL_LETTER_A) + 10L;
												}
												else if (theChar >= CHAR_LATIN_SMALL_LETTER_A && theChar <= CHAR_LATIN_SMALL_LETTER_F)
												{
													c *= 16L;
													c += (theChar - CHAR_LATIN_SMALL_LETTER_A) + 10L;
												}
											}
										}
										else
										{
											eof = true;
											c = 0;
										}
										break;
								}
								if (c != 0)
									outString.AppendUniChar(c);
							}
							else if (c == '"')
							{
								return jsonString;
							}
							else
							{
								outString.AppendUniChar(c);
							}
						}							
					} while(!eof);
					return jsonString;
				}
					break;
					
				default:
				{
					outString.AppendUniChar(c);
					do 
					{
						const UniChar* oldpos = fCurChar;
						c = _GetNextChar(eof);
						if (c <= 32)
						{
							return jsonString;
						}
						else
						{
							switch(c)
							{
								case '{':
								case '}':
								case '[':
								case ']':
								case ',':
								case ':':
								case '"':
									fCurChar = oldpos;
									return jsonString;
									break;
									
								default:
									outString.AppendUniChar(c);
									break;
							}
						}
					} while(!eof);
					return jsonString;
				}
					break;
			}
		}
	} while(!eof);
	
	return jsonNone;
}
开发者ID:sanyaade-webdev,项目名称:core-XToolbox,代码行数:101,代码来源:VJSONTools.cpp

示例14: ConsumePossiblePunctuation

int HTMLLexer::ConsumePossiblePunctuation( UniChar inChar, TokenList *outTokens )
{
	VIndex nStartingPosition = fLexerInput->GetCurrentPosition();
	int tk = 0;
	VString tokenStr;
	switch (inChar) {
		case CHAR_AMPERSAND: {
			VString entity;
			UniChar ch;
			if (ConsumePossibleEntity( entity, ch )) {
				tk = HTMLLexemes::TEXT;
				if (outTokens) {
					outTokens->push_back( new HTMLLexerToken( ILexerToken::TT_HTML_ENTITY, nStartingPosition, entity.GetLength(), entity, ch ) );
				}
				return tk;
			}
		} break;
		case CHAR_EQUALS_SIGN: {
			tokenStr.AppendUniChar( fLexerInput->MoveToNextChar() );
			tk = (int)inChar;
		} break;
		case CHAR_SOLIDUS: {
			fLexerInput->MoveToNextChar();
			if (fLexerInput->HasMoreChars()) {
				if (fLexerInput->PeekAtNextChar() == CHAR_GREATER_THAN_SIGN) {
					tk = HTMLLexemes::SELF_CLOSE;
					tokenStr = "/>";
					fLexerInput->MoveToNextChar();	// Eat the >
				}
			}
			if (!tk)	fLexerInput->MoveToPreviousChar();
		} break;
		case CHAR_LESS_THAN_SIGN: {
			tokenStr.AppendUniChar( fLexerInput->MoveToNextChar() );
			tk = (int)inChar;
			if (fLexerInput->HasMoreChars()) {
				if (fLexerInput->PeekAtNextChar() == CHAR_SOLIDUS) {
					tk = HTMLLexemes::START_OF_CLOSE_TAG;
					tokenStr = "</";
					fLexerInput->MoveToNextChar();	// Eat the /
				} else if (fLexerInput->PeekAtNextChar() == CHAR_EXCLAMATION_MARK) {
					tk = HTMLLexemes::BANG_START;
					tokenStr = "<!";
					fLexerInput->MoveToNextChar();
				} else if (fLexerInput->PeekAtNextChar() == CHAR_QUESTION_MARK) {
					tk = HTMLLexemes::QUESTION_START;
					tokenStr = "<?";
					fLexerInput->MoveToNextChar();
				}
			} 
		} break;
		case CHAR_GREATER_THAN_SIGN: {
			tokenStr.AppendUniChar( fLexerInput->MoveToNextChar() );
			tk = (int)inChar;
		} break;
	}

	if (tk && outTokens) {
		outTokens->push_back( new HTMLLexerToken( ILexerToken::TT_PUNCTUATION, 
									nStartingPosition, tokenStr.GetLength(), tokenStr, tk ) );
	}
	return tk;
}
开发者ID:StephaneH,项目名称:core-Components,代码行数:63,代码来源:HTMLLexer.cpp

示例15: FormatDate

void XWinIntlMgr::FormatDate( const VTime& inDate, VString& outDate, EOSFormats inFormat, bool inUseGMTTimeZoneForDisplay)
{
	// Prepare SYSTEMTIME for windows.
	sWORD YY = 0;
	sWORD MM = 0;
	sWORD DD = 0;
	sWORD hh = 0;
	sWORD mm = 0;
	sWORD ss = 0;
	sWORD ms = 0;
	if (inUseGMTTimeZoneForDisplay)
		inDate.GetUTCTime (YY,MM,DD,hh,mm,ss,ms);
	else
		inDate.GetLocalTime (YY,MM,DD,hh,mm,ss,ms);

	// Verify if date >1st Jan 1601 (GetDateFormat doesn't support earlier dates.
	if (YY>=1601)
	{
		// Let the OS do it's job.
		UniChar acBuffer[256];

		SYSTEMTIME osDate={0};
		osDate.wYear=YY;
		osDate.wMonth=MM;
		osDate.wDay=DD;
		osDate.wHour=hh;
		osDate.wMinute=mm;
		osDate.wSecond=ss;
		osDate.wMilliseconds=ms;

		if (inFormat == eOS_MEDIUM_FORMAT)
		{
			VString pattern;
			if (GetLocaleInfo( LOCALE_SLONGDATE, pattern))
			{
				// replace long month and date by medium ones
				pattern.ExchangeRawString( CVSTR( "MMMM"), CVSTR( "MMM"));
				pattern.ExchangeRawString( CVSTR( "dddd"), CVSTR( "ddd"));
				if (::GetDateFormatW( fDialect, 0, &osDate, pattern.GetCPointer(), acBuffer, sizeof(acBuffer)))
					outDate = acBuffer;
			}
		}
		else
		{
			// Let the OS do the stuff.
			DWORD dateFormat = (inFormat == eOS_SHORT_FORMAT) ? DATE_SHORTDATE : DATE_LONGDATE;
			if (::GetDateFormatW(fDialect,dateFormat,&osDate,NULL,acBuffer,sizeof(acBuffer)))
				outDate = acBuffer;
		}
	}
	else
	{
		// Get the date pattern
		VString pattern;
		if (GetLocaleInfo( (inFormat == eOS_LONG_FORMAT) ? LOCALE_SLONGDATE : LOCALE_SSHORTDATE, pattern))
		{
			XBOX::VString tokens="gyMd";
			UniChar oldToken=0;
			sLONG count=0;
			pattern.AppendChar(' ');
			sLONG YY2=YY%100;
			XBOX::VString oneName;
			for (int pos=0;pos<pattern.GetLength();pos++)
			{
				UniChar token=pattern[pos];
				if (tokens.FindUniChar(token)>=1)
				{
					if (token==oldToken)
						count++;
					else
					{
						if (!count)
						{
							count=1;
							oldToken=token;
						}
					}
				}

				if (count && token!=oldToken)
				{
					switch(oldToken)
					{
					case 'g':
						if (count==2)
						{
							// TODO: ERA will be added if really wanted.
						}
						else
						{
							for (int i=0;i<count;i++)
								outDate.AppendUniChar(oldToken);
						}
						break;

					case 'y':	// YEAR
						switch(count)
						{
						case 5:
						case 4:		// 4 or more digits date
//.........这里部分代码省略.........
开发者ID:sanyaade-iot,项目名称:core-XToolbox,代码行数:101,代码来源:XWinIntlMgr.cpp


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