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


C++ CStr::MakeUpper方法代码示例

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


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

示例1: if

CValue *GetVariable( CStr &var, BOOL create, int *position, BOOL local )
{
	int     pos, startPos;
	bool	oldStyle = false, reference = false, isPtr = false;
	CStr entryName;
	CMapStrToValue *map = NULL;
	CValue  *value;
	CValue *dummy;

	pos = 0;
	if ( !local )
	{
		if ( LocalVariables != NULL && LocalVariables->Lookup( L"%AUTOLOCAL%", dummy ) )
			local = TRUE;
	}

	// Skip spaces
	while ( pos < var.GetLength() && GetCharacterType( var[pos] ) == CInterpreter::CHAR_WHITESPACE ) pos++;
	
	if ( pos < var.GetLength() && var[pos] == L'%' )
	{
		oldStyle = true;
		pos++;
		while ( pos < var.GetLength() && GetCharacterType( var[pos] ) == CInterpreter::CHAR_WHITESPACE ) pos++;
	}
	
	if ( create && pos < var.GetLength() && var[pos] == L'[' )
	{
		reference = true;
		pos++;
		while ( pos < var.GetLength() && GetCharacterType( var[pos] ) == CInterpreter::CHAR_WHITESPACE ) pos++;
	}

	startPos = pos;
	// Skip all valid variable name characters
	while (    pos < var.GetLength()
		    && (   GetCharacterType( var[pos] ) == CInterpreter::CHAR_ALPHA
			    || GetCharacterType( var[pos] ) == CInterpreter::CHAR_DIGIT
				|| GetCharacterType( var[pos] ) == CInterpreter::CHAR_UNDERSCORE
				|| (var[pos] == L':' && (pos == startPos || pos == startPos + 1 ))
			)
		  ) pos++;
	// Skip Regex variable name characters
	if ((var[pos]==L'$') && (pos+1<var.GetLength())){
		if (   var[pos+1] == L'&' 
			|| var[pos+1] == L'`' 
			|| var[pos+1] == L'\'' 
			|| var[pos+1] == L'+' 
			|| var[pos+1] == L'_'
			)pos +=2;
		else{
			int i=0;
			for (i=1;i<=3;i++){
				if ( pos+i<var.GetLength() && var[pos+i] >=L'0' && var[pos+i]<=L'9') { /* do nothing */ }else break;
			}
			pos+=i;
		}
	}
	
	// Skip spaces
	while ( pos < var.GetLength() && GetCharacterType( var[pos] ) == CInterpreter::CHAR_WHITESPACE ) pos++;

	//jwz:add for Global Variable
	if (var[startPos]==L':' && var[startPos+1]==L':'){
		local = FALSE;
		startPos +=2;
	}

	// No array index?
	if ( pos == -1 || pos >= var.GetLength() || var[pos] != L'[' )
	{
		entryName = var;

		if ( pos != -1 && pos <= var.GetLength() )
			entryName = var.Mid( startPos, pos-startPos );


		entryName.TrimLeft();
		entryName.TrimRight();

		if ( position != NULL ) 
			*position = pos;

		if ( entryName.IsEmpty())
		{
			VarError = L"Empty variable name not allowed";
			if ( position != NULL ) *position = -1;
			return NULL;
		}

		entryName.MakeUpper();

		if ( local && LocalVariables != NULL && LocalVariables->Lookup( L"%GL_" + entryName + L"%", dummy ) ) //predefined GLOBAL declare variable
		{
			local = FALSE;
		}

		if ( local && LocalVariables != NULL && LocalVariables->Lookup( entryName, value ) ) {}
		else if ( local == FALSE && Variables.Lookup( entryName, value ) ) {}
		else
//.........这里部分代码省略.........
开发者ID:grainrigi,项目名称:jscripts,代码行数:101,代码来源:variables.cpp

示例2: sizeof

int
CIniFile::SetComPort( LPCTSTR filename, HANDLE file )
{
	CStr port = filename;
	CValue *comData;
	int timeout, rate, bits, parity, stopBit, flow;
	port.MakeUpper();
	if ( Variables.Lookup( L"[Port_" + port + L"]", comData ) )
	{
		CStrArray data;
		CStr dataString;
		dataString = (CStr)*comData;

		Split( dataString, L"\n", data );
		timeout = _wtol( data[0] );
		rate = _wtol( data[1] );
		parity = _wtol( data[2] );
		bits = _wtol( data[3] );
		stopBit = _wtol( data[4] );
		flow = _wtol( data[5] );
		//MessageBox( NULL, comData, L"Debug", MB_OK );
	}
	else
	{
		timeout = 10000;
		rate = 4800;
		parity = NOPARITY;
		bits = 8;
		stopBit = ONESTOPBIT;
		flow = 0;
	}

	DCB PortDCB;
	ZeroMemory (&PortDCB, sizeof(PortDCB));
	PortDCB.DCBlength = sizeof(DCB);
	GetCommState( file, &PortDCB );

	// Change the DCB structure settings.
	PortDCB.BaudRate = rate;              // Current baud 
	PortDCB.fBinary = TRUE;               // ASCII mode
	PortDCB.fParity = TRUE;               // Enable parity checking 
	PortDCB.fOutxCtsFlow = (flow==1);     // CTS output flow control 
	PortDCB.fOutxDsrFlow = FALSE;         // DSR output flow control 
	PortDCB.fDtrControl = DTR_CONTROL_ENABLE; 
	// DTR flow control type 
	PortDCB.fDsrSensitivity = FALSE;      // DSR sensitivity 
	PortDCB.fTXContinueOnXoff = TRUE;     // XOFF continues Tx 
	PortDCB.fOutX = (flow==2);            // XON/XOFF out flow control 
	PortDCB.fInX = (flow==2);             // XON/XOFF in flow control 
	PortDCB.fErrorChar = FALSE;           // Disable error replacement 
	PortDCB.fNull = TRUE;                 // Enable null stripping 
	PortDCB.fRtsControl = (flow==1) ? RTS_CONTROL_HANDSHAKE : RTS_CONTROL_ENABLE; 
	// RTS flow control 
	PortDCB.fAbortOnError = FALSE;        // Do not abort reads/writes on 
	// error
	PortDCB.ByteSize = bits;              // Number of bits/byte, 4-8 
	PortDCB.Parity = parity;              // 0-4=no,odd,even,mark,space 
	PortDCB.StopBits = stopBit;           // 0,1,2 = 1, 1.5, 2 

	//CStr msg;
	//msg.Format( L"BaudRate: %d\nByteSize: %d\nStopBits: %d\nParity: %d\nfOutX: %d\nfInX: %d\nfOutxCtsFlow: %d\nfRtsControl: %d\nfDsrSensitivity: %d", 
	//			     PortDCB.BaudRate,
	//				 PortDCB.ByteSize,
	//				 PortDCB.StopBits,
	//				 PortDCB.Parity,
	//				 PortDCB.fOutX,
	//				 PortDCB.fInX,
 	//				 PortDCB.fOutxCtsFlow,
	//				 PortDCB.fRtsControl,
	//				 PortDCB.fDsrSensitivity );
	//MessageBox( NULL, L"Port-Info: " + msg, L"Port-Info", MB_OK|MB_SETFOREGROUND );

	// Configure the port according to the specifications of the DCB 
	// structure.
	SetCommState( file, &PortDCB );

	// Retrieve the time-out parameters for all read and write operations
	// on the port. 
	COMMTIMEOUTS CommTimeouts;
	GetCommTimeouts( file, &CommTimeouts);

	// Change the COMMTIMEOUTS structure settings.
	CommTimeouts.ReadIntervalTimeout = MAXDWORD;
	CommTimeouts.ReadTotalTimeoutMultiplier = MAXDWORD;  
	CommTimeouts.ReadTotalTimeoutConstant = timeout;
	CommTimeouts.WriteTotalTimeoutMultiplier = 10;
	CommTimeouts.WriteTotalTimeoutConstant = 1000;
	
	// Set the time-out parameters for all read and write operations
	// on the port. 
	SetCommTimeouts( file, &CommTimeouts);

	EscapeCommFunction( file, SETDTR );
	EscapeCommFunction( file, SETRTS );

	return timeout;
}
开发者ID:grainrigi,项目名称:jscripts,代码行数:97,代码来源:IniFile.cpp


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