Esempio n. 1
0
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
std::string generateEventID(int year, uint64_t x, const std::string &prefix,
                            const string &pattern, std::string &textBlock, uint64_t *width) {
	string evtID;
	textBlock = "";

	for ( size_t i = 0; i < pattern.size(); ++i ) {
		if ( pattern[i] != '%' )
			evtID += pattern[i];
		else {
			++i;
			int len = 0;
			while ( i < pattern.size() ) {
				if ( pattern[i] >= '0' && pattern[i] <= '9' ) {
					len *= 10;
					len += int(pattern[i] - '0');
					++i;
					continue;
				}
				else if ( pattern[i] == '%' ) {
					evtID += pattern[i];
				}
				else if ( pattern[i] == 'c' ) {
					textBlock = encodeChar(x, len, width);
					evtID += textBlock;
				}
				else if ( pattern[i] == 'C' ) {
					textBlock = makeUpper(encodeChar(x, len, width));
					evtID += textBlock;
				}
				else if ( pattern[i] == 'd' ) {
					textBlock = encodeInt(x, len, width);
					evtID += textBlock;
				}
				else if ( pattern[i] == 'x' ) {
					textBlock = encodeHex(x, len, width);
					evtID += textBlock;
				}
				else if ( pattern[i] == 'X' ) {
					textBlock = makeUpper(encodeHex(x, len, width));
					evtID += textBlock;
				}
				else if ( pattern[i] == 'Y' )
					evtID += toString(year);
				else if ( pattern[i] == 'p' )
					evtID += prefix;
				else
					return "";

				break;
			}
		}
	}

	return evtID;
}
Esempio n. 2
0
void CMGTOOls::Parse_CmdLine()
{	   
	TCHAR pTemp[255];
	for (int i = 1; i < __argc; i++)
	{
		LPCTSTR pszParam = __targv[i];
		BOOL bFlag = FALSE;
		BOOL bLast = ((i + 1) == __argc);
		if (pszParam[0] == '-' || pszParam[0] == '/')
		{
			// remove flag specifier
			bFlag = TRUE;
			++pszParam;
		}
		if(bFlag)
		{
			_tcscpy(pTemp,pszParam);
			makeUpper(pTemp);
			ParseParam(pTemp);
		}
	}
}
std::string xlw::StringUtilities::toUpper(std::string inputString)
{
    makeUpper(inputString);
    return inputString;
}