Merge lp:~zorba-coders/zorba/image-module-alone into lp:zorba/image-module
- image-module-alone
- Merge into image-module
Proposed by
Chris Hillery
Status: | Merged |
---|---|
Approved by: | Juan Zacarias |
Approved revision: | 52 |
Merged at revision: | 51 |
Proposed branch: | lp:~zorba-coders/zorba/image-module-alone |
Merge into: | lp:zorba/image-module |
Diff against target: |
1090 lines (+2/-1031) 8 files modified
CMakeLists.txt (+2/-2) cmake_modules/FindGraphviz.cmake (+0/-107) cmake_modules/Windows/FindGraphviz.cmake (+0/-41) src/com/zorba-xquery/www/modules/image/CMakeLists.txt (+0/-28) src/com/zorba-xquery/www/modules/image/graphviz.xq.src/graphviz.cpp (+0/-615) src/com/zorba-xquery/www/modules/image/graphviz.xq.src/graphviz.h (+0/-234) test_graphviz/ExpQueryResults/dot.xml.res (+0/-1) test_graphviz/Queries/dot.xq (+0/-3) |
To merge this branch: | bzr merge lp:~zorba-coders/zorba/image-module-alone |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Juan Zacarias | Approve | ||
Chris Hillery | Approve | ||
Review via email: mp+118227@code.launchpad.net |
Commit message
Moves GraphViz module out of the image module.
Description of the change
Removes Graphviz module (will be restored in a separate module branch)
To post a comment you must log in.
Revision history for this message
Chris Hillery (ceejatec) : | # |
review:
Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : | # |
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : | # |
Validation queue job image-module-
All tests succeeded!
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : | # |
Voting does not meet specified criteria. Required: Approve > 1, Disapprove < 1, Needs Fixing < 1, Pending < 1. Got: 1 Approve.
Revision history for this message
Juan Zacarias (juan457) : | # |
review:
Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : | # |
Validation queue starting for merge proposal.
Log at: http://
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : | # |
Validation queue job image-module-
All tests succeeded!
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'CMakeLists.txt' |
2 | --- CMakeLists.txt 2011-10-09 14:49:07 +0000 |
3 | +++ CMakeLists.txt 2012-08-04 00:55:23 +0000 |
4 | @@ -18,11 +18,11 @@ |
5 | ENABLE_TESTING () |
6 | INCLUDE (CTest) |
7 | |
8 | -SET_CMAKE_MODULE_PATH () |
9 | - |
10 | FIND_PACKAGE (Zorba REQUIRED HINTS "${ZORBA_BUILD_DIR}") |
11 | INCLUDE ("${Zorba_USE_FILE}") |
12 | |
13 | +SET_CMAKE_MODULE_PATH () |
14 | + |
15 | ADD_SUBDIRECTORY ("src") |
16 | |
17 | DONE_DECLARING_ZORBA_URIS () |
18 | |
19 | === removed file 'cmake_modules/FindGraphviz.cmake' |
20 | --- cmake_modules/FindGraphviz.cmake 2012-07-20 20:25:12 +0000 |
21 | +++ cmake_modules/FindGraphviz.cmake 1970-01-01 00:00:00 +0000 |
22 | @@ -1,107 +0,0 @@ |
23 | -# Copyright 2010 28msec Inc. |
24 | - |
25 | -# - Try to find Graphviz and the libraries it depends on |
26 | -# Once done this will define |
27 | -# |
28 | -# GRAPHVIZ_FOUND - system has graphviz |
29 | -# GRAPHVIZ_INCLUDE_DIRS - the graphviz include directory |
30 | -# GRAPHVIZ_LIBRARIES - Link these to use graphviz |
31 | - |
32 | -IF (GRAPHVIZ_INCLUDE AND GRAPHVIZ_LIBRARY AND GVC_LIBRARY AND CDT_LIBRARY AND PATHPLAN_LIBRARY AND EXPAT_LIBRARY) |
33 | - # in cache already |
34 | - SET(GRAPHVIZ_FIND_QUIETLY TRUE) |
35 | -ENDIF (GRAPHVIZ_INCLUDE AND GRAPHVIZ_LIBRARY AND GVC_LIBRARY AND CDT_LIBRARY AND PATHPLAN_LIBRARY AND EXPAT_LIBRARY) |
36 | - |
37 | -FIND_PATH( |
38 | - GRAPHVIZ_INCLUDE |
39 | - NAMES graph.h |
40 | - PATHS ${GRAPHVIZ_INCLUDE_DIR} |
41 | - PATH_SUFFIXES graphviz) |
42 | - |
43 | -FIND_LIBRARY( |
44 | - GRAPHVIZ_LIBRARY |
45 | - NAMES graph |
46 | - PATHS ${GRAPHVIZ_LIBRARY_DIR}) |
47 | - |
48 | - |
49 | -IF(GRAPHVIZ_LIBRARY) |
50 | - GET_FILENAME_COMPONENT(GRAPHVIZ_LIBRARY_DIR_ ${GRAPHVIZ_LIBRARY} PATH) |
51 | - |
52 | - FIND_LIBRARY( |
53 | - GVC_LIBRARY |
54 | - NAMES gvc |
55 | - PATHS ${GRAPHVIZ_LIBRARY_DIR_} ${GVC_LIBRARY_DIR}) |
56 | - |
57 | - FIND_LIBRARY( |
58 | - CDT_LIBRARY |
59 | - NAMES cdt |
60 | - PATHS ${GRAPHVIZ_LIBRARY_DIR_} ${CDT_LIBRARY_DIR}) |
61 | - |
62 | - FIND_LIBRARY( |
63 | - PATHPLAN_LIBRARY |
64 | - NAMES pathplan |
65 | - PATHS ${GRAPHVIZ_LIBRARY_DIR_} ${PATHPLAN_LIBRARY_DIR}) |
66 | - |
67 | - # for expat and libz and xdot, we have to make sure that we use the library that is used by gvc |
68 | - GET_FILENAME_COMPONENT(GVC_DIR ${GVC_LIBRARY} PATH) |
69 | - FIND_LIBRARY( |
70 | - Z_LIBRARY |
71 | - NAMES z |
72 | - HINTS ${GVC_DIR}) |
73 | - |
74 | - FIND_LIBRARY( |
75 | - EXPAT_LIBRARY |
76 | - NAMES expat |
77 | - HINTS ${GVC_DIR}) |
78 | - |
79 | - # On Mac, libgvc has a dependency to libxdot. Therefore, the library is search here to enable the install command in coreSDK/OSX.cmake |
80 | - FIND_LIBRARY( |
81 | - XDOT_LIBRARY |
82 | - NAMES xdot |
83 | - HINTS ${GVC_DIR}) |
84 | - |
85 | -ENDIF(GRAPHVIZ_LIBRARY) |
86 | - |
87 | -IF (GRAPHVIZ_INCLUDE AND GRAPHVIZ_LIBRARY AND GVC_LIBRARY AND CDT_LIBRARY AND PATHPLAN_LIBRARY) |
88 | - SET(GRAPHVIZ_FOUND TRUE) |
89 | - SET(GRAPHVIZ_LIBRARIES "${GRAPHVIZ_LIBRARY}" "${GVC_LIBRARY}" "${CDT_LIBRARY}" "${PATHPLAN_LIBRARY}") |
90 | - |
91 | - SET(GRAPHVIZ_INCLUDE_DIRS "${GRAPHVIZ_INCLUDE}") |
92 | -ELSE (GRAPHVIZ_INCLUDE AND GRAPHVIZ_LIBRARY AND GVC_LIBRARY AND CDT_LIBRARY AND PATHPLAN_LIBRARY) |
93 | - SET(GRAPHVIZ_FOUND FALSE) |
94 | -ENDIF (GRAPHVIZ_INCLUDE AND GRAPHVIZ_LIBRARY AND GVC_LIBRARY AND CDT_LIBRARY AND PATHPLAN_LIBRARY) |
95 | - |
96 | -IF (GRAPHVIZ_FOUND) |
97 | - IF (EXPAT_LIBRARY) |
98 | - LIST(APPEND GRAPHVIZ_LIBRARIES "${EXPAT_LIBRARY}") |
99 | - ELSE (EXPAT_LIBRARY) |
100 | - IF(NOT WIN32) |
101 | - #SET(GRAPHVIZ_FOUND FALSE) |
102 | - ENDIF(NOT WIN32) |
103 | - ENDIF (EXPAT_LIBRARY) |
104 | - |
105 | - IF (Z_LIBRARY) |
106 | - LIST(APPEND GRAPHVIZ_LIBRARIES "${Z_LIBRARY}") |
107 | - ELSE (Z_LIBRARY) |
108 | - IF(NOT WIN32) |
109 | - #SET(GRAPHVIZ_FOUND FALSE) |
110 | - ENDIF(NOT WIN32) |
111 | - ENDIF (Z_LIBRARY) |
112 | -ENDIF (GRAPHVIZ_FOUND) |
113 | - |
114 | -IF(GRAPHVIZ_FOUND) |
115 | - IF(NOT GRAPHVIZ_FIND_QUIETLY) |
116 | - MESSAGE(STATUS "Found Graphviz: ${GRAPHVIZ_LIBRARY}") |
117 | - MESSAGE(STATUS " : ${GRAPHVIZ_INCLUDE}") |
118 | - MESSAGE(STATUS " : ${GVC_LIBRARY}") |
119 | - MESSAGE(STATUS " : ${CDT_LIBRARY}") |
120 | - MESSAGE(STATUS " : ${PATHPLAN_LIBRARY}") |
121 | - MESSAGE(STATUS " : ${Z_LIBRARY}") |
122 | - MESSAGE(STATUS " : ${EXPAT_LIBRARY}") |
123 | - MESSAGE(STATUS " : ${XDOT_LIBRARY}") |
124 | - ENDIF(NOT GRAPHVIZ_FIND_QUIETLY) |
125 | -ELSE(GRAPHVIZ_FOUND) |
126 | - MESSAGE(STATUS "Could not find Graphviz") |
127 | -ENDIF(GRAPHVIZ_FOUND) |
128 | - |
129 | -MARK_AS_ADVANCED(GRAPHVIZ_INCLUDE GRAPHVIZ_LIBRARY GRAPHVIZ_INCLUDE_DIRS GRAPHVIZ_LIBRARIES GVC_LIBRARY CDT_LIBRARY PATHPLAN_LIBRARY EXPAT_LIBRARY Z_LIBRARY) |
130 | |
131 | === removed file 'cmake_modules/Windows/FindGraphviz.cmake' |
132 | --- cmake_modules/Windows/FindGraphviz.cmake 2012-07-20 20:25:12 +0000 |
133 | +++ cmake_modules/Windows/FindGraphviz.cmake 1970-01-01 00:00:00 +0000 |
134 | @@ -1,41 +0,0 @@ |
135 | -# Copyright 2010 The FLWOR Foundation. |
136 | -# |
137 | -# Licensed under the Apache License, Version 2.0 (the "License"); |
138 | -# you may not use this file except in compliance with the License. |
139 | -# You may obtain a copy of the License at |
140 | -# |
141 | -# http://www.apache.org/licenses/LICENSE-2.0 |
142 | -# |
143 | -# Unless required by applicable law or agreed to in writing, software |
144 | -# distributed under the License is distributed on an "AS IS" BASIS, |
145 | -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
146 | -# See the License for the specific language governing permissions and |
147 | -# limitations under the License. |
148 | - |
149 | -# - Try to find the Graphviz lib on Windows |
150 | -# |
151 | -# This is a proxy module that calls the FindGraphviz.cmake module. Before |
152 | -# doing that, we try to guess where Graphviz might be on the user's machine. |
153 | -# The user should provide ZORBA_THIRD_PARTY_REQUIREMENTS which is a path where |
154 | -# the Graphviz directory can be found. The Graphviz directory must have "graphviz" |
155 | -# (case insensitive) in its name. |
156 | -# |
157 | -# This module helps the Windows user to avoid providing the following two |
158 | -# variables when building Zorba: |
159 | -# -D GRAPHVIZ_INCLUDE="path_to_3rd_party_dir\*graphviz*\src" |
160 | -# -D GRAPHVIZ_LIBRARY="path_to_3rd_party_dir\*graphviz*\bin\[Release]\graphviz.lib" |
161 | -# |
162 | -# See the FindGraphviz.cmake module shipped with Zorba for more information. |
163 | - |
164 | -FIND_PACKAGE_WIN32 ( |
165 | - NAME "Graphviz" |
166 | - FOUND_VAR "GRAPHVIZ_FOUND" |
167 | - SEARCH_NAMES "graphviz" |
168 | -) |
169 | - |
170 | -IF (GRAPHVIZ_FOUND) |
171 | - |
172 | - # find the needed DLL's |
173 | - FIND_PACKAGE_DLLS_WIN32 (${FOUND_LOCATION} graph.dll) |
174 | - |
175 | -ENDIF (GRAPHVIZ_FOUND) |
176 | |
177 | === modified file 'src/com/zorba-xquery/www/modules/image/CMakeLists.txt' |
178 | --- src/com/zorba-xquery/www/modules/image/CMakeLists.txt 2012-07-20 20:25:12 +0000 |
179 | +++ src/com/zorba-xquery/www/modules/image/CMakeLists.txt 2012-08-04 00:55:23 +0000 |
180 | @@ -86,31 +86,3 @@ |
181 | ENDIF (ImageMagick_FOUND) |
182 | ENDIF(ZORBA_SUPPRESS_ImageMagick) |
183 | MESSAGE(STATUS "") |
184 | - |
185 | - |
186 | -######################################################################## |
187 | -# Graphviz |
188 | -######################################################################## |
189 | -IF(ZORBA_SUPPRESS_GRAPHVIZ) |
190 | - MESSAGE(STATUS "ZORBA_SUPPRESS_Graphviz is true - not searching for Graphviz.") |
191 | -ELSE (ZORBA_SUPPRESS_GRAPHVIZ) |
192 | - |
193 | - MESSAGE (STATUS "Looking for Graphviz") |
194 | - FIND_PACKAGE(Graphviz) |
195 | - |
196 | - IF (GRAPHVIZ_FOUND) |
197 | - MESSAGE(STATUS "Found Graphviz library -- "${GRAPHVIZ_LIBRARIES}) |
198 | - |
199 | - INCLUDE_DIRECTORIES(${GRAPHVIZ_INCLUDE_DIRS}) |
200 | - INCLUDE_DIRECTORIES("graphviz.xq.src") |
201 | - DECLARE_ZORBA_MODULE (VERSION 1.0 FILE "graphviz.xq" |
202 | - URI "http://www.zorba-xquery.com/modules/image/graphviz" |
203 | - LINK_LIBRARIES "${GRAPHVIZ_LIBRARIES}") |
204 | - |
205 | - ADD_TEST_DIRECTORY("${PROJECT_SOURCE_DIR}/test_graphviz") |
206 | - |
207 | - ELSE (GRAPHVIZ_FOUND) |
208 | - MESSAGE(STATUS "Graphviz library not found.") |
209 | - ENDIF (GRAPHVIZ_FOUND) |
210 | -ENDIF (ZORBA_SUPPRESS_GRAPHVIZ) |
211 | -MESSAGE(STATUS "") |
212 | |
213 | === removed directory 'src/com/zorba-xquery/www/modules/image/graphviz.xq.src' |
214 | === removed file 'src/com/zorba-xquery/www/modules/image/graphviz.xq.src/graphviz.cpp' |
215 | --- src/com/zorba-xquery/www/modules/image/graphviz.xq.src/graphviz.cpp 2012-07-20 20:25:12 +0000 |
216 | +++ src/com/zorba-xquery/www/modules/image/graphviz.xq.src/graphviz.cpp 1970-01-01 00:00:00 +0000 |
217 | @@ -1,615 +0,0 @@ |
218 | -/* |
219 | - * Copyright 2006-2008 The FLWOR Foundation. |
220 | - * |
221 | - * Licensed under the Apache License, Version 2.0 (the "License"); |
222 | - * you may not use this file except in compliance with the License. |
223 | - * You may obtain a copy of the License at |
224 | - * |
225 | - * http://www.apache.org/licenses/LICENSE-2.0 |
226 | - * |
227 | - * Unless required by applicable law or agreed to in writing, software |
228 | - * distributed under the License is distributed on an "AS IS" BASIS, |
229 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
230 | - * See the License for the specific language governing permissions and |
231 | - * limitations under the License. |
232 | - */ |
233 | - |
234 | -#include "graphviz.h" |
235 | - |
236 | -#include <cassert> |
237 | -#include <fstream> |
238 | -#include <sstream> |
239 | -#ifdef WIN32 |
240 | -# include <io.h> |
241 | -#endif |
242 | - |
243 | -#include <stdio.h> |
244 | -#ifdef WIN32 |
245 | - #include <direct.h> |
246 | - #define GetCurrentDir _getcwd |
247 | -#else |
248 | - #include <unistd.h> |
249 | - #define GetCurrentDir getcwd |
250 | -#endif |
251 | - |
252 | -#include <types.h> |
253 | -#include <graph.h> |
254 | -#include <gvc.h> |
255 | - |
256 | -#include <zorba/diagnostic_list.h> |
257 | -#include <zorba/user_exception.h> |
258 | -#include <zorba/empty_sequence.h> |
259 | -#include <zorba/singleton_item_sequence.h> |
260 | - |
261 | -namespace zorba |
262 | -{ |
263 | - namespace graphvizmodule |
264 | - { |
265 | - |
266 | -/****************************************************************************** |
267 | - *****************************************************************************/ |
268 | -String |
269 | -GraphvizFunction::getURI() const |
270 | -{ |
271 | - return theModule->getURI(); |
272 | -} |
273 | - |
274 | -/****************************************************************************** |
275 | - *****************************************************************************/ |
276 | -std::string |
277 | -GraphvizFunction::getGraphvizTmpFileName(zorba::ItemFactory* aFactory) { |
278 | - char lTmpDir[FILENAME_MAX]; |
279 | - |
280 | - if (!GetCurrentDir(lTmpDir, sizeof(lTmpDir))) |
281 | - { |
282 | - GraphvizFunction::throwErrorWithQName(aFactory, "IM003", "Test"); |
283 | - } |
284 | - zorba::String test(lTmpDir); |
285 | - std::ostringstream lTmpFileNameTemplate; |
286 | - lTmpFileNameTemplate << test << "/zorba.XXXXXX"; |
287 | - |
288 | - char* lTemporaryString = (char*) malloc(lTmpFileNameTemplate.str().size()+1); |
289 | - strcpy(lTemporaryString, lTmpFileNameTemplate.str().c_str()); |
290 | - std::string lRes = mktemp(lTemporaryString); // the replaced string is copied by assigning it to the string |
291 | - free(lTemporaryString); |
292 | - return lRes; |
293 | -} |
294 | - |
295 | -/****************************************************************************** |
296 | - *****************************************************************************/ |
297 | -bool |
298 | -GraphvizFunction::getAttribute(zorba::ItemFactory* aFactory, |
299 | - const char* attrname, |
300 | - const Item& elem, |
301 | - Item& attr) |
302 | -{ |
303 | - Item lIdQName = aFactory->createQName("", "", attrname); |
304 | - |
305 | - Iterator_t lAttributes = elem.getAttributes(); |
306 | - lAttributes->open(); |
307 | - while (lAttributes->next(attr)) { |
308 | - Item lNodeName; |
309 | - attr.getNodeName(lNodeName); |
310 | - if (lNodeName.getLocalName() == lIdQName.getLocalName()) { |
311 | - return true; |
312 | - } |
313 | - } |
314 | - attr = NULL; |
315 | - return false; |
316 | -} |
317 | - |
318 | -/****************************************************************************** |
319 | - *****************************************************************************/ |
320 | -void |
321 | -GraphvizFunction::printTypeAndAttr( |
322 | - ItemFactory* aFactory, |
323 | - const Item& in, |
324 | - std::fstream& os) |
325 | -{ |
326 | - Item lItem; |
327 | - Item lTypeQName = aFactory->createQName("", "", "type"); |
328 | - Item lAttrQName = aFactory->createQName("", "", "attr"); |
329 | - |
330 | - Iterator_t lChildren = in.getChildren(); |
331 | - |
332 | - lChildren->open(); |
333 | - while (lChildren->next(lItem)) { |
334 | - |
335 | - // needed? |
336 | - if (!lItem.isNode()) |
337 | - continue; |
338 | - |
339 | - Item lNodeName; |
340 | - lItem.getNodeName(lNodeName); |
341 | - |
342 | - if (lNodeName.getLocalName() != lAttrQName.getLocalName()) { |
343 | - Item lNameAttr; |
344 | - if (!getAttribute(aFactory, "name", lItem, lNameAttr)) { |
345 | - GraphvizFunction::throwErrorWithQName(aFactory, "IM003", "GXL parse error: attr node does not have a name attribute"); |
346 | - } |
347 | - |
348 | - os << " \"" << lNameAttr.getStringValue() << "\"=\""; |
349 | - |
350 | - // get the values of all bool, string, float, and int elements |
351 | - Iterator_t lAttrChildren = lItem.getChildren(); |
352 | - Item lChild; |
353 | - lAttrChildren->open(); |
354 | - while (lAttrChildren->next(lChild)) { |
355 | - if (!lChild.isNode()) |
356 | - continue; |
357 | - |
358 | - Item lNodeName; |
359 | - lChild.getNodeName(lNodeName); |
360 | - String lChildName = lNodeName.getLocalName(); |
361 | - if ( (lChildName == "bool") || (lChildName == "string") |
362 | - || (lChildName == "float") || (lChildName == "int")) { |
363 | - os << lChild.getStringValue(); |
364 | - } |
365 | - } |
366 | - |
367 | - os << "\"" << std::endl; |
368 | - |
369 | - } else if (lNodeName.getStringValue() == lTypeQName.getStringValue()) { |
370 | - Item lHRefAttr; |
371 | - if (!getAttribute(aFactory, "href", lItem, lHRefAttr)) { |
372 | - GraphvizFunction::throwErrorWithQName(aFactory, "IM003", "GXL parse error: type node does not have a href attribute"); |
373 | - } |
374 | - |
375 | - os << " _gxl_type=\"" << lHRefAttr.getStringValue() << "\"" << std::endl; |
376 | - } |
377 | - } |
378 | -} |
379 | - |
380 | -/****************************************************************************** |
381 | - *****************************************************************************/ |
382 | -void |
383 | -GraphvizFunction::visitNode( |
384 | - ItemFactory* aFactory, |
385 | - const Item& in, std::fstream& os) |
386 | -{ |
387 | - Item lItem; |
388 | - if (!getAttribute(aFactory, "id", in, lItem)) { |
389 | - GraphvizFunction::throwErrorWithQName(aFactory, "IM003", "GXL parse error: node does not have an id attribute"); |
390 | - } |
391 | - |
392 | - // start node with id attribute as name |
393 | - os << " \"" << lItem.getStringValue() << "\" [ " << std::endl; |
394 | - |
395 | - printTypeAndAttr(aFactory, in, os); |
396 | - |
397 | - // end of node |
398 | - os << " ]" << std::endl; |
399 | - |
400 | -} /* GraphvizFunction::visitNode */ |
401 | - |
402 | -/****************************************************************************** |
403 | - *****************************************************************************/ |
404 | -void |
405 | -GraphvizFunction::visitEdge( |
406 | - ItemFactory* aFactory, |
407 | - const Item& in, std::fstream& os) |
408 | -{ |
409 | - Item lIdAttr; |
410 | - Item lFromAttr; |
411 | - Item lToAttr; |
412 | - |
413 | - if (!getAttribute(aFactory, "id", in, lIdAttr)) { |
414 | - GraphvizFunction::throwErrorWithQName(aFactory, "IM003", "GXL parse error: edge does not have an 'id' attribute"); |
415 | - } |
416 | - if (!getAttribute(aFactory, "to", in, lToAttr)) { |
417 | - GraphvizFunction::throwErrorWithQName(aFactory, "IM003", "GXL parse error: edge does not have a 'to' attribute"); |
418 | - } |
419 | - if (!getAttribute(aFactory, "from", in, lFromAttr)) { |
420 | - GraphvizFunction::throwErrorWithQName(aFactory, "IM003", "GXL parse error: edge does not have a 'from' attribute"); |
421 | - } |
422 | - |
423 | - os << " \"" << lFromAttr.getStringValue() << "\" -> \"" << lToAttr.getStringValue() << "\" [ " << std::endl |
424 | - << " _gxl_id=\"" << lIdAttr.getStringValue() << "\"" << std::endl; |
425 | - |
426 | - printTypeAndAttr(aFactory, in, os); |
427 | - |
428 | - os << " ]" << std::endl; |
429 | -} /* GraphvizFunction::visitEdge */ |
430 | - |
431 | -/****************************************************************************** |
432 | - *****************************************************************************/ |
433 | -void |
434 | -GraphvizFunction::printGraph( |
435 | - ItemFactory* aFactory, |
436 | - const Item& in, std::fstream& os) |
437 | -{ |
438 | - // create helper qnames for comparison |
439 | - Item lNodeQName = aFactory->createQName("", "", "node"); |
440 | - Item lEdgeQName = aFactory->createQName("", "", "edge"); |
441 | - Item lRelQName = aFactory->createQName("", "", "rel"); |
442 | - |
443 | - // print the graph with all its children |
444 | - Item lGraphId; |
445 | - if (!getAttribute(aFactory, "id", in, lGraphId)) { |
446 | - GraphvizFunction::throwErrorWithQName(aFactory, "IM003", "GXL parse error: edge does not have an 'id' attribute"); |
447 | - } |
448 | - |
449 | - os << "digraph \"" << lGraphId.getStringValue() << "\" {" << std::endl; |
450 | - |
451 | - // visit nodes and edges (TODO add rel elements) |
452 | - Iterator_t lChildren = in.getChildren(); |
453 | - lChildren->open(); |
454 | - Item item; |
455 | - while (lChildren->next(item)) { |
456 | - Item lNodeName; |
457 | - item.getNodeName(lNodeName); |
458 | - if (lNodeName.getLocalName() == lNodeQName.getLocalName()) { |
459 | - visitNode(aFactory, item, os); |
460 | - } else if (lNodeName.getLocalName() == lEdgeQName.getLocalName()) { |
461 | - visitEdge(aFactory, item, os); |
462 | - } |
463 | - } |
464 | - |
465 | - os << "}" << std::endl; |
466 | -} /* GraphvizFunction::printGraph */ |
467 | - |
468 | -/****************************************************************************** |
469 | - *****************************************************************************/ |
470 | -void |
471 | -GraphvizFunction::gxl2dot( |
472 | - ItemFactory* aFactory, |
473 | - const Item& in, std::fstream& os) |
474 | -{ |
475 | - Item lGXLQName = aFactory->createQName("", "", "gxl"); |
476 | - Item lGraphQName = aFactory->createQName("", "", "graph"); |
477 | - |
478 | - if (!in.isNode()) { |
479 | - GraphvizFunction::throwErrorWithQName(aFactory, "IM003", "GXL parse error: item is not a node"); |
480 | - } |
481 | - |
482 | - Item lNodeName; |
483 | - in.getNodeName(lNodeName); |
484 | - if (lNodeName.getLocalName() != lGXLQName.getLocalName()) { |
485 | - Item lNodeName; |
486 | - in.getNodeName(lNodeName); |
487 | - |
488 | - std::ostringstream lErrorMsg; |
489 | - lErrorMsg << "GXL parse error: only element with name " |
490 | - << lGXLQName.getStringValue() << " allowed (got " << lNodeName.getStringValue() |
491 | - << ")."; |
492 | - GraphvizFunction::throwErrorWithQName(aFactory, "IM003", lErrorMsg.str()); |
493 | - } |
494 | - |
495 | - Iterator_t lGraphs = in.getChildren(); |
496 | - lGraphs->open(); |
497 | - |
498 | - Item lGraph; |
499 | - while(lGraphs->next(lGraph)) { |
500 | - if (!lGraph.isNode()) { |
501 | - GraphvizFunction::throwErrorWithQName(aFactory, "IM003", "GXL parse error: item is not a node"); |
502 | - } |
503 | - |
504 | - lGraph.getNodeName(lNodeName); |
505 | - if (lNodeName.getLocalName() != lGraphQName.getLocalName()) { |
506 | - std::ostringstream lErrorMsg; |
507 | - Item lNodeName; |
508 | - lGraph.getNodeName(lNodeName); |
509 | - |
510 | - lErrorMsg << "GXL parse error: only elements with name " |
511 | - << lGraphQName.getStringValue() << " allowed (got " |
512 | - << lNodeName.getLocalName() << ")."; |
513 | - GraphvizFunction::throwErrorWithQName(aFactory, "IM003", lErrorMsg.str()); |
514 | - } |
515 | - |
516 | - printGraph(aFactory, lGraph, os); |
517 | - |
518 | - } |
519 | - |
520 | -} /* GraphvizFunction::gxl2dot */ |
521 | - |
522 | -/****************************************************************************** |
523 | - *****************************************************************************/ |
524 | -void |
525 | -GraphvizFunction::throwErrorWithQName (ItemFactory* aFactory, |
526 | - const String& aLocalName, |
527 | - const String& aMessage) { |
528 | - String lNamespace = "http://www.zorba-xquery.com/modules/image/error"; |
529 | - Item lQName = aFactory->createQName(lNamespace, "", aLocalName); |
530 | - throw USER_EXCEPTION(lQName, aMessage); |
531 | -} |
532 | - |
533 | -/****************************************************************************** |
534 | - *****************************************************************************/ |
535 | -DotFunction::LazyDotSequence::LazyDotSequence( |
536 | - const DotFunction* aFunc, |
537 | - ItemSequence* aArg) |
538 | - : theFunc(aFunc), |
539 | - theArg(aArg) |
540 | -{ |
541 | -} |
542 | - |
543 | -/****************************************************************************** |
544 | - *****************************************************************************/ |
545 | -Iterator_t DotFunction::LazyDotSequence::getIterator() |
546 | -{ |
547 | - return new DotFunction::LazyDotSequence::InternalIterator(this); |
548 | -} |
549 | - |
550 | -DotFunction::LazyDotSequence::InternalIterator::InternalIterator(LazyDotSequence *item_sequence) : |
551 | - theItemSequence(item_sequence), is_open(false) |
552 | -{ |
553 | - arg_iter = item_sequence->theArg->getIterator(); |
554 | -} |
555 | - |
556 | -void DotFunction::LazyDotSequence::InternalIterator::open() |
557 | -{ |
558 | - is_open = true; |
559 | - arg_iter->open(); |
560 | -} |
561 | - |
562 | -void DotFunction::LazyDotSequence::InternalIterator::close() |
563 | -{ |
564 | - is_open = false; |
565 | - arg_iter->close(); |
566 | -} |
567 | - |
568 | -bool DotFunction::LazyDotSequence::InternalIterator::isOpen() const |
569 | -{ |
570 | - return is_open; |
571 | -} |
572 | - |
573 | -bool |
574 | -DotFunction::LazyDotSequence::InternalIterator::next(Item& aItem) |
575 | -{ |
576 | - if(!is_open) |
577 | - { |
578 | - GraphvizFunction::throwErrorWithQName(theItemSequence->theFunc->theModule->getItemFactory(), "IM003", "DotFunction::LazyDotSequence Iterator consumed without open"); |
579 | - } |
580 | - Item lItem; |
581 | - Agraph_t *lGraph = 0; |
582 | - String lGraphInput; |
583 | - GVC_t *lGvc = 0; |
584 | - std::ifstream lSVGFile; |
585 | - |
586 | - if (!arg_iter->next(lItem)) // exhausted |
587 | - return false; |
588 | - |
589 | - lGvc = gvContext(); |
590 | - |
591 | - try { |
592 | - lGraphInput = lItem.getStringValue(); |
593 | - |
594 | - lGraph = agmemread(const_cast<char*>(lGraphInput.c_str())); |
595 | - if (!lGraph) { |
596 | - GraphvizFunction::throwErrorWithQName(theItemSequence->theFunc->theModule->getItemFactory(), "IM003", "could not read input"); |
597 | - } |
598 | - |
599 | - if ( gvLayout(lGvc, lGraph, const_cast<char*>("dot")) != 0 ) { |
600 | - GraphvizFunction::throwErrorWithQName(theItemSequence->theFunc->theModule->getItemFactory(), "IM003", "could not generate layout"); |
601 | - } |
602 | - |
603 | - std::string lTmpFile = theItemSequence->theFunc->getGraphvizTmpFileName(theItemSequence->theFunc->theModule->getItemFactory()); |
604 | - |
605 | - if ( gvRenderFilename(lGvc, lGraph, const_cast<char*>("svg"), |
606 | - const_cast<char*>(lTmpFile.c_str())) != 0 ) { |
607 | - GraphvizFunction::throwErrorWithQName(theItemSequence->theFunc->theModule->getItemFactory(), "IM003", "could not render graph"); |
608 | - } |
609 | - |
610 | - lSVGFile.open(lTmpFile.c_str()); |
611 | - if (lSVGFile.bad()) { |
612 | - std::ostringstream lErrorMsg; |
613 | - lErrorMsg << "could not read from file " |
614 | - << lTmpFile.c_str(); |
615 | - GraphvizFunction::throwErrorWithQName(theItemSequence->theFunc->theModule->getItemFactory(), "IM003", lErrorMsg.str()); |
616 | - } |
617 | - |
618 | - aItem = Zorba::getInstance(0)->getXmlDataManager()->parseXML(lSVGFile); |
619 | - |
620 | - gvFreeLayout(lGvc, lGraph); |
621 | - agclose(lGraph); |
622 | - gvFreeContext(lGvc); |
623 | - |
624 | - remove(lTmpFile.c_str()); |
625 | - } catch (...) { |
626 | - aItem = NULL; |
627 | - if (lGraph) { |
628 | - gvFreeLayout(lGvc, lGraph); |
629 | - agclose(lGraph); |
630 | - } |
631 | - gvFreeContext(lGvc); |
632 | - throw; |
633 | - } |
634 | - |
635 | - return true; |
636 | - |
637 | -} /* DotFunction::LazyDotSequence::next */ |
638 | - |
639 | -/****************************************************************************** |
640 | - *****************************************************************************/ |
641 | -Iterator_t GxlFunction::LazyGxlSequence::getIterator() |
642 | -{ |
643 | - return new GxlFunction::LazyGxlSequence::InternalIterator(this); |
644 | -} |
645 | - |
646 | -GxlFunction::LazyGxlSequence::InternalIterator::InternalIterator(LazyGxlSequence *item_sequence) : |
647 | - theItemSequence(item_sequence), is_open(false) |
648 | -{ |
649 | - arg_iter = item_sequence->theArg->getIterator(); |
650 | -} |
651 | - |
652 | -void GxlFunction::LazyGxlSequence::InternalIterator::open() |
653 | -{ |
654 | - is_open = true; |
655 | - arg_iter->open(); |
656 | -} |
657 | - |
658 | -void GxlFunction::LazyGxlSequence::InternalIterator::close() |
659 | -{ |
660 | - is_open = false; |
661 | - arg_iter->close(); |
662 | -} |
663 | - |
664 | -bool GxlFunction::LazyGxlSequence::InternalIterator::isOpen() const |
665 | -{ |
666 | - return is_open; |
667 | -} |
668 | - |
669 | -bool |
670 | -GxlFunction::LazyGxlSequence::InternalIterator::next(Item& aItem) |
671 | -{ |
672 | - if(!is_open) |
673 | - { |
674 | - GraphvizFunction::throwErrorWithQName(theItemSequence->theFunc->theModule->getItemFactory(), "IM003", "GxlFunction::LazyGxlSequence Iterator consumed without open"); |
675 | - } |
676 | - Item lItem; |
677 | - Agraph_t *lGraph = 0; |
678 | - GVC_t *lGvc = 0; |
679 | - std::fstream lSVGFile; |
680 | - FILE *lFile = 0; |
681 | - |
682 | - if (!arg_iter->next(lItem)) // exhausted |
683 | - return false; |
684 | - |
685 | - lGvc = gvContext(); |
686 | - |
687 | - try { |
688 | - |
689 | - std::string lTmpFile = theItemSequence->theFunc->getGraphvizTmpFileName(theItemSequence->theFunc->theModule->getItemFactory()); |
690 | - lSVGFile.open(lTmpFile.c_str(), |
691 | - std::fstream::in | std::fstream::out | std::fstream::trunc); |
692 | - |
693 | - gxl2dot(theItemSequence->theFunc->theModule->getItemFactory(), lItem, lSVGFile); |
694 | - lSVGFile.close(); |
695 | - |
696 | - lFile = fopen(lTmpFile.c_str(), "r"); |
697 | - if (!lFile) { |
698 | - std::ostringstream lErrorMsg; |
699 | - lErrorMsg << "could not read from file " << lTmpFile.c_str(); |
700 | - GraphvizFunction::throwErrorWithQName(theItemSequence->theFunc->theModule->getItemFactory(), "IM003", lErrorMsg.str()); |
701 | - } |
702 | - |
703 | - lGraph = agread(lFile); |
704 | - fclose(lFile); |
705 | - |
706 | - if (!lGraph) { |
707 | - GraphvizFunction::throwErrorWithQName(theItemSequence->theFunc->theModule->getItemFactory(), "IM003", "could not read input"); |
708 | - } |
709 | - |
710 | - int blub = gvLayout(lGvc, lGraph, const_cast<char*>("dot")); |
711 | - if ( blub != 0 ) { |
712 | - GraphvizFunction::throwErrorWithQName(theItemSequence->theFunc->theModule->getItemFactory(), "IM003", "could not generate layout"); |
713 | - } |
714 | - |
715 | - if ( gvRenderFilename(lGvc, lGraph, const_cast<char*>("svg"), |
716 | - const_cast<char*>(lTmpFile.c_str())) != 0 ) { |
717 | - GraphvizFunction::throwErrorWithQName(theItemSequence->theFunc->theModule->getItemFactory(), "IM003", "could not render graph"); |
718 | - } |
719 | - |
720 | - lSVGFile.open(lTmpFile.c_str(), std::ifstream::in); |
721 | - if (lSVGFile.bad()) { |
722 | - std::ostringstream lErrorMsg; |
723 | - lErrorMsg << "could not read from file " << lTmpFile.c_str(); |
724 | - GraphvizFunction::throwErrorWithQName(theItemSequence->theFunc->theModule->getItemFactory(), "IM003", lErrorMsg.str()); |
725 | - } |
726 | - |
727 | - aItem = Zorba::getInstance(0)->getXmlDataManager()->parseXML(lSVGFile); |
728 | - |
729 | - gvFreeLayout(lGvc, lGraph); |
730 | - agclose(lGraph); |
731 | - gvFreeContext(lGvc); |
732 | - |
733 | - remove(lTmpFile.c_str()); |
734 | - } catch (...) { |
735 | - if (lGraph) { |
736 | - gvFreeLayout(lGvc, lGraph); |
737 | - agclose(lGraph); |
738 | - } |
739 | - gvFreeContext(lGvc); |
740 | - throw; |
741 | - } |
742 | - |
743 | - return true; |
744 | - |
745 | -} /* GxlFunction::LazyGxlSequence::next */ |
746 | - |
747 | -/****************************************************************************** |
748 | - *****************************************************************************/ |
749 | -GxlFunction::LazyGxlSequence::LazyGxlSequence( |
750 | - const GxlFunction* aFunc, |
751 | - ItemSequence* aArg) |
752 | - : theFunc(aFunc), |
753 | - theArg(aArg) |
754 | -{ |
755 | -} |
756 | - |
757 | -/****************************************************************************** |
758 | - *****************************************************************************/ |
759 | -zorba::ItemSequence_t |
760 | -DotFunction::evaluate( |
761 | - const Arguments_t& aArgs, |
762 | - const zorba::StaticContext* aSctx, |
763 | - const zorba::DynamicContext *aDctx) const |
764 | -{ |
765 | - return ItemSequence_t(new LazyDotSequence(this, aArgs[0])); |
766 | -} /* DotFunction::evaluate */ |
767 | - |
768 | -/****************************************************************************** |
769 | - *****************************************************************************/ |
770 | -zorba::ItemSequence_t |
771 | -GxlFunction::evaluate( |
772 | - const Arguments_t& aArgs, |
773 | - const zorba::StaticContext* aSctx, |
774 | - const zorba::DynamicContext *aDctx) const |
775 | -{ |
776 | - return ItemSequence_t(new LazyGxlSequence(this, aArgs[0])); |
777 | -} /* GxlFunction::evaluate */ |
778 | - |
779 | -/****************************************************************************** |
780 | - *****************************************************************************/ |
781 | -ItemFactory* GraphvizModule::theFactory = 0; |
782 | - |
783 | -const char* GraphvizModule::theModule = "http://www.zorba-xquery.com/modules/image/graphviz"; |
784 | - |
785 | -GraphvizModule::~GraphvizModule() |
786 | -{ |
787 | - for (FuncMap_t::const_iterator lIter = theFunctions.begin(); |
788 | - lIter != theFunctions.end(); ++lIter) { |
789 | - delete lIter->second; |
790 | - } |
791 | - theFunctions.clear(); |
792 | -} |
793 | - |
794 | -ExternalFunction* |
795 | -GraphvizModule::getExternalFunction(const String& aLocalname) |
796 | -{ |
797 | - ExternalFunction*& lFunc = theFunctions[aLocalname]; |
798 | - if (!lFunc) { |
799 | - if (aLocalname == "dot") |
800 | - { |
801 | - lFunc = new DotFunction(this); |
802 | - } else if (aLocalname == "gxl") |
803 | - { |
804 | - lFunc = new GxlFunction(this); |
805 | - } |
806 | - } |
807 | - return lFunc; |
808 | -} |
809 | - |
810 | -void |
811 | -GraphvizModule::destroy() |
812 | -{ |
813 | - if (!dynamic_cast<GraphvizModule*>(this)) { |
814 | - return; |
815 | - } |
816 | - delete this; |
817 | -} |
818 | - |
819 | - } /* namespace zorba */ |
820 | -} /* namespace graphvizmodule */ |
821 | - |
822 | -/****************************************************************************** |
823 | - *****************************************************************************/ |
824 | -#ifdef WIN32 |
825 | -# define DLL_EXPORT __declspec(dllexport) |
826 | -#else |
827 | -# define DLL_EXPORT __attribute__ ((visibility("default"))) |
828 | -#endif |
829 | - |
830 | -extern "C" DLL_EXPORT zorba::ExternalModule* createModule() { |
831 | - return new zorba::graphvizmodule::GraphvizModule(); |
832 | -} |
833 | |
834 | === removed file 'src/com/zorba-xquery/www/modules/image/graphviz.xq.src/graphviz.h' |
835 | --- src/com/zorba-xquery/www/modules/image/graphviz.xq.src/graphviz.h 2012-07-20 20:25:12 +0000 |
836 | +++ src/com/zorba-xquery/www/modules/image/graphviz.xq.src/graphviz.h 1970-01-01 00:00:00 +0000 |
837 | @@ -1,234 +0,0 @@ |
838 | -/* |
839 | - * Copyright 2006-2008 The FLWOR Foundation. |
840 | - * |
841 | - * Licensed under the Apache License, Version 2.0 (the "License"); |
842 | - * you may not use this file except in compliance with the License. |
843 | - * You may obtain a copy of the License at |
844 | - * |
845 | - * http://www.apache.org/licenses/LICENSE-2.0 |
846 | - * |
847 | - * Unless required by applicable law or agreed to in writing, software |
848 | - * distributed under the License is distributed on an "AS IS" BASIS, |
849 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
850 | - * See the License for the specific language governing permissions and |
851 | - * limitations under the License. |
852 | - */ |
853 | - |
854 | -#ifndef ZORBA_GRAPHVIZMODULE_GRAPHVIZ_H |
855 | -#define ZORBA_GRAPHVIZMODULE_GRAPHVIZ_H |
856 | - |
857 | -#include <map> |
858 | - |
859 | -#include <zorba/iterator.h> |
860 | -#include <zorba/zorba.h> |
861 | -#include <zorba/function.h> |
862 | -#include <zorba/external_module.h> |
863 | - |
864 | -namespace zorba |
865 | -{ |
866 | -namespace graphvizmodule |
867 | -{ |
868 | - |
869 | -class GraphvizModule; |
870 | - |
871 | -/****************************************************************************** |
872 | - *****************************************************************************/ |
873 | -class GraphvizFunction : public ContextualExternalFunction |
874 | -{ |
875 | - protected: |
876 | - const GraphvizModule* theModule; |
877 | - |
878 | - GraphvizFunction(const GraphvizModule* aModule) |
879 | - : theModule(aModule) {} |
880 | - |
881 | - static std::string |
882 | - getGraphvizTmpFileName(zorba::ItemFactory* aFactory); |
883 | - |
884 | - static bool |
885 | - getAttribute(zorba::ItemFactory* aFactory, |
886 | - const char* attrname, |
887 | - const zorba::Item& elem, |
888 | - zorba::Item& attr); |
889 | - |
890 | - static void |
891 | - printTypeAndAttr(zorba::ItemFactory* aFactory, |
892 | - const zorba::Item& in, |
893 | - std::fstream& os); |
894 | - |
895 | - static void |
896 | - visitNode(zorba::ItemFactory* aFactory, |
897 | - const zorba::Item& in, std::fstream& os); |
898 | - |
899 | - static void |
900 | - visitEdge(zorba::ItemFactory* aFactory, |
901 | - const zorba::Item& in, std::fstream& os); |
902 | - |
903 | - static void |
904 | - printGraph(zorba::ItemFactory* aFactory, |
905 | - const zorba::Item& in, std::fstream& os); |
906 | - |
907 | - static void |
908 | - gxl2dot(zorba::ItemFactory* aFactory, |
909 | - const zorba::Item& in, std::fstream& os); |
910 | - |
911 | - static void |
912 | - throwErrorWithQName (zorba::ItemFactory* aFactory, |
913 | - const String& aLocalName, |
914 | - const String& aMessage); |
915 | - |
916 | - public: |
917 | - |
918 | - virtual String |
919 | - getURI() const; |
920 | -}; |
921 | - |
922 | -/****************************************************************************** |
923 | - *****************************************************************************/ |
924 | -class DotFunction : public GraphvizFunction |
925 | -{ |
926 | -public: |
927 | - DotFunction(const GraphvizModule* aModule) |
928 | - : GraphvizFunction(aModule) {} |
929 | - |
930 | - virtual ~DotFunction() {} |
931 | - |
932 | - virtual String |
933 | - getLocalName() const { return "dot"; } |
934 | - |
935 | - virtual zorba::ItemSequence_t |
936 | - evaluate(const Arguments_t&, |
937 | - const zorba::StaticContext*, |
938 | - const zorba::DynamicContext*) const; |
939 | - |
940 | -protected: |
941 | - class LazyDotSequence : public zorba::ItemSequence |
942 | - { |
943 | - class InternalIterator : public Iterator |
944 | - { |
945 | - private: |
946 | - LazyDotSequence *theItemSequence; |
947 | - Iterator_t arg_iter; |
948 | - bool is_open; |
949 | - public: |
950 | - InternalIterator(LazyDotSequence *item_sequence); |
951 | - |
952 | - virtual void open(); |
953 | - virtual bool next(Item& aItem); |
954 | - virtual void close(); |
955 | - virtual bool isOpen() const; |
956 | - }; |
957 | - public: |
958 | - LazyDotSequence(const DotFunction*, |
959 | - ItemSequence* aArg); |
960 | - |
961 | - virtual Iterator_t getIterator(); |
962 | - |
963 | - protected: |
964 | - const DotFunction* theFunc; |
965 | - ItemSequence* theArg; |
966 | - }; |
967 | -}; |
968 | - |
969 | -/****************************************************************************** |
970 | - *****************************************************************************/ |
971 | -class GxlFunction : public GraphvizFunction |
972 | -{ |
973 | -public: |
974 | - GxlFunction(const GraphvizModule* aModule) |
975 | - : GraphvizFunction(aModule) {} |
976 | - |
977 | - virtual ~GxlFunction() {} |
978 | - |
979 | - virtual String |
980 | - getLocalName() const { return "gxl"; } |
981 | - |
982 | - virtual zorba::ItemSequence_t |
983 | - evaluate(const Arguments_t&, |
984 | - const zorba::StaticContext*, |
985 | - const zorba::DynamicContext*) const; |
986 | - |
987 | -protected: |
988 | - class LazyGxlSequence : public zorba::ItemSequence |
989 | - { |
990 | - class InternalIterator : public Iterator |
991 | - { |
992 | - private: |
993 | - LazyGxlSequence *theItemSequence; |
994 | - Iterator_t arg_iter; |
995 | - bool is_open; |
996 | - public: |
997 | - InternalIterator(LazyGxlSequence *item_sequence); |
998 | - |
999 | - virtual void open(); |
1000 | - virtual bool next(Item& aItem); |
1001 | - virtual void close(); |
1002 | - virtual bool isOpen() const; |
1003 | - }; |
1004 | - public: |
1005 | - LazyGxlSequence(const GxlFunction*, |
1006 | - ItemSequence* aArg); |
1007 | - |
1008 | - Iterator_t getIterator(); |
1009 | - |
1010 | - protected: |
1011 | - const GxlFunction* theFunc; |
1012 | - ItemSequence* theArg; |
1013 | - }; |
1014 | -}; |
1015 | - |
1016 | -/****************************************************************************** |
1017 | - ******************************************************************************/ |
1018 | -class GraphvizModule : public ExternalModule |
1019 | -{ |
1020 | -private: |
1021 | - static ItemFactory* theFactory; |
1022 | - |
1023 | -protected: |
1024 | - class ltstr |
1025 | - { |
1026 | - public: |
1027 | - |
1028 | - |
1029 | - bool operator()(const String& s1, const String& s2) const |
1030 | - { |
1031 | - return s1.compare(s2) < 0; |
1032 | - } |
1033 | - }; |
1034 | - |
1035 | - typedef std::map<String, ExternalFunction*, ltstr> FuncMap_t; |
1036 | - |
1037 | - FuncMap_t theFunctions; |
1038 | - |
1039 | -public: |
1040 | - |
1041 | - static const char* theModule; |
1042 | - |
1043 | - virtual ~GraphvizModule(); |
1044 | - |
1045 | - virtual String |
1046 | - getURI() const |
1047 | - { |
1048 | - return theModule; |
1049 | - } |
1050 | - |
1051 | - virtual ExternalFunction* |
1052 | - getExternalFunction(const String& aLocalname); |
1053 | - |
1054 | - virtual void |
1055 | - destroy(); |
1056 | - |
1057 | - static ItemFactory* |
1058 | - getItemFactory() |
1059 | - { |
1060 | - if(!theFactory) |
1061 | - { |
1062 | - theFactory = Zorba::getInstance(0)->getItemFactory(); |
1063 | - } |
1064 | - return theFactory; |
1065 | - } |
1066 | -}; |
1067 | - |
1068 | -} /* namespace zorba */ |
1069 | -} /* namespace graphvizmodule */ |
1070 | - |
1071 | -#endif |
1072 | |
1073 | === removed directory 'test_graphviz' |
1074 | === removed directory 'test_graphviz/ExpQueryResults' |
1075 | === removed file 'test_graphviz/ExpQueryResults/dot.xml.res' |
1076 | --- test_graphviz/ExpQueryResults/dot.xml.res 2012-07-20 20:25:12 +0000 |
1077 | +++ test_graphviz/ExpQueryResults/dot.xml.res 1970-01-01 00:00:00 +0000 |
1078 | @@ -1,1 +0,0 @@ |
1079 | -true |
1080 | \ No newline at end of file |
1081 | |
1082 | === removed directory 'test_graphviz/Queries' |
1083 | === removed file 'test_graphviz/Queries/dot.xq' |
1084 | --- test_graphviz/Queries/dot.xq 2012-07-20 20:25:12 +0000 |
1085 | +++ test_graphviz/Queries/dot.xq 1970-01-01 00:00:00 +0000 |
1086 | @@ -1,3 +0,0 @@ |
1087 | -import module namespace dot = "http://www.zorba-xquery.com/modules/image/graphviz"; |
1088 | - |
1089 | -fn:exists(dot:dot("digraph mygraph { p -> q }", ())) |
1090 | \ No newline at end of file |
Validation queue starting for merge proposal. zorbatest. lambda. nu:8080/ remotequeue/ image-module- alone-2012- 08-04T01- 19-54.82Z/ log.html
Log at: http://