actually set the variable here
[swfdec.git] / swfdec / swfdec_file_reference.c
blobd00a315fd9786fd808ec3d8fec52d05b25467319
1 /* Swfdec
2 * Copyright (C) 2007 Pekka Lampila <pekka.lampila@iki.fi>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 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 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301 USA
20 #ifdef HAVE_CONFIG_H
21 #include "config.h"
22 #endif
24 #include "swfdec_as_internal.h"
25 #include "swfdec_as_strings.h"
26 #include "swfdec_debug.h"
28 SWFDEC_AS_NATIVE (2204, 0, swfdec_file_reference_browse)
29 void
30 swfdec_file_reference_browse (SwfdecAsContext *cx, SwfdecAsObject *object,
31 guint argc, SwfdecAsValue *argv, SwfdecAsValue *ret)
33 SWFDEC_STUB ("FileReference.browse");
36 SWFDEC_AS_NATIVE (2204, 1, swfdec_file_reference_upload)
37 void
38 swfdec_file_reference_upload (SwfdecAsContext *cx, SwfdecAsObject *object,
39 guint argc, SwfdecAsValue *argv, SwfdecAsValue *ret)
41 SWFDEC_STUB ("FileReference.upload");
44 SWFDEC_AS_NATIVE (2204, 2, swfdec_file_reference_download)
45 void
46 swfdec_file_reference_download (SwfdecAsContext *cx, SwfdecAsObject *object,
47 guint argc, SwfdecAsValue *argv, SwfdecAsValue *ret)
49 SWFDEC_STUB ("FileReference.download");
52 SWFDEC_AS_NATIVE (2204, 3, swfdec_file_reference_cancel)
53 void
54 swfdec_file_reference_cancel (SwfdecAsContext *cx, SwfdecAsObject *object,
55 guint argc, SwfdecAsValue *argv, SwfdecAsValue *ret)
57 SWFDEC_STUB ("FileReference.cancel");
60 static void
61 swfdec_file_reference_get_creationDate (SwfdecAsContext *cx,
62 SwfdecAsObject *object, guint argc, SwfdecAsValue *argv,
63 SwfdecAsValue *ret)
65 SWFDEC_STUB ("FileReference.creationDate (get)");
68 static void
69 swfdec_file_reference_get_creator (SwfdecAsContext *cx, SwfdecAsObject *object,
70 guint argc, SwfdecAsValue *argv, SwfdecAsValue *ret)
72 SWFDEC_STUB ("FileReference.creator (get)");
75 static void
76 swfdec_file_reference_get_modificationDate (SwfdecAsContext *cx,
77 SwfdecAsObject *object, guint argc, SwfdecAsValue *argv,
78 SwfdecAsValue *ret)
80 SWFDEC_STUB ("FileReference.modificationDate (get)");
83 static void
84 swfdec_file_reference_get_name (SwfdecAsContext *cx, SwfdecAsObject *object,
85 guint argc, SwfdecAsValue *argv, SwfdecAsValue *ret)
87 SWFDEC_STUB ("FileReference.name (get)");
90 static void
91 swfdec_file_reference_get_size (SwfdecAsContext *cx, SwfdecAsObject *object,
92 guint argc, SwfdecAsValue *argv, SwfdecAsValue *ret)
94 SWFDEC_STUB ("FileReference.size (get)");
97 static void
98 swfdec_file_reference_get_type (SwfdecAsContext *cx, SwfdecAsObject *object,
99 guint argc, SwfdecAsValue *argv, SwfdecAsValue *ret)
101 SWFDEC_STUB ("FileReference.type (get)");
104 // Note: this is not actually the flash.net.FileReference function, but is
105 // called from within that function
106 SWFDEC_AS_NATIVE (2204, 200, swfdec_file_reference_construct)
107 void
108 swfdec_file_reference_construct (SwfdecAsContext *cx, SwfdecAsObject *object,
109 guint argc, SwfdecAsValue *argv, SwfdecAsValue *ret)
111 SwfdecAsObject *target;
112 SwfdecAsValue val;
114 SWFDEC_STUB ("FileReference");
116 if (argc > 0 && SWFDEC_AS_VALUE_IS_COMPOSITE (&argv[0])) {
117 target = SWFDEC_AS_VALUE_GET_COMPOSITE (&argv[0]);
118 } else {
119 target = object;
121 if (target == NULL)
122 return;
124 swfdec_as_object_add_native_variable (target, SWFDEC_AS_STR_creationDate,
125 swfdec_file_reference_get_creationDate, NULL);
126 swfdec_as_object_add_native_variable (target, SWFDEC_AS_STR_creator,
127 swfdec_file_reference_get_creator, NULL);
128 swfdec_as_object_add_native_variable (target, SWFDEC_AS_STR_modificationDate,
129 swfdec_file_reference_get_modificationDate, NULL);
130 swfdec_as_object_add_native_variable (target, SWFDEC_AS_STR_name,
131 swfdec_file_reference_get_name, NULL);
132 swfdec_as_object_add_native_variable (target, SWFDEC_AS_STR_size,
133 swfdec_file_reference_get_size, NULL);
134 swfdec_as_object_add_native_variable (target, SWFDEC_AS_STR_type,
135 swfdec_file_reference_get_type, NULL);
137 SWFDEC_AS_VALUE_SET_STRING (&val, SWFDEC_AS_STR_undefined);
138 swfdec_as_object_set_variable (target, SWFDEC_AS_STR_postData, &val);