summaryrefslogtreecommitdiff
path: root/swfdec/swfdec_file_reference.c
blob: 79b39930243c1642a737f6ae04aa2cca65e2f868 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
/* Swfdec
 * Copyright (C) 2007 Pekka Lampila <pekka.lampila@iki.fi>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, 
 * Boston, MA  02110-1301  USA
 */

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include "swfdec_as_internal.h"
#include "swfdec_as_strings.h"
#include "swfdec_debug.h"

SWFDEC_AS_NATIVE (2204, 0, swfdec_file_reference_browse)
void
swfdec_file_reference_browse (SwfdecAsContext *cx, SwfdecAsObject *object,
    guint argc, SwfdecAsValue *argv, SwfdecAsValue *ret)
{
  SWFDEC_STUB ("FileReference.browse");
}

SWFDEC_AS_NATIVE (2204, 1, swfdec_file_reference_upload)
void
swfdec_file_reference_upload (SwfdecAsContext *cx, SwfdecAsObject *object,
    guint argc, SwfdecAsValue *argv, SwfdecAsValue *ret)
{
  SWFDEC_STUB ("FileReference.upload");
}

SWFDEC_AS_NATIVE (2204, 2, swfdec_file_reference_download)
void
swfdec_file_reference_download (SwfdecAsContext *cx, SwfdecAsObject *object,
    guint argc, SwfdecAsValue *argv, SwfdecAsValue *ret)
{
  SWFDEC_STUB ("FileReference.download");
}

SWFDEC_AS_NATIVE (2204, 3, swfdec_file_reference_cancel)
void
swfdec_file_reference_cancel (SwfdecAsContext *cx, SwfdecAsObject *object,
    guint argc, SwfdecAsValue *argv, SwfdecAsValue *ret)
{
  SWFDEC_STUB ("FileReference.cancel");
}

static void
swfdec_file_reference_get_creationDate (SwfdecAsContext *cx,
    SwfdecAsObject *object, guint argc, SwfdecAsValue *argv,
    SwfdecAsValue *ret)
{
  SWFDEC_STUB ("FileReference.creationDate (get)");
}

static void
swfdec_file_reference_get_creator (SwfdecAsContext *cx, SwfdecAsObject *object,
    guint argc, SwfdecAsValue *argv, SwfdecAsValue *ret)
{
  SWFDEC_STUB ("FileReference.creator (get)");
}

static void
swfdec_file_reference_get_modificationDate (SwfdecAsContext *cx,
    SwfdecAsObject *object, guint argc, SwfdecAsValue *argv,
    SwfdecAsValue *ret)
{
  SWFDEC_STUB ("FileReference.modificationDate (get)");
}

static void
swfdec_file_reference_get_name (SwfdecAsContext *cx, SwfdecAsObject *object,
    guint argc, SwfdecAsValue *argv, SwfdecAsValue *ret)
{
  SWFDEC_STUB ("FileReference.name (get)");
}

static void
swfdec_file_reference_get_size (SwfdecAsContext *cx, SwfdecAsObject *object,
    guint argc, SwfdecAsValue *argv, SwfdecAsValue *ret)
{
  SWFDEC_STUB ("FileReference.size (get)");
}

static void
swfdec_file_reference_get_type (SwfdecAsContext *cx, SwfdecAsObject *object,
    guint argc, SwfdecAsValue *argv, SwfdecAsValue *ret)
{
  SWFDEC_STUB ("FileReference.type (get)");
}

// Note: this is not actually the flash.net.FileReference function, but is
// called from within that function
SWFDEC_AS_NATIVE (2204, 200, swfdec_file_reference_construct)
void
swfdec_file_reference_construct (SwfdecAsContext *cx, SwfdecAsObject *object,
    guint argc, SwfdecAsValue *argv, SwfdecAsValue *ret)
{
  SwfdecAsObject *target;
  SwfdecAsValue val;

  SWFDEC_STUB ("FileReference");

  if (argc > 0 && SWFDEC_AS_VALUE_IS_COMPOSITE (argv[0])) {
    target = SWFDEC_AS_VALUE_GET_COMPOSITE (argv[0]);
  } else {
    target = object;
  }
  if (target == NULL)
    return;

  swfdec_as_object_add_native_variable (target, SWFDEC_AS_STR_creationDate,
      swfdec_file_reference_get_creationDate, NULL);
  swfdec_as_object_add_native_variable (target, SWFDEC_AS_STR_creator,
      swfdec_file_reference_get_creator, NULL);
  swfdec_as_object_add_native_variable (target, SWFDEC_AS_STR_modificationDate,
      swfdec_file_reference_get_modificationDate, NULL);
  swfdec_as_object_add_native_variable (target, SWFDEC_AS_STR_name,
      swfdec_file_reference_get_name, NULL);
  swfdec_as_object_add_native_variable (target, SWFDEC_AS_STR_size,
      swfdec_file_reference_get_size, NULL);
  swfdec_as_object_add_native_variable (target, SWFDEC_AS_STR_type,
      swfdec_file_reference_get_type, NULL);

  SWFDEC_AS_VALUE_SET_STRING (&val, SWFDEC_AS_STR_undefined);
  swfdec_as_object_set_variable (target, SWFDEC_AS_STR_postData, &val);
}