]>
git.saurik.com Git - iphone-api.git/blob - WebCore/FormDataBuilder.h
2 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
21 #ifndef FormDataBuilder_h
22 #define FormDataBuilder_h
24 #include "PlatformString.h"
25 #include <wtf/Noncopyable.h>
33 class FormDataBuilder
: Noncopyable
{
38 bool isPostMethod() const { return m_isPostMethod
; }
39 void setIsPostMethod(bool value
) { m_isPostMethod
= value
; }
41 bool isMultiPartForm() const { return m_isMultiPartForm
; }
42 void setIsMultiPartForm(bool value
) { m_isMultiPartForm
= value
; }
44 String
encodingType() const { return m_encodingType
; }
45 void setEncodingType(const String
& value
) { m_encodingType
= value
; }
47 String
acceptCharset() const { return m_acceptCharset
; }
48 void setAcceptCharset(const String
& value
) { m_acceptCharset
= value
; }
50 void parseEncodingType(const String
&);
51 void parseMethodType(const String
&);
53 TextEncoding
dataEncoding(Document
*) const;
55 // Helper functions used by HTMLFormElement/WMLGoElement for multi-part form data
56 static Vector
<char> generateUniqueBoundaryString();
57 static void beginMultiPartHeader(Vector
<char>&, const CString
& boundary
, const CString
& name
);
58 static void addBoundaryToMultiPartHeader(Vector
<char>&, const CString
& boundary
, bool isLastBoundary
= false);
59 static void addFilenameToMultiPartHeader(Vector
<char>&, const TextEncoding
&, const String
& filename
);
60 static void addContentTypeToMultiPartHeader(Vector
<char>&, const CString
& mimeType
);
61 static void finishMultiPartHeader(Vector
<char>&);
63 // Helper functions used by HTMLFormElement/WMLGoElement for non multi-part form data
64 static void addKeyValuePairAsFormData(Vector
<char>&, const CString
& key
, const CString
& value
);
65 static void encodeStringAsFormData(Vector
<char>&, const CString
&);
69 bool m_isMultiPartForm
;
71 String m_encodingType
;
72 String m_acceptCharset
;