Beispiel #1
0
BOOL CParseString::GetPrevWord(CString& word)
{
    word.Empty();
    int i, j;
    for (i = m_CurIndex; i >= 0 && IsSeparator(i); i--);
    if (i < 0) return FALSE;
    for (j = i; j >= 0 && !IsSeparator(j); j--) ;
    word = Mid(j, i-j);
    RemoveQuote(word);
    m_CurIndex = j;
    return TRUE;
}
Beispiel #2
0
BOOL CParseString::GetNextWord(CString& word)
{
    int i, j;
    word.Empty();
    for (i = m_CurIndex; i < GetLength() && IsSeparator(i); i++);
    if (i >= GetLength()) return FALSE;
    for (j = i; j < GetLength() && !IsSeparator(j); j++) ;
    word = Mid(i, j-i);
    RemoveQuote(word);
    m_CurIndex = j;
    return TRUE;
}
Beispiel #3
0
CString WebUpdateOption(CString strInput)
{
	CString strOutput, strItem, strTemp;
	CStringList strList;
	POSITION pos1, pos2;

	WebGetStringList(strInput, 7, strList);

	strOutput = _T("<OPTION");
#ifndef __GNUC__
	for (pos1 = strList.GetHeadPosition(); pos1 != NULL;)
#else
  for (pos1 = strList.begin(); pos1 != strList.end(); ++pos1)
#endif
	{
		pos2 = pos1;
		strItem = strList.GetNext(pos1);
		strTemp = strItem.Left(6);
		if (!strTemp.CompareNoCase(_T("value=")))
		{
			strItem = strItem.Right(strItem.GetLength()-6);
			strItem = RemoveQuote(strItem);
			strOutput += _T(" value=");
			strOutput += strItem;
			strList.RemoveAt(pos2);
		}
		else if (!strItem.CompareNoCase(_T("selected")))
		{
			strList.RemoveAt(pos2);
		}
	}
#ifndef __GNUC__
	for (pos1 = strList.GetHeadPosition(); pos1 != NULL;)
#else
  for (pos1 = strList.begin(); pos1 != strList.end(); ++pos1)
#endif
	{
		strOutput += _T(' ');
		strItem = strList.GetNext(pos1);
		strOutput += strItem;
	}
	strOutput += _T('>');
	return strOutput;
}
Beispiel #4
0
CString WebUpdateInput(CString strInput)
{
	CString strOutput, strItem, strTemp;
	CStringList strList;
	POSITION pos1, pos2;
	int iType;

	WebGetStringList(strInput, 6, strList);

	strOutput = _T("<INPUT");
	iType = ITEM_TYPE_TEXT;
#ifndef __GNUC__
	for (pos1 = strList.GetHeadPosition(); pos1 != NULL;)
#else
  for (pos1 = strList.begin(); pos1 != strList.end(); ++pos1)
#endif
	{
		pos2 = pos1;
		strItem = strList.GetNext(pos1);
		strTemp = strItem.Left(5);
		if (!strTemp.CompareNoCase(_T("name=")))
		{
			strItem = strItem.Right(strItem.GetLength()-5);
			strItem = RemoveQuote(strItem);
			strOutput += _T(" name=");
			strOutput += strItem;
			strList.RemoveAt(pos2);
		}
		else if (!strTemp.CompareNoCase(_T("type=")))
		{
			strTemp = strItem.Right(strItem.GetLength()-5);
			strTemp = RemoveQuote(strTemp);
			if (!strTemp.CompareNoCase(_T("checkbox")))
			{
				iType = ITEM_TYPE_CHECKBOX;
			}
			else if (!strTemp.CompareNoCase(_T("text")))
			{
				iType = ITEM_TYPE_TEXT;
			}
			else if (!strTemp.CompareNoCase(_T("password")))
			{
				iType = ITEM_TYPE_PASSWORD;
			}
			else if (!strTemp.CompareNoCase(_T("radio")))
			{
				iType = ITEM_TYPE_RADIO;
			}
			else
			{
				iType = ITEM_TYPE_UNKNOWN;
			}
		}
		else if (!strItem.CompareNoCase(_T("checked")))
		{
			strList.RemoveAt(pos2);
		}
	}
#ifndef __GNUC__
	for (pos1 = strList.GetHeadPosition(); pos1 != NULL;)
#else
  for (pos1 = strList.begin(); pos1 != strList.end(); ++pos1)
#endif
	{
		pos2 = pos1;
		strItem = strList.GetNext(pos1);
		strTemp = strItem.Left(6);
		if (!strTemp.CompareNoCase(_T("value=")))
		{
			if (iType == ITEM_TYPE_CHECKBOX || iType == ITEM_TYPE_TEXT || iType == ITEM_TYPE_PASSWORD)
			{
				strList.RemoveAt(pos2);
			}
			else if (iType == ITEM_TYPE_RADIO)
			{
				strItem = strItem.Right(strItem.GetLength()-6);
				strItem = RemoveQuote(strItem);
				strOutput += _T(" value=");
				strOutput += strItem;
				strList.RemoveAt(pos2);
			}
		}
	}
#ifndef __GNUC__
	for (pos1 = strList.GetHeadPosition(); pos1 != NULL;)
#else
  for (pos1 = strList.begin(); pos1 != strList.end(); ++pos1)
#endif
	{
		strOutput += _T(' ');
		strItem = strList.GetNext(pos1);
		strOutput += strItem;
	}
	strOutput += _T('>');
	return strOutput;
}