FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
mapserver/mapscript/php/php_mapscript_util.c at main · rouault/mapserver · GitHub
rouault
/
mapserver
Public
forked from
MapServer/MapServer
Notifications
You must be signed in to change notification settings
Fork
0
Star
1
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
mapserver
/
mapscript
/
php
/
php_mapscript_util.c
Copy path
More file actions
More file actions
Latest commit
History
History
History
191 lines (176 loc) · 8.28 KB
Breadcrumbs
mapserver
/
mapscript
/
php
/
php_mapscript_util.c
Copy path
File metadata and controls
191 lines (176 loc) · 8.28 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
/**********************************************************************
* $Id$
*
* Project: MapServer
* Purpose: PHP/MapScript extension for MapServer : Utility functions
* Author: Daniel Morissette, DM Solutions Group (dmorissette@dmsolutions.ca)
*
**********************************************************************
* Copyright (c) 2000-2005, DM Solutions Group
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies of this Software or works derived from this Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
**********************************************************************/
#include
"php_mapscript_util.h"
#include
"../../maperror.h"
#if
PHP_VERSION_ID
<
70000
zend_object_value
mapscript_object_new
(
zend_object
*
zobj
,
zend_class_entry
*
ce
,
void
(
*
zend_objects_free_object
)
TSRMLS_DC
)
{
zend_object_value
retval
;
#if
PHP_VERSION_ID
<
50399
zval
*
temp
;
#endif
zobj
->
ce
=
ce
;
ALLOC_HASHTABLE
(
zobj
->
properties
);
zend_hash_init
(
zobj
->
properties
,
0
,
NULL
,
ZVAL_PTR_DTOR
,
0
);
//handle changes in PHP 5.4.x
#if
PHP_VERSION_ID
<
50399
zend_hash_copy
(
zobj
->
properties
,
&
ce
->
default_properties
, (
copy_ctor_func_t
)
zval_add_ref
,(
void
*
)
&
temp
,
sizeof
(
zval
*
));
#else
object_properties_init
(
zobj
,
ce
);
#endif
retval
.
handle
=
zend_objects_store_put
(
zobj
,
NULL
, (
zend_objects_free_object_storage_t
)
zend_objects_free_object
,
NULL
TSRMLS_CC
);
retval
.
handlers
=
&
mapscript_std_object_handlers
;
return
retval
;
}
zend_object_value
mapscript_object_new_ex
(
zend_object
*
zobj
,
zend_class_entry
*
ce
,
void
(
*
zend_objects_free_object
),
zend_object_handlers
*
object_handlers
TSRMLS_DC
)
{
zend_object_value
retval
;
#if
PHP_VERSION_ID
<
50399
zval
*
temp
;
#endif
zobj
->
ce
=
ce
;
ALLOC_HASHTABLE
(
zobj
->
properties
);
zend_hash_init
(
zobj
->
properties
,
0
,
NULL
,
ZVAL_PTR_DTOR
,
0
);
//handle changes in PHP 5.4.x
#if
PHP_VERSION_ID
<
50399
zend_hash_copy
(
zobj
->
properties
,
&
ce
->
default_properties
, (
copy_ctor_func_t
)
zval_add_ref
,(
void
*
)
&
temp
,
sizeof
(
zval
*
));
#else
object_properties_init
(
zobj
,
ce
);
#endif
retval
.
handle
=
zend_objects_store_put
(
zobj
,
NULL
, (
zend_objects_free_object_storage_t
)
zend_objects_free_object
,
NULL
TSRMLS_CC
);
retval
.
handlers
=
object_handlers
;
return
retval
;
}
#endif
/* PHP_VERSION_ID < 70000 */
int
mapscript_extract_associative_array
(
HashTable
*
php
,
char
*
*
array
)
{
MAPSCRIPT_ZVAL_P
value
;
#if
PHP_VERSION_ID
<
70000
char
*
string_key
=
NULL
;
ulong
num_key
;
#else
zend_string
*
string_key
=
NULL
;
zend_ulong
num_key
;
#endif
int
i
=
0
;
for
(
zend_hash_internal_pointer_reset
(
php
);
zend_hash_has_more_elements
(
php
)
==
SUCCESS
;
zend_hash_move_forward
(
php
)) {
#if
PHP_VERSION_ID
<
70000
zend_hash_get_current_data
(
php
, (
void
*
*
)
&
value
);
#else
value
=
zend_hash_get_current_data
(
php
);
#endif
switch
(
mapscript_hash_get_current_key
(
php
,
&
string_key
,
&
num_key
,
1
)) {
case
HASH_KEY_IS_STRING
:
#if
PHP_VERSION_ID
<
70000
array
[
i
++
]
=
string_key
;
#else
array
[
i
++
]
=
ZSTR_VAL
(
string_key
);
#endif
array
[
i
++
]
=
Z_STRVAL_PP
(
value
);
break
;
}
}
array
[
i
++
]
=
NULL
;
return
1
;
}
/* This method returns an object property of a php class. If the object exists, it returns a reference to it,
otherwise it creates it */
void
mapscript_fetch_object
(
zend_class_entry
*
ce
,
zval
*
zval_parent
,
php_layer_object
*
layer
,
void
*
internal_object
,
MAPSCRIPT_ZVAL_P
php_object_storage
TSRMLS_DC
)
{
parent_object
p
;
// create the parent struct
#if
PHP_VERSION_ID
<
70000
p
.
val
=
zval_parent
;
#define
mapscript_fetch_object_return_value
*php_object_storage
#else
p
.
val
=
*
zval_parent
;
#define
mapscript_fetch_object_return_value
php_object_storage
#endif
p
.
child_ptr
=
&
*
php_object_storage
;
MAKE_STD_ZVAL
(
*
php_object_storage
);
if
(
ce
==
mapscript_ce_outputformat
)
mapscript_create_outputformat
((
outputFormatObj
*
)
internal_object
,
p
,
mapscript_fetch_object_return_value
TSRMLS_CC
);
else
if
(
ce
==
mapscript_ce_color
)
mapscript_create_color
((
colorObj
*
)
internal_object
,
p
,
mapscript_fetch_object_return_value
TSRMLS_CC
);
else
if
(
ce
==
mapscript_ce_rect
)
mapscript_create_rect
((
rectObj
*
)
internal_object
,
p
,
mapscript_fetch_object_return_value
TSRMLS_CC
);
else
if
(
ce
==
mapscript_ce_class
)
mapscript_create_class
((
classObj
*
)
internal_object
,
p
,
mapscript_fetch_object_return_value
TSRMLS_CC
);
else
if
(
ce
==
mapscript_ce_hashtable
)
mapscript_create_hashtable
((
hashTableObj
*
)
internal_object
,
p
,
mapscript_fetch_object_return_value
TSRMLS_CC
);
else
if
(
ce
==
mapscript_ce_label
)
mapscript_create_label
((
labelObj
*
)
internal_object
,
p
,
mapscript_fetch_object_return_value
TSRMLS_CC
);
else
if
(
ce
==
mapscript_ce_style
)
mapscript_create_style
((
styleObj
*
)
internal_object
,
p
,
mapscript_fetch_object_return_value
TSRMLS_CC
);
else
if
(
ce
==
mapscript_ce_symbol
)
mapscript_create_symbol
((
symbolObj
*
)
internal_object
,
p
,
mapscript_fetch_object_return_value
TSRMLS_CC
);
#ifdef
disabled
else
if
(
ce
==
mapscript_ce_labelcachemember
)
mapscript_create_labelcachemember
((
labelCacheMemberObj
*
)
internal_object
,
p
,
mapscript_fetch_object_return_value
TSRMLS_CC
);
else
if
(
ce
==
mapscript_ce_labelcache
)
mapscript_create_labelcache
((
labelCacheObj
*
)
internal_object
,
p
,
mapscript_fetch_object_return_value
TSRMLS_CC
);
#endif
else
if
(
ce
==
mapscript_ce_result
)
mapscript_create_result
((
resultObj
*
)
internal_object
,
p
,
mapscript_fetch_object_return_value
TSRMLS_CC
);
else
if
(
ce
==
mapscript_ce_scalebar
)
mapscript_create_scalebar
((
scalebarObj
*
)
internal_object
,
p
,
mapscript_fetch_object_return_value
TSRMLS_CC
);
else
if
(
ce
==
mapscript_ce_web
)
mapscript_create_web
((
webObj
*
)
internal_object
,
p
,
mapscript_fetch_object_return_value
TSRMLS_CC
);
else
if
(
ce
==
mapscript_ce_legend
)
mapscript_create_legend
((
legendObj
*
)
internal_object
,
p
,
mapscript_fetch_object_return_value
TSRMLS_CC
);
else
if
(
ce
==
mapscript_ce_querymap
)
mapscript_create_querymap
((
queryMapObj
*
)
internal_object
,
p
,
mapscript_fetch_object_return_value
TSRMLS_CC
);
else
if
(
ce
==
mapscript_ce_grid
)
mapscript_create_grid
((
graticuleObj
*
)
internal_object
,
p
,
mapscript_fetch_object_return_value
TSRMLS_CC
);
else
if
(
ce
==
mapscript_ce_referencemap
)
mapscript_create_referencemap
((
referenceMapObj
*
)
internal_object
,
p
,
mapscript_fetch_object_return_value
TSRMLS_CC
);
else
if
(
ce
==
mapscript_ce_point
)
mapscript_create_point
((
pointObj
*
)
internal_object
,
p
,
mapscript_fetch_object_return_value
TSRMLS_CC
);
else
if
(
ce
==
mapscript_ce_projection
)
mapscript_create_projection
((
projectionObj
*
)
internal_object
,
p
,
mapscript_fetch_object_return_value
TSRMLS_CC
);
else
if
(
ce
==
mapscript_ce_line
)
mapscript_create_line
((
lineObj
*
)
internal_object
,
p
,
mapscript_fetch_object_return_value
TSRMLS_CC
);
else
if
(
ce
==
mapscript_ce_shape
)
mapscript_create_shape
((
shapeObj
*
)
internal_object
,
p
,
layer
,
mapscript_fetch_object_return_value
TSRMLS_CC
);
else
if
(
ce
==
mapscript_ce_layer
)
mapscript_create_layer
((
layerObj
*
)
internal_object
,
p
,
mapscript_fetch_object_return_value
TSRMLS_CC
);
else
if
(
ce
==
mapscript_ce_cluster
)
mapscript_create_cluster
((
clusterObj
*
)
internal_object
,
p
,
mapscript_fetch_object_return_value
TSRMLS_CC
);
else
if
(
ce
==
mapscript_ce_labelleader
)
mapscript_create_labelleader
((
labelLeaderObj
*
)
internal_object
,
p
,
mapscript_fetch_object_return_value
TSRMLS_CC
);
}
Back
|
FazBrowse Home
|
New Git URL