コード例 #1
0
HuffmanNode* decodeNode(ibitstream& input) {
    if (input.readBit() == 1) {
        return new HuffmanNode(input.get(), 2, nullptr, nullptr);
    } else {
        HuffmanNode* zero = decodeNode(input);
        HuffmanNode* one = decodeNode(input);
        return new HuffmanNode(NOT_A_CHAR, 5, zero, one);
    }
}
コード例 #2
0
CCBoneData *CCDataReaderHelper::decodeBone(cs::CSJsonDictionary &json)
{
    CCBoneData *boneData = CCBoneData::create();

    decodeNode(boneData, json);

    const char *str = json.getItemStringValue(A_NAME);
    if(str != NULL)
    {
        boneData->name = str;
    }

    str = json.getItemStringValue(A_PARENT);
    if(str != NULL)
    {
        boneData->parentName = str;
    }

    int length = json.getArrayItemCount(DISPLAY_DATA);

    for (int i = 0; i < length; i++)
    {
        cs::CSJsonDictionary *dic = json.getSubItemFromArray(DISPLAY_DATA, i);
        boneData->addDisplayData(decodeBoneDisplay(*dic));

        delete dic;
    }

    return boneData;
}
コード例 #3
0
CCFrameData *CCDataReaderHelper::decodeFrame(cs::CSJsonDictionary &json)
{
    CCFrameData *frameData = CCFrameData::create();

    decodeNode(frameData, json);

    frameData->tweenEasing = (CCTweenType)json.getItemIntValue(A_TWEEN_EASING, Linear);
    frameData->displayIndex = json.getItemIntValue(A_DISPLAY_INDEX, 0);

    const char *event = json.getItemStringValue(A_EVENT);
    if (event != NULL)
    {
        frameData->strEvent = event;
    }

	if (s_CocoStudioVersion < VERSION_COMBINED)
	{
		frameData->duration = json.getItemIntValue(A_DURATION, 1);
	}
	else
	{
		frameData->frameID = json.getItemIntValue(A_FRAME_INDEX, 0);
	}

    return frameData;
}
コード例 #4
0
HuffmanNode* readHeader(ibitstream& input) {
    return decodeNode(input);
}