OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
8 * | 8 * |
9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 const Member<File> m_file; | 62 const Member<File> m_file; |
63 }; | 63 }; |
64 | 64 |
65 class Item { | 65 class Item { |
66 ALLOW_ONLY_INLINE_ALLOCATION(); | 66 ALLOW_ONLY_INLINE_ALLOCATION(); |
67 public: | 67 public: |
68 Item(const CString& key) : m_key(key) { } | 68 Item(const CString& key) : m_key(key) { } |
69 Item(const CString& key, const CString& data) : m_key(key), m_data(data)
{ } | 69 Item(const CString& key, const CString& data) : m_key(key), m_data(data)
{ } |
70 Item(const CString& key, Blob* blob, const String& filename) : m_key(key
), m_blob(blob), m_filename(filename) { } | 70 Item(const CString& key, Blob* blob, const String& filename) : m_key(key
), m_blob(blob), m_filename(filename) { } |
71 | 71 |
| 72 bool isString() const { return !m_blob; } |
| 73 bool isFile() const { return m_blob; } |
72 const CString& key() const { return m_key; } | 74 const CString& key() const { return m_key; } |
73 const WTF::CString& data() const { return m_data; } | 75 const WTF::CString& data() const { return m_data; } |
74 Blob* blob() const { return m_blob.get(); } | 76 Blob* blob() const { return m_blob.get(); } |
| 77 File* file() const; |
75 const String& filename() const { return m_filename; } | 78 const String& filename() const { return m_filename; } |
76 | 79 |
77 DECLARE_TRACE(); | 80 DECLARE_TRACE(); |
78 | 81 |
79 private: | 82 private: |
80 CString m_key; | 83 CString m_key; |
81 WTF::CString m_data; | 84 WTF::CString m_data; |
82 Member<Blob> m_blob; | 85 Member<Blob> m_blob; |
83 String m_filename; | 86 String m_filename; |
84 }; | 87 }; |
(...skipping 11 matching lines...) Expand all Loading... |
96 void appendData(const String& key, int value) | 99 void appendData(const String& key, int value) |
97 { | 100 { |
98 appendItem(Item(encodeAndNormalize(key), encodeAndNormalize(String::numb
er(value)))); | 101 appendItem(Item(encodeAndNormalize(key), encodeAndNormalize(String::numb
er(value)))); |
99 } | 102 } |
100 void appendBlob(const String& key, Blob* blob, const String& filename = Stri
ng()) | 103 void appendBlob(const String& key, Blob* blob, const String& filename = Stri
ng()) |
101 { | 104 { |
102 appendItem(Item(encodeAndNormalize(key), blob, filename)); | 105 appendItem(Item(encodeAndNormalize(key), blob, filename)); |
103 } | 106 } |
104 | 107 |
105 Entry getEntry(const String& key) const; | 108 Entry getEntry(const String& key) const; |
106 Entry getEntry(size_t index) const; | |
107 HeapVector<Entry> getAll(const String& key) const; | 109 HeapVector<Entry> getAll(const String& key) const; |
108 size_t size() const { return m_items.size(); } | 110 size_t size() const { return m_items.size(); } |
109 | 111 |
110 const FormDataListItems& items() const { return m_items; } | 112 const FormDataListItems& items() const { return m_items; } |
111 const WTF::TextEncoding& encoding() const { return m_encoding; } | 113 const WTF::TextEncoding& encoding() const { return m_encoding; } |
112 | 114 |
113 PassRefPtr<FormData> createFormData(FormData::EncodingType = FormData::FormU
RLEncoded); | 115 PassRefPtr<FormData> createFormData(FormData::EncodingType = FormData::FormU
RLEncoded); |
114 PassRefPtr<FormData> createMultiPartFormData(); | 116 PassRefPtr<FormData> createMultiPartFormData(); |
115 | 117 |
116 DECLARE_VIRTUAL_TRACE(); | 118 DECLARE_VIRTUAL_TRACE(); |
(...skipping 12 matching lines...) Expand all Loading... |
129 | 131 |
130 WTF::TextEncoding m_encoding; | 132 WTF::TextEncoding m_encoding; |
131 }; | 133 }; |
132 | 134 |
133 } // namespace blink | 135 } // namespace blink |
134 | 136 |
135 WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::FormDataList::Entry); | 137 WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::FormDataList::Entry); |
136 WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::FormDataList::Item); | 138 WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::FormDataList::Item); |
137 | 139 |
138 #endif // FormDataList_h | 140 #endif // FormDataList_h |
OLD | NEW |