]> git.saurik.com Git - iphone-api.git/blob - WebCore/FormDataList.h
Add support for new WinterBoard Settings features.
[iphone-api.git] / WebCore / FormDataList.h
1 /*
2 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved.
3 *
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.
8 *
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.
13 *
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.
18 *
19 */
20
21 #ifndef FormDataList_h
22 #define FormDataList_h
23
24 #include "CString.h"
25 #include "File.h"
26 #include "TextEncoding.h"
27
28 namespace WebCore {
29
30 class FormDataList {
31 public:
32 FormDataList(const TextEncoding&);
33
34 void appendData(const String& key, const String& value)
35 { appendString(key); appendString(value); }
36 void appendData(const String& key, const CString& value)
37 { appendString(key); appendString(value); }
38 void appendData(const String& key, int value)
39 { appendString(key); appendString(String::number(value)); }
40 void appendFile(const String& key, PassRefPtr<File> file)
41 { appendString(key); m_list.append(file); }
42
43 class Item {
44 public:
45 Item() { }
46 Item(const CString& data) : m_data(data) { }
47 Item(PassRefPtr<File> file) : m_file(file) { }
48
49 const CString& data() const { return m_data; }
50 File* file() const { return m_file.get(); }
51
52 private:
53 CString m_data;
54 RefPtr<File> m_file;
55 };
56
57 const Vector<Item>& list() const { return m_list; }
58
59 private:
60 void appendString(const CString&);
61 void appendString(const String&);
62
63 TextEncoding m_encoding;
64 Vector<Item> m_list;
65 };
66
67 } // namespace WebCore
68
69 #endif // FormDataList_h