コード例 #1
0
ファイル: blobtrack.cpp プロジェクト: 93sam/opencv
void CvVSModule::TransferParamsToChild(CvVSModule* pM, char* prefix)
{
    char    tmp[1024];
    int i;
    for(i=0;;++i)
    {
        const char* N = pM->GetParamName(i);
        if(N == NULL) break;
        if(prefix)
        {
            strcpy(tmp,prefix);
            strcat(tmp,"_");
            strcat(tmp,N);
        }
        else
        {
            strcpy(tmp,N);
        }

        if(IsParam(tmp))
        {
            if(GetParamStr(tmp))
                pM->SetParamStr(N,GetParamStr(tmp));
            else
                pM->SetParam(N,GetParam(tmp));
        }
    }/* Transfer next parameter */
    pM->ParamUpdate();
}/* Transfer params */
コード例 #2
0
// Acquisition of [Yes] or [No]
bool GetParamYes(LIST *o, char *name)
{
	char *s;
	char tmp[64];
	// Validate arguments
	if (o == NULL)
	{
		return false;
	}

	s = GetParamStr(o, name);
	if (s == NULL)
	{
		return false;
	}

	StrCpy(tmp, sizeof(tmp), s);
	Trim(tmp);

	if (StartWith(tmp, "y"))
	{
		return true;
	}

	if (StartWith(tmp, "t"))
	{
		return true;
	}

	if (ToInt(tmp) != 0)
	{
		return true;
	}

	return false;
}