コード例 #1
0
ファイル: paczip.cpp プロジェクト: akasakariki/VSD3
//========================================
//出力するファイルリストを作成
//========================================
void MyCompressData::MakeFileList(char *inFileName,char *outFileList)
{
	bool theStartFlag = 1;
	if(outFileList[0] != '\0')
	{
		theStartFlag = 0;
	}

	if(IsWildCard(inFileName))
	{
		std::stack<std::string>theDirStack;

		theDirStack.push(std::string(inFileName));

		while(theDirStack.size() != 0)
		{
			std::string theWildCard = theDirStack.top();
			theDirStack.pop();
			AnalysisWildCard(theWildCard.c_str(),outFileList,theDirStack);
		}
	}
	else
	{
		//================================
		//ワイルドカード未使用時
		//================================
		if(theStartFlag == 0)
		{
			strcat(outFileList,",");
		}
		strcat(outFileList,inFileName);
		theStartFlag = 0;
	}
}
コード例 #2
0
/**
 * Return whether the stateSet matches the desired stateSpec.
 *
 * @param stateSpec an array of required (if positive) or
 *        prohibited (if negative) {@link android.view.View} states.
 * @param stateSet an array of {@link android.view.View} states
 */
Boolean StateSet::StateSetMatches(
    /* [in] */ const ArrayOf<Int32>* stateSpec,
    /* [in] */ const ArrayOf<Int32>* stateSet)
{
    if (stateSet == NULL) {
        return (stateSpec == NULL || IsWildCard(stateSpec));
    }
    Int32 stateSpecSize = stateSpec->GetLength();
    Int32 stateSetSize = stateSet->GetLength();
    for (Int32 i = 0; i < stateSpecSize; i++) {
        Int32 stateSpecState = (*stateSpec)[i];
        if (stateSpecState == 0) {
            // We've reached the end of the cases to match against.
            return TRUE;
        }
        Boolean mustMatch;
        if (stateSpecState > 0) {
            mustMatch = TRUE;
        }
        else {
            // We use negative values to indicate must-NOT-match states.
            mustMatch = FALSE;
            stateSpecState = -stateSpecState;
        }
        Boolean found = FALSE;
        for (Int32 j = 0; j < stateSetSize; j++) {
            Int32 state = (*stateSet)[j];
            if (state == 0) {
                // We've reached the end of states to match.
                if (mustMatch) {
                    // We didn't find this must-match state.
                    return FALSE;
                }
                else {
                    // Continue checking other must-not-match states.
                    break;
                }
            }
            if (state == stateSpecState) {
                if (mustMatch) {
                    found = TRUE;
                    // Continue checking other other must-match states.
                    break;
                }
                else {
                    // Any match of a must-not-match state returns FALSE.
                    return FALSE;
                }
            }
        }
        if (mustMatch && !found) {
            // We've reached the end of states to match and we didn't
            // find a must-match state.
            return FALSE;
        }
    }
    return TRUE;
}