void IndexMergerAppRunner::optionCallback(const Option& option, const tstring& sValue)
{
    if (option.matchFull(_T("merge-index")) || option.matchShort(_T("m")))
    {
        if (sValue.empty() || (!sValue.compare(_T("merge"))))
        {
            m_nMergeMode = 1;
        }
        else if (!sValue.compare(_T("optimize")))
        {
            m_nMergeMode = 2;
        }
        else 
        {
            throw UnknownOptionException(sValue);
        }
    }
    else if (option.matchFull(_T("index-path")) || option.matchShort(_T("i")))
    {
        if (sValue.empty())
        {
            throw MissingArgumentException("--index-path/-i");
        }
        m_sIndexPath = sValue;
    }
    else if (option.matchFull(_T("lexicon-dir")) || option.matchShort(_T("l")))
    {
        if (sValue.empty())
        {
            throw MissingArgumentException("--def-field/-d");
        }
        m_sLexiDir = sValue;
    }
}
int
CLink::UrlType(
	const tstring&	strUrl )
{
	int urlType;

	const tstring slashSlash = _T("//");
	const tstring bslashBslash = _T("\\\\");

	if ( ( strUrl.compare( 0, 2, slashSlash ) == 0 ) ||
		( strUrl.compare( 0, 2, bslashBslash ) == 0 ) )
	{
		urlType = urlType_Absolute;
	}
	else if ( ( strUrl[0] == _T('\\') ) || ( strUrl[0] == _T('/') ) )
	{
		urlType = urlType_LocalAbsolute;
	}
	else
	{
		if ( strUrl.find( _T(':') ) != tstring::npos )
		{
			urlType = urlType_Absolute;
		}
		else
		{
			urlType = urlType_Relative;
		}
	}

	return urlType;
}
Esempio n. 3
0
// Inherits XMLSpy generation source function.
bool CNode::InternalNamesMatch(xmlNodePtr pNode, const tstring& sNamespaceURI, const tstring& sName)
{
	const xmlChar* sNodeURI = X("");
	const xmlChar* sNodeName = X("");
	if(pNode->ns && pNode->ns->href)
		sNodeURI = pNode->ns->href;
	if(pNode->name)
		sNodeName = pNode->name;
	return sNamespaceURI.compare(XC2TS(sNodeURI)) == 0 && sName.compare(XC2TS(sNodeName)) == 0;
}
Esempio n. 4
0
void ColorSettings::setMatch(const tstring& match) {
	if (match.compare(_T("$ts$")) == 0) {
		bTimestamps = true;
	} else if (match.compare(_T("$users$")) == 0) {
		bUsers = true;
	} else if (match.find(_T("$mynick$")) != tstring::npos) {
		bMyNick = true;
	} else if (match.find(_T("$Re:")) == 0) {
		bUsingRegexp = true;
	}
	strMatch = match;
}
Esempio n. 5
0
	DWORD GetProcessIDByName(tstring processName)
	{
		DWORD dwProcID = -1;
		do 
		{
			HANDLE hProcSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
			if (hProcSnap == INVALID_HANDLE_VALUE) {
				break;
			}

			PROCESSENTRY32 pe32= {0x00};
			pe32.dwSize = sizeof(PROCESSENTRY32);
			BOOL bFlags = Process32First(hProcSnap, &pe32);
			while(bFlags)
			{
				if (processName.compare(pe32.szExeFile) == 0) {
					dwProcID = pe32.th32ProcessID;
					break;
				}
				bFlags = Process32Next(hProcSnap, &pe32);
			}
			if (hProcSnap != INVALID_HANDLE_VALUE) {
				CloseHandle (hProcSnap);
				hProcSnap = NULL;
			}
		} while (FALSE);

		return dwProcID;
	}
Esempio n. 6
0
void Ui::connectControl(tstring name, HWND handle)
{
    controls[toansi(name)] = handle;

    if(name.compare(_T("WizardForm")) == 0)
        uiMainWindowHandle = handle;
}
Esempio n. 7
0
BOOL CRegistryTool::StringToRootKey(tstring strKey,HKEY *hKey)
{
	BOOL bSucceed = FALSE;

	transform(strKey.begin(),strKey.end(),strKey.begin(),_totupper);
	if(strKey.compare(_T("HKEY_CLASSES_ROOT"))==0)
	{
		*hKey = HKEY_CLASSES_ROOT;
		bSucceed = TRUE;
	}
	else if(strKey.compare(_T("HKEY_CURRENT_CONFIG"))==0)
	{
		*hKey = HKEY_CURRENT_CONFIG;
		bSucceed = TRUE;
	}
	else if(strKey.compare(_T("HKEY_CURRENT_USER"))==0)
	{
		*hKey = HKEY_CURRENT_USER;
		bSucceed = TRUE;
	}
	else if(strKey.compare(_T("HKEY_LOCAL_MACHINE"))==0)
	{
		*hKey = HKEY_LOCAL_MACHINE;
		bSucceed = TRUE;
	}
	else if(strKey.compare(_T("HKEY_PERFORMANCE_DATA")) ==0)
	{
		*hKey = HKEY_PERFORMANCE_DATA;
		bSucceed = TRUE;
	}
	else if(strKey.compare(_T("HKEY_USERS")) == 0)
	{
		*hKey = HKEY_USERS;
		bSucceed = TRUE;
	}

	return bSucceed;
}
Esempio n. 8
0
 bool operator()(const tstring &a, const tstring &b) const
 {
   return a.compare(b) < 0;
 }
Esempio n. 9
0
 gcc_pure
 bool operator<(const TaskStore::Item &other) const {
   return task_name.compare(other.task_name) < 0;
 }
Esempio n. 10
0
 void operator()(const TCHAR *key, const T &value) {
   ok1(last.compare(key) <= 0);
   last = key;
 }
Esempio n. 11
0
 gcc_pure
 bool operator==(const TCHAR *relative_path) const {
   return path_relative.compare(relative_path) == 0;
 }