Rubber-stamped by Brady Eidson.
[webbrowser.git] / WebCore / html / FormDataList.h
blobaec1a52988041ba0fe376d27dc841be5732935f2
1 /*
2 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved.
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 FormDataList_h
22 #define FormDataList_h
24 #include "CString.h"
25 #include "File.h"
26 #include "TextEncoding.h"
28 namespace WebCore {
30 class FormDataList {
31 public:
32 FormDataList(const TextEncoding&);
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); }
43 class Item {
44 public:
45 Item() { }
46 Item(const CString& data) : m_data(data) { }
47 Item(PassRefPtr<File> file) : m_file(file) { }
49 const CString& data() const { return m_data; }
50 File* file() const { return m_file.get(); }
52 private:
53 CString m_data;
54 RefPtr<File> m_file;
57 const Vector<Item>& list() const { return m_list; }
59 private:
60 void appendString(const CString&);
61 void appendString(const String&);
63 TextEncoding m_encoding;
64 Vector<Item> m_list;
67 } // namespace WebCore
69 #endif // FormDataList_h