예제 #1
0
BOOL Monitor::SetParameterList(CStringList &lstParameter)
{
	CStringList::iterator it;
	if(!m_ParamList.empty())
	{
/*		for(it=m_ParamList.begin();it!=m_ParamList.end();it++)
		{
			free((*it));
		}
		*/
		m_ParamList.clear();
	}

	if(lstParameter.empty())
		return TRUE;


	for(it=lstParameter.begin();it!=lstParameter.end();it++)
	{
		m_ParamList.push_back((*it));
	}
	lstParameter.clear();

	return TRUE;
 

}
예제 #2
0
bool CInPlaceCombo::Create (int iItem, int iSubItem, CStringList &rlstItems, int nSel)
{
	if (NULL == GetControl()) 
		return false;

	m_iItem = iItem;
	m_iSubItem = iSubItem;

bool fVisible = (m_dwStyle & WS_VISIBLE) ? true : false;

	SetStyle (m_dwStyle & ~WS_VISIBLE);
	if (!FInit())
		return false;

// Set the proper font
HFONT hF = (HFONT)GetParent()->ForwardEvent(WM_GETFONT);

	ForwardEvent (WM_SETFONT, (WPARAM)hF);

// alle Elemente zur Box hinzufügen
	for (CStringList::iterator it = rlstItems.begin(); 
		 it != rlstItems.end(); 
		 ++it)
	{
		GetComboBox() -> AddString ((*it).c_str());
	}

	if (-1 != nSel) 
		GetComboBox() -> ChangeCurrentIndex (nSel);
	if (fVisible) {
		Show();
		SetFocus();
	}
	return true;
}
예제 #3
0
파일: web.cpp 프로젝트: AlexVangelov/ar168l
void WebGetOptionsList(CString strInput, CStringList& strList)
{
	POSITION pos;
	int iPos;
	CString strName, strItem;

	iPos = strInput.Find(' ');
	strItem = strInput.Mid(iPos + 6);
	iPos = strItem.Find(' ');
	if (iPos != -1)
	{
		strName = strItem.Left(iPos);
	}
	else
	{
		strName = strItem;
	}
#ifndef __GNUC__
	for (pos = strList.GetHeadPosition(); pos != NULL;)
#else
  for (pos = strList.begin(); pos != strList.end(); ++pos)
#endif
	{
		strItem = strList.GetNext(pos);
		if (!strItem.Compare(strName))
		{
			return;
		}
	}
	strList.AddTail(strName);
}
예제 #4
0
//----------------------------------------
void wxBratTools::CStringListToWxArray(CStringList& from, wxArrayString& to)
{
  CStringList::iterator it;
  for (it = from.begin() ; it != from.end() ; it++)
  {
    to.Add((*it).c_str());
  }
}
예제 #5
0
파일: web.cpp 프로젝트: AlexVangelov/ar168l
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;
}
예제 #6
0
static
bool
isNameInList(const CStringList& names, const CString& name)
{
	for (CStringList::const_iterator index = names.begin();
								index != names.end(); ++index) {
		if (CStringUtil::CaselessCmp::equal(name, *index)) {
			return true;
		}
	}
	return false;
}
예제 #7
0
파일: main.cpp 프로젝트: dlxgit/OOP
void main()
{
	CStringList list;
	/*list.push_back("first_elem");
	if (list.size() == 1)
	{
		list.push_back("second_elem");
		if (list.size() == 2)
		{
			size_t i = list.size();
			list.insert(list.begin() + (list.size() - 1), "asd");
		}
	}
	*/

	
	list.Push_back("1");
	list.Push_back("2");
	list.Push_back("3");
	
	std::vector<std::string> values = { "1", "2", "3" };

	{
		CStringList list2;
		list2.Push_back("1");
		//CStringList::CIterator it2 = list2.begin();
	}

	size_t index = 0;
	auto iter = list.begin();
	for (; iter != list.end(); iter++)
	{
		*iter == values[index];
		++index;
	}

	std::vector<std::string>::iterator iterBad = values.begin() + 3;

	CStringList::CConstIterator it = list.Cbegin();
}
예제 #8
0
void CMuleListCtrl::LoadSettings()
{
	wxCHECK_RET(!m_name.IsEmpty(), wxT("Cannot load settings for unnamed list"));

	wxConfigBase* cfg = wxConfigBase::Get();

	// Load sort order (including sort-column)
	m_sort_orders.clear();
	wxString sortOrders = cfg->Read(wxT("/eMule/TableOrdering") + m_name, wxEmptyString);
	wxString columnWidths = cfg->Read(wxT("/eMule/TableWidths") + m_name, wxEmptyString);

	// Prevent sorting from occuring when calling SetSorting
	MuleListCtrlCompare sortFunc = m_sort_func;
	m_sort_func = NULL;

	if (columnWidths.Find(wxT(':')) == wxNOT_FOUND) {
		// Old-style config entries...
		ParseOldConfigEntries(sortOrders, columnWidths);
	} else {
		// Sort orders
		wxStringTokenizer tokens(sortOrders, wxT(","));
		// Sort orders are stored in order primary, secondary, ...
		// We want to apply them with SetSorting(), so we have to apply them in reverse order,
		// so that the primary order is applied last and wins.
		// Read them with tokenizer and store them in a list in reverse order.
		CStringList tokenList;
		while (tokens.HasMoreTokens()) {
			tokenList.push_front(tokens.GetNextToken());
		}
		for (CStringList::iterator it = tokenList.begin(); it != tokenList.end(); it++) {
			wxString token = *it;
			wxString name = token.BeforeFirst(wxT(':'));
			long order = StrToLong(token.AfterFirst(wxT(':')).BeforeLast(wxT(':')));
			long alt = StrToLong(token.AfterLast(wxT(':')));
			int col = GetColumnIndex(name);
			if (col >= 0) {
				SetSorting(col, (order ? SORT_DES : 0) | (alt ? SORT_ALT : 0));
			}
		}

		// Column widths
		wxStringTokenizer tkz(columnWidths, wxT(","));
		while (tkz.HasMoreTokens()) {
			wxString token = tkz.GetNextToken();
			wxString name = token.BeforeFirst(wxT(':'));
			long width = StrToLong(token.AfterFirst(wxT(':')));
			int col = GetColumnIndex(name);
			if (col >= 0) {
				if (col >= (int) m_column_sizes.size()) {
					m_column_sizes.resize(col + 1, 0);
				}
				m_column_sizes[col] = abs(width);
				SetColumnWidth(col, (width > 0) ? width : 0);
			}
		}
	}

	// Must have at least one sort-order specified
	if (m_sort_orders.empty()) {
		m_sort_orders.push_back(CColPair(0, 0));
	}

	// Re-enable sorting and resort the contents (if any).
	m_sort_func = sortFunc;
	SortList();	
}
예제 #9
0
void OnDsp2H(CStringList& strFileList, CString strSrcDir, CString strDstDir, BOOL bForce)
{
	CString strSrcFile, strDstFile, strTemp, strVal, strOut;;
	CStdioFile out;
	CFileStatus status;

	POSITION pos;
	int iDot, iOffset, iPage, iLength;

	strDstFile = strDstDir + strFileList.RemoveTail();

	if (!PromptOverwriteFile(strDstFile, bForce))	return;
#ifndef __GNUC__
	CFile::GetStatus(strDstFile, status);
#else
	stat(strDstFile.c_str(),&status);
#endif

	iOffset = 0;
	iPage = 0;
	strOut = _T("");
#ifndef __GNUC__
	for (pos = strFileList.GetHeadPosition(); pos != NULL; )
#else
	for (pos = strFileList.begin(); pos != strFileList.end(); ++pos)
#endif
	{
		strTemp = strFileList.GetNext(pos);
		strSrcFile = strSrcDir + strTemp;
#ifndef __GNUC__
		if (!CFile::GetStatus(strSrcFile, status))
		{
			wprintf(_T("Source file %s doesn't exist"), strSrcFile);
#else
		if (stat(strSrcFile.c_str(),&status))
		{
			printf("Source file %s doesn't exist", strSrcFile.c_str());
#endif
			return;
		}
		iLength = (int)status.m_size;
		iDot = strTemp.Find(_T('.'));
		strTemp = strTemp.Left(iDot);
		strTemp.MakeUpper();
#ifndef __GNUC__
		strVal.Format(_T("#define SYSTEM_%s_PAGE\t\t(SYSTEM_DSP_PAGE + %d)\n"), strTemp, iPage);
#else
   {
      char buff[511];
	    sprintf(buff, _T("#define SYSTEM_%s_PAGE\t\t(SYSTEM_DSP_PAGE + %d)\n"), strTemp.c_str(), iPage);
      strVal = buff;
   }
#endif
		strOut += strVal;
#ifndef __GNUC__
		strVal.Format(_T("#define SYSTEM_%s_OFFSET\t\t0x%x\n"), strTemp, iOffset);
#else
   {
      char buff[511];
	    sprintf(buff, _T("#define SYSTEM_%s_OFFSET\t\t0x%x\n"), strTemp.c_str(), iOffset);
      strVal = buff;
   }
#endif
		strOut += strVal;
		iOffset += iLength;
		while (iOffset >= FILE_FLAG_PAGE_SIZE)
		{
			iOffset -= FILE_FLAG_PAGE_SIZE;
			iPage ++;
			if (iPage >= SYSTEM_DSP_PAGE_NUM)
			{
				printf("DSP dat files too large!");
				return;
			}
		}
	}

	if (!out.Open(strDstFile, CFile::modeCreate|CFile::modeWrite|CFile::typeText))
	{
#ifndef __GNUC__
		wprintf(_T("Can not create destination file %s"), strDstFile);
#else
		printf("Can not create destination file %s", strDstFile.c_str());
#endif
		return;
	}
	out.WriteString(strOut);
	out.Close();
}
예제 #10
0
static
BOOL CALLBACK
addDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	// only one add dialog at a time!
	static CScreenInfo* info = NULL;

	switch (message) {
	case WM_INITDIALOG: {
		info = (CScreenInfo*)lParam;

		// set title
		CString title;
		if (info->m_screen.empty()) {
			title = getString(IDS_ADD_SCREEN);
		}
		else {
			title = CStringUtil::format(
								getString(IDS_EDIT_SCREEN).c_str(),
								info->m_screen.c_str());
		}
		SendMessage(hwnd, WM_SETTEXT, 0, (LPARAM)title.c_str());

		// fill in screen name
		HWND child = getItem(hwnd, IDC_ADD_SCREEN_NAME_EDIT);
		SendMessage(child, WM_SETTEXT, 0, (LPARAM)info->m_screen.c_str());

		// fill in aliases
		CString aliases;
		for (CStringList::const_iterator index = info->m_aliases.begin();
								index != info->m_aliases.end(); ++index) {
			if (!aliases.empty()) {
				aliases += "\r\n";
			}
			aliases += *index;
		}
		child = getItem(hwnd, IDC_ADD_ALIASES_EDIT);
		SendMessage(child, WM_SETTEXT, 0, (LPARAM)aliases.c_str());

		// set options
		CConfig::CScreenOptions::const_iterator index;
		child = getItem(hwnd, IDC_ADD_HD_CAPS_CHECK);
		index = info->m_options.find(kOptionHalfDuplexCapsLock);
		setItemChecked(child, (index != info->m_options.end() &&
											index->second != 0));
		child = getItem(hwnd, IDC_ADD_HD_NUM_CHECK);
		index = info->m_options.find(kOptionHalfDuplexNumLock);
		setItemChecked(child, (index != info->m_options.end() &&
											index->second != 0));
		child = getItem(hwnd, IDC_ADD_HD_SCROLL_CHECK);
		index = info->m_options.find(kOptionHalfDuplexScrollLock);
		setItemChecked(child, (index != info->m_options.end() &&
											index->second != 0));

		// modifier options
		for (UInt32 i = 0; i < sizeof(s_modifiers) /
									sizeof(s_modifiers[0]); ++i) {
			child = getItem(hwnd, s_modifiers[i].m_ctrlID);

			// fill in options
			for (UInt32 j = 0; j < sizeof(s_modifiers) /
										sizeof(s_modifiers[0]); ++j) {
				SendMessage(child, CB_ADDSTRING, 0,
									(LPARAM)s_modifiers[j].m_name);
			}

			// choose current value
			index            = info->m_options.find(s_modifiers[i].m_optionID);
			KeyModifierID id = s_modifiers[i].m_modifierID;
			if (index != info->m_options.end()) {
				id = index->second;
			}
			SendMessage(child, CB_SETCURSEL, id - baseModifier, 0);
		}

		// dead corners
		UInt32 corners = 0;
		index = info->m_options.find(kOptionScreenSwitchCorners);
		if (index != info->m_options.end()) {
			corners = index->second;
		}
		child = getItem(hwnd, IDC_ADD_DC_TOP_LEFT);
		setItemChecked(child, (corners & kTopLeftMask) != 0);
		child = getItem(hwnd, IDC_ADD_DC_TOP_RIGHT);
		setItemChecked(child, (corners & kTopRightMask) != 0);
		child = getItem(hwnd, IDC_ADD_DC_BOTTOM_LEFT);
		setItemChecked(child, (corners & kBottomLeftMask) != 0);
		child = getItem(hwnd, IDC_ADD_DC_BOTTOM_RIGHT);
		setItemChecked(child, (corners & kBottomRightMask) != 0);
		index = info->m_options.find(kOptionScreenSwitchCornerSize);
		SInt32 size = 0;
		if (index != info->m_options.end()) {
			size = index->second;
		}
		char buffer[20];
		sprintf(buffer, "%d", size);
		child = getItem(hwnd, IDC_ADD_DC_SIZE);
		SendMessage(child, WM_SETTEXT, 0, (LPARAM)buffer);

		return TRUE;
	}

	case WM_COMMAND:
		switch (LOWORD(wParam)) {
		case IDOK: {
			CString newName;
			CStringList newAliases;

			// extract name and aliases
			HWND child = getItem(hwnd, IDC_ADD_SCREEN_NAME_EDIT);
			newName = getWindowText(child);
			child = getItem(hwnd, IDC_ADD_ALIASES_EDIT);
			tokenize(newAliases, getWindowText(child));

			// name must be valid
			if (!ARG->m_config.isValidScreenName(newName)) {
				showError(hwnd, CStringUtil::format(
								getString(IDS_INVALID_SCREEN_NAME).c_str(),
								newName.c_str()));
				return TRUE;
			}

			// aliases must be valid
			for (CStringList::const_iterator index = newAliases.begin();
								index != newAliases.end(); ++index) {
				if (!ARG->m_config.isValidScreenName(*index)) {
					showError(hwnd, CStringUtil::format(
								getString(IDS_INVALID_SCREEN_NAME).c_str(),
								index->c_str()));
					return TRUE;
				}
			}

			// new name may not be in the new alias list
			if (isNameInList(newAliases, newName)) {
				showError(hwnd, CStringUtil::format(
								getString(IDS_SCREEN_NAME_IS_ALIAS).c_str(),
								newName.c_str()));
				return TRUE;
			}

			// name must not exist in config but allow same name.  also
			// allow name if it exists in the old alias list but not the
			// new one.
			if (ARG->m_config.isScreen(newName) &&
				!CStringUtil::CaselessCmp::equal(newName, info->m_screen) &&
				!isNameInList(info->m_aliases, newName)) {
				showError(hwnd, CStringUtil::format(
								getString(IDS_DUPLICATE_SCREEN_NAME).c_str(),
								newName.c_str()));
				return TRUE;
			}

			// aliases must not exist in config but allow same aliases and
			// allow an alias to be the old name.
			for (CStringList::const_iterator index = newAliases.begin();
								index != newAliases.end(); ++index) {
				if (ARG->m_config.isScreen(*index) &&
					!CStringUtil::CaselessCmp::equal(*index, info->m_screen) &&
					!isNameInList(info->m_aliases, *index)) {
					showError(hwnd, CStringUtil::format(
								getString(IDS_DUPLICATE_SCREEN_NAME).c_str(),
								index->c_str()));
					return TRUE;
				}
			}

			// dead corner size must be non-negative
			child = getItem(hwnd, IDC_ADD_DC_SIZE);
			CString valueString = getWindowText(child);
			int cornerSize = atoi(valueString.c_str());
			if (cornerSize < 0) {
				showError(hwnd, CStringUtil::format(
									getString(IDS_INVALID_CORNER_SIZE).c_str(),
									valueString.c_str()));
				SetFocus(child);
				return TRUE;
			}

			// save name data
			info->m_screen  = newName;
			info->m_aliases = newAliases;

			// save options
			child = getItem(hwnd, IDC_ADD_HD_CAPS_CHECK);
			if (isItemChecked(child)) {
				info->m_options[kOptionHalfDuplexCapsLock] = 1;
			}
			else {
				info->m_options.erase(kOptionHalfDuplexCapsLock);
			}
			child = getItem(hwnd, IDC_ADD_HD_NUM_CHECK);
			if (isItemChecked(child)) {
				info->m_options[kOptionHalfDuplexNumLock] = 1;
			}
			else {
				info->m_options.erase(kOptionHalfDuplexNumLock);
			}
			child = getItem(hwnd, IDC_ADD_HD_SCROLL_CHECK);
			if (isItemChecked(child)) {
				info->m_options[kOptionHalfDuplexScrollLock] = 1;
			}
			else {
				info->m_options.erase(kOptionHalfDuplexScrollLock);
			}

			// save modifier options
			for (UInt32 i = 0; i < sizeof(s_modifiers) /
										sizeof(s_modifiers[0]); ++i) {
				child            = getItem(hwnd, s_modifiers[i].m_ctrlID);
				KeyModifierID id = static_cast<KeyModifierID>(
									SendMessage(child, CB_GETCURSEL, 0, 0) +
										baseModifier);
				if (id != s_modifiers[i].m_modifierID) {
					info->m_options[s_modifiers[i].m_optionID] = id;
				}
				else {
					info->m_options.erase(s_modifiers[i].m_optionID);
				}
			}

			// save dead corner options
			UInt32 corners = 0;
			if (isItemChecked(getItem(hwnd, IDC_ADD_DC_TOP_LEFT))) {
				corners |= kTopLeftMask;
			}
			if (isItemChecked(getItem(hwnd, IDC_ADD_DC_TOP_RIGHT))) {
				corners |= kTopRightMask;
			}
			if (isItemChecked(getItem(hwnd, IDC_ADD_DC_BOTTOM_LEFT))) {
				corners |= kBottomLeftMask;
			}
			if (isItemChecked(getItem(hwnd, IDC_ADD_DC_BOTTOM_RIGHT))) {
				corners |= kBottomRightMask;
			}
			info->m_options[kOptionScreenSwitchCorners]    = corners;
			info->m_options[kOptionScreenSwitchCornerSize] = cornerSize;

			// success
			EndDialog(hwnd, 1);
			info = NULL;
			return TRUE;
		}

		case IDCANCEL:
			EndDialog(hwnd, 0);
			info = NULL;
			return TRUE;
		}

	default:
		break;
	}

	return FALSE;
}
예제 #11
0
파일: web.cpp 프로젝트: AlexVangelov/ar168l
void OnWeb2Web(CString strSrcFile, CString strDstFile, BOOL bForce)
{
	CStdioFile in, out;
	CString strInput, strOutput;
	CString strItem, strNew;
	int iBeginPos, iEndPos, iStartIndex;

	if (!PromptOverwriteFile(strDstFile, bForce))	return;

	if (!in.Open(strSrcFile, CFile::modeRead))
	{
#ifndef __GNUC__
		wprintf(_T("Can not open source file %s"), strSrcFile);
#else
		printf("Can not open source file %s", strSrcFile.c_str());
#endif
		return;
	}

	if (!out.Open(strDstFile, CFile::modeCreate|CFile::modeWrite|CFile::typeText))
	{
#ifndef __GNUC__
		wprintf(_T("Can not create destination file %s"), strDstFile);
#else
		printf("Can not create destination file %s", strDstFile.c_str());
#endif
		in.Close();
		return;
	}

	strInput = _T("");
#ifndef __GNUC__
	while (in.ReadString(strItem))
	{
#else
	while (!in.eof())
	{
		std::getline(in, strItem);
		strItem.TrimRight();
#endif
		strItem.TrimLeft();
		strInput += strItem;
		strInput += _T("\n");
	}

	iStartIndex = 0;
	strOutput = _T("");
	while (iStartIndex < strInput.GetLength())
	{
		iBeginPos = find_char((TCHAR *)(LPCTSTR)strInput, '<', iStartIndex);
		iEndPos = find_char((TCHAR *)(LPCTSTR)strInput, '>', iStartIndex);
		if (iBeginPos == -1 || iEndPos == -1)	break;
		if (iEndPos - iBeginPos < 6)	
		{
			iStartIndex = iEndPos + 1;
			continue;
		}

		strItem = strInput.Mid(iBeginPos, 7);
		strItem.MakeUpper();
		if (!memcmp((LPCTSTR)strItem, "<INPUT", 6))
		{
			strItem = strInput.Mid(iBeginPos, (iEndPos + 1 - iBeginPos));
			strNew = WebUpdateInput(strItem);
		}
		else if (!strItem.Compare(_T("<SELECT")))
		{
			strItem = strInput.Mid(iBeginPos, (iEndPos + 1 - iBeginPos));
			strNew = WebUpdateSelect(strItem);
		}
		else if (!strItem.Compare(_T("<OPTION")))
		{
			strItem = strInput.Mid(iBeginPos, (iEndPos + 1 - iBeginPos));
			strNew = WebUpdateOption(strItem);
		}
		else
		{
			iStartIndex = iEndPos + 1;
			continue;
		}
		strOutput += strInput.Left(iBeginPos);
		strOutput += strNew;
		strInput = strInput.Right(strInput.GetLength() - iEndPos - 1);
		iStartIndex = 0;
	}

	strOutput += strInput;

	out.WriteString(strOutput);
	in.Close();
	out.Close();
}

void OnWeb2Info(CString strSrcFile, CString strDstFile, BOOL bForce)
{
	CStdioFile in, out;
	CString strInput, strOutput;
	CString strItem, strNew;
	CStringList listOptions;
	POSITION pos;
	int iBeginPos, iEndPos, iStartIndex;

	if (!PromptOverwriteFile(strDstFile, bForce))	return;

	if (!in.Open(strSrcFile, CFile::modeRead))
	{
#ifndef __GNUC__
		wprintf(_T("Can not open source file %s"), strSrcFile);
#else
		printf("Can not open source file %s", strSrcFile.c_str());
#endif
		return;
	}

	if (!out.Open(strDstFile, CFile::modeCreate|CFile::modeWrite|CFile::typeText))
	{
#ifndef __GNUC__
		wprintf(_T("Can not create destination file %s"), strDstFile);
#else
		printf("Can not create destination file %s", strDstFile.c_str());
#endif
		in.Close();
		return;
	}

	strInput = _T("");
#ifndef __GNUC__
	while (in.ReadString(strItem))
	{
#else
	while (!in.eof())
	{
		std::getline(in, strItem);
		strItem.TrimRight();
#endif
		strItem.TrimLeft();
		strInput += strItem;
		strInput += _T("\n");
	}

	iStartIndex = 0;
	while (iStartIndex < strInput.GetLength())
	{
		iBeginPos = find_char((TCHAR *)(LPCTSTR)strInput, '<', iStartIndex);
		iEndPos = find_char((TCHAR *)(LPCTSTR)strInput, '>', iStartIndex);
		if (iBeginPos == -1 || iEndPos == -1)	break;
		if (iEndPos - iBeginPos < 6)	
		{
			iStartIndex = iEndPos + 1;
			continue;
		}

		strItem = strInput.Mid(iBeginPos, 7);
		strItem.MakeUpper();
		if (!memcmp((LPCTSTR)strItem, "<INPUT", 6))
		{
			strItem = strInput.Mid(iBeginPos, (iEndPos + 1 - iBeginPos));
			strNew = WebUpdateInput(strItem);
			WebGetOptionsList(strNew, listOptions);
		}
		else if (!strItem.Compare(_T("<SELECT")))
		{
			strItem = strInput.Mid(iBeginPos, (iEndPos + 1 - iBeginPos));
			strNew = WebUpdateSelect(strItem);
			WebGetOptionsList(strNew, listOptions);
		}
		else
		{
			iStartIndex = iEndPos + 1;
			continue;
		}
		strInput = strInput.Right(strInput.GetLength() - iEndPos - 1);
		iStartIndex = 0;
	}

	iStartIndex = 0;
#ifndef __GNUC__
	for (pos = listOptions.GetHeadPosition(); pos != NULL;)
#else
	for (pos = listOptions.begin(); pos != listOptions.end(); ++pos)
#endif
	{
		strItem = listOptions.GetNext(pos);
		strItem += _T("=");
		if (strItem == _cIPtype)
		{
			strNew = "OPT_IP_TYPE";
		}
		else if (strItem == _cIPAddress)
		{
			strNew = "OPT_IP_ADDRESS";
		}
		else if (strItem == _cSubMask)
		{
			strNew = "OPT_SUBNET_MASK";
		}
		else if (strItem == _cRouterIP)
		{
			strNew = "OPT_ROUTER_IP";
		}
		else if (strItem == _cDnsType)
		{
			strNew = "OPT_DNS_TYPE";
		}
		else if (strItem == _cDnsIP)
		{
			strNew = "OPT_DNS_IP";
		}
		else if (strItem == _cDnsIP2)
		{
			strNew = "OPT_DNS_IP2";
		}
		else if (strItem == _cLay3Qos)
		{
			strNew = "OPT_LAY3_QOS";
		}
		else if (strItem == _cVlanTag)
		{
			strNew = "OPT_VLAN_TAG";
		}
		else if (strItem == _cQosPriority)
		{
			strNew = "OPT_QOS_PRIORITY";
		}
		else if (strItem == _cVlanTag2)
		{
			strNew = "OPT_VLAN_TAG2";
		}
		else if (strItem == _cQosPriority2)
		{
			strNew = "OPT_QOS_PRIORITY2";
		}
		else if (strItem == _cVlanTag3)
		{
			strNew = "OPT_VLAN_TAG3";
		}
		else if (strItem == _cQosPriority3)
		{
			strNew = "OPT_QOS_PRIORITY3";
		}
		else if (strItem == _cPPPoeID)
		{
			strNew = "OPT_PPPOE_ID";
		}
		else if (strItem == _cPPPoePIN)
		{
			strNew = "OPT_PPPOE_PIN";
		}
		else if (strItem == _cSerialMethod)
		{
			strNew = "OPT_SERIAL_METHOD";
		}
		else if (strItem == _cBaudRate)
		{
			strNew = "OPT_BAUD_RATE";
		}
		else if (strItem == _cAdminPIN)
		{
			strNew = "OPT_ADMIN_PIN";
		}
		else if (strItem == _cAdminUser)
		{
			strNew = "OPT_ADMIN_USER";
		}
		else if (strItem == _cVolInput)
		{
			strNew = "OPT_VOL_INPUT";
		}
		else if (strItem == _cVolOutput)
		{
			strNew = "OPT_VOL_OUTPUT";
		}
		else if (strItem == _cSpeakerVol)
		{
			strNew = "OPT_SPEAKER_VOL";
		}
		else if (strItem == _cProvisionServer)
		{ 
			strNew = "OPT_PROVISION_SERVER";
		}
		else if (strItem == _cProvisionTTL)
		{
			strNew = "OPT_PROVISION_TTL";
		}
		else if (strItem == _cProvisionFilename)
		{
			strNew = "OPT_PROV_FILENAME";
		}
		else if (strItem == _cProvisionPort)
		{
			strNew = "OPT_PROVISION_PORT";
		}
		else if (strItem == _cTimeZone)
		{
			strNew = "OPT_TIME_ZONE";
		}
		else if (strItem == _cDayLight)
		{
			strNew = "OPT_DAY_LIGHT";
		}
		else if (strItem == _cSntpDns)
		{
			strNew = "OPT_SNTP_DNS";
		}
		else if (strItem == _cVoiceCoder0)
		{
			strNew = "OPT_VOICE_CODER0";
		}
		else if (strItem == _cVoiceCoder1)
		{
			strNew = "OPT_VOICE_CODER1";
		}
		else if (strItem == _cVoiceCoder2)
		{
			strNew = "OPT_VOICE_CODER2";
		}
		else if (strItem == _cVoiceCoder3)
		{
			strNew = "OPT_VOICE_CODER3";
		}
		else if (strItem == _cVoiceCoder4)
		{
			strNew = "OPT_VOICE_CODER4";
		}
		else if (strItem == _cVoiceCoder5)
		{
			strNew = "OPT_VOICE_CODER5";
		}
		else if (strItem == _cVoiceCoder6)
		{
			strNew = "OPT_VOICE_CODER6";
		}
		else if (strItem == _cSpeexRate)
		{
			strNew = "OPT_SPEEX_RATE";
		}
		else if (strItem == _cVad)
		{
			strNew = "OPT_VAD";
		}
		else if (strItem == _cAgc)
		{
			strNew = "OPT_AGC";
		}
		else if (strItem == _cAec)
		{
			strNew = "OPT_AEC";
		}
		else if (strItem == _cIlbcFrame)
		{
			strNew = "OPT_ILBC_FRAME";
		}
		else if (strItem == _cFrameNumber0)
		{
			strNew = "OPT_FRAME_NUMBER0";
		}
		else if (strItem == _cFrameNumber1)
		{
			strNew = "OPT_FRAME_NUMBER1";
		}
		else if (strItem == _cFrameNumber2)
		{
			strNew = "OPT_FRAME_NUMBER2";
		}
		else if (strItem == _cFrameNumber3)
		{
			strNew = "OPT_FRAME_NUMBER3";
		}
		else if (strItem == _cFrameNumber4)
		{
			strNew = "OPT_FRAME_NUMBER4";
		}
		else if (strItem == _cFrameNumber5)
		{
			strNew = "OPT_FRAME_NUMBER5";
		}
		else if (strItem == _cFrameNumber6)
		{
			strNew = "OPT_FRAME_NUMBER6";
		}
		else if (strItem == _cFwdNumber)
		{
			strNew = "OPT_FWD_NUMBER";
		}
		else if (strItem == _cFwdAlways)
		{
			strNew = "OPT_FWD_ALWAYS";
		}
		else if (strItem == _cFwdBusy)
		{
			strNew = "OPT_FWD_BUSY";
		}
		else if (strItem == _cFwdNoAnswer)
		{
			strNew = "OPT_FWD_NOANSWER";
		}
		else if (strItem == _cNoAnswerTimeout)
		{
			strNew = "OPT_NOANSWER_TIMEOUT";
		}
		else if (strItem == _cCallWaiting)
		{
			strNew = "OPT_CALL_WAITING";
		}
		else if (strItem == _cAutoAnswer)
		{
			strNew = "OPT_AUTO_ANSWER";
		}
		else if (strItem == _cDialPrefix)
		{
			strNew = "OPT_DIAL_PREFIX";
		}
		else if (strItem == _cHotLineNumber)
		{
			strNew = "OPT_HOTLINE_NUMBER";
		}
		else if (strItem == _cUseDigitmap)
		{
			strNew = "OPT_USE_DIGITMAP";
		}
		else if (strItem == _cDigitmapTimeout)
		{
			strNew = "OPT_DIGITMAP_TIMEOUT";
		}
		else if (strItem == _cPoundAsCall)
		{
			strNew = "OPT_POUND_AS_CALL";
		}
		else if (strItem == _cRedialTimeout)
		{
			strNew = "OPT_REDIAL_TIMEOUT";
		}
		else if (strItem == _cCallLogTimeout)
		{
			strNew = "OPT_CALL_LOG_TIMEOUT";
		}
		else if (strItem == _cRinging)
		{
			strNew = "OPT_RINGING";
		}
		else if (strItem == _cGradualRinging)
		{
			strNew = "OPT_GRADUAL_RINGING";
		}
		else if (strItem == _cGetVoiceMsg)
		{
			strNew = "OPT_GET_VOICE_MSG";
		}
		else if (strItem == _cRegister)
		{
			strNew = "OPT_REGISTER";
		}
		else if (strItem == _cLocalPort)
		{
			strNew = "OPT_LOCAL_PORT";
		}
		else if (strItem == _cAuthID)
		{
			strNew = "OPT_AUTH_ID";
		}
		else if (strItem == _cAuthPIN)
		{
			strNew = "OPT_AUTH_PIN";
		}
		else if (strItem == _cUserName)
		{
			strNew = "OPT_USER_NAME";
		}
		else if (strItem == _cUserNumber)
		{
			strNew = "OPT_USER_NUMBER";
		}
		else if (strItem == _cSipProxy)
		{
			strNew = "OPT_SIP_PROXY";
		}
		else if (strItem == _cSipPort)
		{
			strNew = "OPT_SIP_PORT";
		}
		else if (strItem == _cSipDomain)
		{
			strNew = "OPT_SIP_DOMAIN";
		}
		else if (strItem == _cOutBoundProxy)
		{
			strNew = "OPT_OUTBOUND_PROXY";
		}
		else if (strItem == _cRtpPort)
		{
			strNew = "OPT_RTP_PORT";
		}
		else if (strItem == _cDtmfPayload)
		{
			strNew = "OPT_DTMF_PAYLOAD";
		}
		else if (strItem == _cIlbcPayload)
		{
			strNew = "OPT_ILBC_PAYLOAD";
		}
		else if (strItem == _cAdpcm32Payload)
		{
			strNew = "OPT_ADPCM32_PAYLOAD";
		}
		else if (strItem == _cSpeexPayload)
		{
			strNew = "OPT_SPEEX_PAYLOAD";
		}
		else if (strItem == _cDtmfType)
		{
			strNew = "OPT_DTMF_TYPE";
		}
		else if (strItem == _cDnsSrv)
		{
			strNew = "OPT_DNS_SRV";
		}
		else if (strItem == _cRegisterTTL)
		{
			strNew = "OPT_REGISTER_TTL";
		}
		else if (strItem == _cKeepAlive)
		{
			strNew = "OPT_KEEP_ALIVE";
		}
		else if (strItem == _cMessageNumber)
		{
			strNew = "OPT_MESSAGE_NUMBER";
		}
		else if (strItem == _cPrack)
		{
			strNew = "OPT_PRACK";
		}
		else if (strItem == _cSubscribeMWI)
		{
			strNew = "OPT_SUBSCRIBE_MWI";
		}
		else if (strItem == _cProxyRequire)
		{
			strNew = "OPT_PROXY_REQUIRE";
		}
		else if (strItem == _cNatTraversal)
		{
			strNew = "OPT_NAT_TRAVERSAL";
		}
		else if (strItem == _cNatIP)
		{
			strNew = "OPT_NAT_IP";
		}
		else if (strItem == _cStunServer)
		{
			strNew = "OPT_STUN_SERVER";
		}
		else if (strItem == _cStunPort)
		{
			strNew = "OPT_STUN_PORT";
		}
		else if (strItem == _cIax2Server)
		{
			strNew = "OPT_IAX2_SERVER";
		}
		else if (strItem == _cIax2Port)
		{
			strNew = "OPT_IAX2_PORT";
		}
		else if (strItem == _cDigitDialing)
		{
			strNew = "OPT_DIGIT_DIALING";
		}
/*		else if (strItem == _cUdpDebug)
		{
			strNew = "OPT_UDP_DEBUG";
		}
*/
		else if (strItem == _cSyslogIP)
		{
			strNew = "OPT_SYSLOG_IP";
		}
		else if (strItem == _cTimeOut)
		{
			strNew = "OPT_TIME_OUT";
		}
		else if (strItem == _cRingVolOutput)
		{
			strNew = "OPT_RING_VOL_OUTPUT";
		}
		else
		{
			continue;
		}
		if (iStartIndex)
		{
			strOutput += ", \n";
		}
		strOutput += strNew;
		iStartIndex ++;
	}
#ifndef __GNUC__
	strItem.Format(_T("#define WEB_INFO_NUM	%d\n\nconst unsigned short web_info_code[WEB_INFO_NUM] = {\n"), iStartIndex);
#else
	{
		char buff[511];
	 	sprintf(buff, _T("#define WEB_INFO_NUM	%d\n\nconst unsigned short web_info_code[WEB_INFO_NUM] = {\n"), iStartIndex);
		strItem = buff;
	}
#endif
	strOutput = strItem + strOutput;
	strOutput += _T("\n};\n");
	out.WriteString(strOutput);

	in.Close();
	out.Close();
}
예제 #12
0
파일: web.cpp 프로젝트: AlexVangelov/ar168l
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;
}