コード例 #1
0
ファイル: FormData.cpp プロジェクト: CannedFish/webkitgtk
PassRefPtr<FormData> FormData::deepCopy() const
{
    RefPtr<FormData> formData(create());

    formData->m_alwaysStream = m_alwaysStream;

    size_t n = m_elements.size();
    formData->m_elements.reserveInitialCapacity(n);
    for (size_t i = 0; i < n; ++i) {
        const FormDataElement& e = m_elements[i];
        switch (e.m_type) {
        case FormDataElement::data:
            formData->m_elements.uncheckedAppend(FormDataElement(e.m_data));
            break;
        case FormDataElement::encodedFile:
#if ENABLE(BLOB)
            formData->m_elements.uncheckedAppend(FormDataElement(e.m_filename, e.m_fileStart, e.m_fileLength, e.m_expectedFileModificationTime, e.m_shouldGenerateFile));
#else
            formData->m_elements.uncheckedAppend(FormDataElement(e.m_filename, e.m_shouldGenerateFile));
#endif
            break;
#if ENABLE(BLOB)
        case FormDataElement::encodedBlob:
            formData->m_elements.uncheckedAppend(FormDataElement(e.m_url));
            break;
#endif
        }
    }
    return formData.release();
}
コード例 #2
0
TESForm* GetJCStringForm(std::string formString)
{
	TESForm * result = nullptr;

	std::vector<std::string> stringData;

	std::string formData("__formData");

	std::istringstream str(formString);

	std::string token;
	while (std::getline(str, token, '|')) {
		//std::cout << token << std::endl;
		stringData.push_back(token);
	}

	if (stringData[0] != formData)
		return result;

	if (!stringData[2].length())
		return result;

	UInt8 modIndex = 0xff;

	if (stringData[1].length()) {
		DataHandler* pDataHandler = DataHandler::GetSingleton();
		modIndex = pDataHandler->GetModIndex(stringData[1].c_str());
	}

	if (modIndex == 0xff)
		return result;

	std::string formIdString(stringData[2].c_str());

	UInt32 formId;

	try {
		formId = std::stoul(std::string(formIdString.begin(), formIdString.end()), nullptr, 0);
	}
	catch (const std::invalid_argument&) {
		return result;
	}
	catch (const std::out_of_range&) {
		return result;
	}

	formId |= modIndex << 24;
	result = LookupFormByID(formId);
	return result;
}
コード例 #3
0
ファイル: FormData.cpp プロジェクト: domenic/mojo
PassRefPtr<FormData> FormData::deepCopy() const
{
    RefPtr<FormData> formData(create());

    formData->m_alwaysStream = m_alwaysStream;

    size_t n = m_elements.size();
    formData->m_elements.reserveInitialCapacity(n);
    for (size_t i = 0; i < n; ++i) {
        const FormDataElement& e = m_elements[i];
        switch (e.m_type) {
        case FormDataElement::data:
            formData->m_elements.uncheckedAppend(FormDataElement(e.m_data));
            break;
        }
    }
    return formData.release();
}
コード例 #4
0
PassRefPtr<FormData> FormData::deepCopy() const
{
    RefPtr<FormData> formData(create());

    formData->m_alwaysStream = m_alwaysStream;

    size_t n = m_elements.size();
    formData->m_elements.reserveCapacity(n);
    for (size_t i = 0; i < n; ++i) {
        const FormDataElement& e = m_elements[i];
        switch (e.m_type) {
        case FormDataElement::data:
            formData->m_elements.append(FormDataElement(e.m_data));
            break;
        case FormDataElement::encodedFile:
            formData->m_elements.append(FormDataElement(e.m_filename, e.m_shouldGenerateFile));
            break;
        }
    }
    return formData.release();
}
コード例 #5
0
ファイル: FormData.cpp プロジェクト: Zirias/webkitfltk
PassRefPtr<FormData> FormData::deepCopy() const
{
    RefPtr<FormData> formData(create());

    formData->m_alwaysStream = m_alwaysStream;

    formData->m_elements.reserveInitialCapacity(m_elements.size());
    for (const FormDataElement& element : m_elements) {
        switch (element.m_type) {
        case FormDataElement::Type::Data:
            formData->m_elements.uncheckedAppend(FormDataElement(element.m_data));
            break;
        case FormDataElement::Type::EncodedFile:
            formData->m_elements.uncheckedAppend(FormDataElement(element.m_filename, element.m_fileStart, element.m_fileLength, element.m_expectedFileModificationTime, element.m_shouldGenerateFile));
            break;
        case FormDataElement::Type::EncodedBlob:
            formData->m_elements.uncheckedAppend(FormDataElement(element.m_url));
            break;
        }
    }
    return formData.release();
}