forked from enlightenment/efl
Compare commits
4 Commits
master
...
devs/felip
Author | SHA1 | Date |
---|---|---|
Guilherme Lepsch | 57e390e153 | |
Guilherme Lepsch | 802cddc8d3 | |
Guilherme Lepsch | 258ced1b38 | |
Guilherme Lepsch | 473a0f7f67 |
28
Makefile.am
28
Makefile.am
|
@ -151,7 +151,9 @@ pc/edje.pc \
|
|||
pc/emotion.pc \
|
||||
pc/ethumb.pc \
|
||||
pc/ethumb_client.pc \
|
||||
pc/elocation.pc
|
||||
pc/elocation.pc \
|
||||
pc/eflat_xml_model.pc \
|
||||
pc/esoap_model.pc
|
||||
|
||||
if HAVE_CXX11
|
||||
pkgconfig_DATA += \
|
||||
|
@ -163,7 +165,9 @@ pc/eolian-cxx.pc \
|
|||
pc/edje-cxx.pc \
|
||||
pc/eet-cxx.pc \
|
||||
pc/eo-cxx.pc \
|
||||
pc/eio-cxx.pc
|
||||
pc/eio-cxx.pc \
|
||||
pc/eflat_xml_model-cxx.pc \
|
||||
pc/esoap_model-cxx.pc
|
||||
endif
|
||||
|
||||
if HAVE_ELUA
|
||||
|
@ -382,6 +386,26 @@ emile_cmakeconfig_DATA = \
|
|||
cmakeconfig/EmileConfig.cmake \
|
||||
cmakeconfig/EmileConfigVersion.cmake
|
||||
|
||||
eflat_xml_model_cxx_cmakeconfigdir = $(libdir)/cmake/EflatXmlModelCxx/
|
||||
eflat_xml_model_cxx_cmakeconfig_DATA = \
|
||||
cmakeconfig/EflatXmlModelCxxConfig.cmake \
|
||||
cmakeconfig/EflatXmlModelCxxConfigVersion.cmake
|
||||
|
||||
eflat_xml_model_cmakeconfigdir = $(libdir)/cmake/EflatXmlModel/
|
||||
eflat_xml_model_cmakeconfig_DATA = \
|
||||
cmakeconfig/EflatXmlModelConfig.cmake \
|
||||
cmakeconfig/EflatXmlModelConfigVersion.cmake
|
||||
|
||||
esoap_model_cxx_cmakeconfigdir = $(libdir)/cmake/EsoapModelCxx/
|
||||
esoap_model_cxx_cmakeconfig_DATA = \
|
||||
cmakeconfig/EsoapModelCxxConfig.cmake \
|
||||
cmakeconfig/EsoapModelCxxConfigVersion.cmake
|
||||
|
||||
esoap_model_cmakeconfigdir = $(libdir)/cmake/EsoapModel/
|
||||
esoap_model_cmakeconfig_DATA = \
|
||||
cmakeconfig/EsoapModelConfig.cmake \
|
||||
cmakeconfig/EsoapModelConfigVersion.cmake
|
||||
|
||||
# D-Bus services:
|
||||
|
||||
servicedir = @dbusservicedir@
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
# - Try to find eflat_xml_model
|
||||
# Once done this will define
|
||||
# EFLAT_XML_MODEL_FOUND - System has eflat_xml_model
|
||||
# EFLAT_XML_MODEL_INCLUDE_DIRS - The eflat_xml_model include directories
|
||||
# EFLAT_XML_MODEL_LIBRARIES - The libraries needed to use eflat_xml_model
|
||||
# EFLAT_XML_MODEL_DEFINITIONS - Compiler switches required for using eflat_xml_model
|
||||
|
||||
set(MY_PKG eflat_xml_model)
|
||||
|
||||
find_package(PkgConfig)
|
||||
if ("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER "2.8.1")
|
||||
# "QUIET" was introduced in 2.8.2
|
||||
set(_QUIET QUIET)
|
||||
endif ()
|
||||
pkg_check_modules(PC_LIBEFLAT_XML_MODEL ${_QUIET} ${MY_PKG})
|
||||
|
||||
find_library(EFLAT_XML_MODEL_LIBRARY
|
||||
NAMES ${PC_LIBEFLAT_XML_MODEL_LIBRARIES}
|
||||
HINTS ${PC_LIBEFLAT_XML_MODEL_LIBDIR} ${PC_LIBEFLAT_XML_MODEL_LIBRARY_DIRS} )
|
||||
|
||||
set(EFLAT_XML_MODEL_DEFINITIONS ${PC_LIBEFLAT_XML_MODEL_CFLAGS_OTHER})
|
||||
set(EFLAT_XML_MODEL_LIBRARIES ${EFLAT_XML_MODEL_LIBRARY})
|
||||
set(EFLAT_XML_MODEL_INCLUDE_DIRS ${PC_LIBEFLAT_XML_MODEL_INCLUDE_DIRS})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
# handle the QUIETLY and REQUIRED arguments and set EFLAT_XML_MODEL_FOUND to TRUE
|
||||
# if all listed variables are TRUE
|
||||
find_package_handle_standard_args(${MY_PKG} DEFAULT_MSG
|
||||
EFLAT_XML_MODEL_LIBRARIES EFLAT_XML_MODEL_INCLUDE_DIRS)
|
||||
|
||||
mark_as_advanced(EFLAT_XML_MODEL_INCLUDE_DIRS EFLAT_XML_MODEL_LIBRARY EFLAT_XML_MODEL_LIBRARIES EFLAT_XML_MODEL_DEFINITIONS)
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
# - Try to find eflat_xml_model
|
||||
# Once done this will define
|
||||
# EFLAT_XML_MODEL_CXX_FOUND - System has eflat_xml_model
|
||||
# EFLAT_XML_MODEL_CXX_INCLUDE_DIRS - The eflat_xml_model include directories
|
||||
# EFLAT_XML_MODEL_CXX_LIBRARIES - The libraries needed to use eflat_xml_model
|
||||
# EFLAT_XML_MODEL_CXX_DEFINITIONS - Compiler switches required for using eflat_xml_model
|
||||
|
||||
set(MY_PKG eflat_xml_model_cxx)
|
||||
|
||||
find_package(PkgConfig)
|
||||
if ("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER "2.8.1")
|
||||
# "QUIET" was introduced in 2.8.2
|
||||
set(_QUIET QUIET)
|
||||
endif ()
|
||||
pkg_check_modules(PC_EFLAT_XML_MODEL_CXX ${_QUIET} ${MY_PKG})
|
||||
find_library(EFLAT_XML_MODEL_CXX_LIBRARY
|
||||
NAMES ${PC_EFLAT_XML_MODEL_CXX_LIBRARIES}
|
||||
HINTS ${PC_EFLAT_XML_MODEL_CXX_LIBDIR} ${PC_EFLAT_XML_MODEL_CXX_LIBRARY_DIRS} )
|
||||
|
||||
set(EFLAT_XML_MODEL_CXX_DEFINITIONS ${PC_EFLAT_XML_MODEL_CXX_CFLAGS_OTHER})
|
||||
set(EFLAT_XML_MODEL_CXX_LIBRARIES ${EFLAT_XML_MODEL_CXX_LIBRARY})
|
||||
set(EFLAT_XML_MODEL_CXX_INCLUDE_DIRS ${PC_EFLAT_XML_MODEL_CXX_INCLUDE_DIRS})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
# handle the QUIETLY and REQUIRED arguments and set EFLAT_XML_MODEL_CXX_FOUND to TRUE
|
||||
# if all listed variables are TRUE
|
||||
find_package_handle_standard_args(${MY_PKG} DEFAULT_MSG
|
||||
EFLAT_XML_MODEL_CXX_LIBRARIES EFLAT_XML_MODEL_CXX_INCLUDE_DIRS)
|
||||
|
||||
mark_as_advanced(EFLAT_XML_MODEL_CXX_INCLUDE_DIRS EFLAT_XML_MODEL_CXX_LIBRARY EFLAT_XML_MODEL_CXX_LIBRARIES EFLAT_XML_MODEL_CXX_DEFINITIONS)
|
|
@ -0,0 +1,32 @@
|
|||
# - Try to find esoap_model
|
||||
# Once done this will define
|
||||
# ESOAP_MODEL_FOUND - System has esoap_model
|
||||
# ESOAP_MODEL_INCLUDE_DIRS - The esoap_model include directories
|
||||
# ESOAP_MODEL_LIBRARIES - The libraries needed to use esoap_model
|
||||
# ESOAP_MODEL_DEFINITIONS - Compiler switches required for using esoap_model
|
||||
|
||||
set(MY_PKG esoap_model)
|
||||
|
||||
find_package(PkgConfig)
|
||||
if ("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER "2.8.1")
|
||||
# "QUIET" was introduced in 2.8.2
|
||||
set(_QUIET QUIET)
|
||||
endif ()
|
||||
pkg_check_modules(PC_LIBESOAP_MODEL ${_QUIET} ${MY_PKG})
|
||||
|
||||
find_library(ESOAP_MODEL_LIBRARY
|
||||
NAMES ${PC_LIBESOAP_MODEL_LIBRARIES}
|
||||
HINTS ${PC_LIBESOAP_MODEL_LIBDIR} ${PC_LIBESOAP_MODEL_LIBRARY_DIRS} )
|
||||
|
||||
set(ESOAP_MODEL_DEFINITIONS ${PC_LIBESOAP_MODEL_CFLAGS_OTHER})
|
||||
set(ESOAP_MODEL_LIBRARIES ${ESOAP_MODEL_LIBRARY})
|
||||
set(ESOAP_MODEL_INCLUDE_DIRS ${PC_LIBESOAP_MODEL_INCLUDE_DIRS})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
# handle the QUIETLY and REQUIRED arguments and set ESOAP_MODEL_FOUND to TRUE
|
||||
# if all listed variables are TRUE
|
||||
find_package_handle_standard_args(${MY_PKG} DEFAULT_MSG
|
||||
ESOAP_MODEL_LIBRARIES ESOAP_MODEL_INCLUDE_DIRS)
|
||||
|
||||
mark_as_advanced(ESOAP_MODEL_INCLUDE_DIRS ESOAP_MODEL_LIBRARY ESOAP_MODEL_LIBRARIES ESOAP_MODEL_DEFINITIONS)
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
# - Try to find esoap_model
|
||||
# Once done this will define
|
||||
# ESOAP_MODEL_CXX_FOUND - System has esoap_model
|
||||
# ESOAP_MODEL_CXX_INCLUDE_DIRS - The esoap_model include directories
|
||||
# ESOAP_MODEL_CXX_LIBRARIES - The libraries needed to use esoap_model
|
||||
# ESOAP_MODEL_CXX_DEFINITIONS - Compiler switches required for using esoap_model
|
||||
|
||||
set(MY_PKG esoap_model_cxx)
|
||||
|
||||
find_package(PkgConfig)
|
||||
if ("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER "2.8.1")
|
||||
# "QUIET" was introduced in 2.8.2
|
||||
set(_QUIET QUIET)
|
||||
endif ()
|
||||
pkg_check_modules(PC_ESOAP_MODEL_CXX ${_QUIET} ${MY_PKG})
|
||||
find_library(ESOAP_MODEL_CXX_LIBRARY
|
||||
NAMES ${PC_ESOAP_MODEL_CXX_LIBRARIES}
|
||||
HINTS ${PC_ESOAP_MODEL_CXX_LIBDIR} ${PC_ESOAP_MODEL_CXX_LIBRARY_DIRS} )
|
||||
|
||||
set(ESOAP_MODEL_CXX_DEFINITIONS ${PC_ESOAP_MODEL_CXX_CFLAGS_OTHER})
|
||||
set(ESOAP_MODEL_CXX_LIBRARIES ${ESOAP_MODEL_CXX_LIBRARY})
|
||||
set(ESOAP_MODEL_CXX_INCLUDE_DIRS ${PC_ESOAP_MODEL_CXX_INCLUDE_DIRS})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
# handle the QUIETLY and REQUIRED arguments and set ESOAP_MODEL_CXX_FOUND to TRUE
|
||||
# if all listed variables are TRUE
|
||||
find_package_handle_standard_args(${MY_PKG} DEFAULT_MSG
|
||||
ESOAP_MODEL_CXX_LIBRARIES ESOAP_MODEL_CXX_INCLUDE_DIRS)
|
||||
|
||||
mark_as_advanced(ESOAP_MODEL_CXX_INCLUDE_DIRS ESOAP_MODEL_CXX_LIBRARY ESOAP_MODEL_CXX_LIBRARIES ESOAP_MODEL_CXX_DEFINITIONS)
|
102
configure.ac
102
configure.ac
|
@ -3917,7 +3917,7 @@ EFL_INTERNAL_DEPEND_PKG([ECORE_EVAS], [emile])
|
|||
ECORE_EVAS_MODULE([extn], [${want_ecore_evas_extn}])
|
||||
ECORE_EVAS_MODULE([ews], [yes])
|
||||
ECORE_EVAS_MODULE([fb], [${want_fb}])
|
||||
ECORE_EVAS_MODULE([drm], [${want_drm}],
|
||||
ECORE_EVAS_MODULE([drm], [${want_drm}],
|
||||
[EFL_OPTIONAL_INTERNAL_DEPEND_PKG([ECORE_EVAS], [${want_drm}], [ecore-drm])])
|
||||
ECORE_EVAS_MODULE([gl-drm], [${want_gl_drm}],
|
||||
[EFL_OPTIONAL_INTERNAL_DEPEND_PKG([ECORE_EVAS], [${want_gl_drm}], [ecore-drm])])
|
||||
|
@ -4566,6 +4566,92 @@ EFL_ADD_LIBS([ELOCATION], [-lm])
|
|||
EFL_LIB_END([Elocation])
|
||||
#### End of Elocation
|
||||
|
||||
|
||||
|
||||
#### Eflat_Xml_Model
|
||||
EFL_LIB_START([Eflat_Xml_Model])
|
||||
|
||||
### Additional options to configure
|
||||
|
||||
### Default values
|
||||
|
||||
### Checks for programs
|
||||
|
||||
### Checks for libraries
|
||||
EFL_INTERNAL_DEPEND_PKG([EFLAT_XML_MODEL], [eo])
|
||||
EFL_INTERNAL_DEPEND_PKG([EFLAT_XML_MODEL], [efl])
|
||||
EFL_INTERNAL_DEPEND_PKG([EFLAT_XML_MODEL], [ecore])
|
||||
|
||||
EFL_EVAL_PKGS([EFLAT_XML_MODEL])
|
||||
|
||||
### Checks for header files
|
||||
|
||||
### Checks for types
|
||||
|
||||
### Checks for structures
|
||||
|
||||
### Checks for compiler characteristics
|
||||
|
||||
### Checks for linker characteristics
|
||||
|
||||
### Checks for library functions
|
||||
|
||||
EFL_LIB_END([Eflat_Xml_Model])
|
||||
#### End of Eflat_Xml_Model
|
||||
|
||||
#### Eflat_Xml_Model CXX
|
||||
EFL_LIB_START([Eflat_Xml_Model_Cxx])
|
||||
|
||||
EFL_EVAL_PKGS([EFLAT_XML_MODEL_CXX])
|
||||
|
||||
EFL_LIB_END([Eflat_Xml_Model_Cxx])
|
||||
#### End of Eflat_Xml_Model CXX
|
||||
|
||||
|
||||
|
||||
#### Esoap_Model
|
||||
EFL_LIB_START([Esoap_Model])
|
||||
|
||||
### Additional options to configure
|
||||
|
||||
### Default values
|
||||
|
||||
### Checks for programs
|
||||
|
||||
### Checks for libraries
|
||||
EFL_INTERNAL_DEPEND_PKG([ESOAP_MODEL], [eo])
|
||||
EFL_INTERNAL_DEPEND_PKG([ESOAP_MODEL], [efl])
|
||||
EFL_INTERNAL_DEPEND_PKG([ESOAP_MODEL], [ecore])
|
||||
EFL_INTERNAL_DEPEND_PKG([ESOAP_MODEL], [eflat_xml_model])
|
||||
|
||||
EFL_DEPEND_PKG([ESOAP_MODEL], [CURL], [libcurl >= 7.40])
|
||||
|
||||
EFL_EVAL_PKGS([ESOAP_MODEL])
|
||||
|
||||
### Checks for header files
|
||||
|
||||
### Checks for types
|
||||
|
||||
### Checks for structures
|
||||
|
||||
### Checks for compiler characteristics
|
||||
|
||||
### Checks for linker characteristics
|
||||
|
||||
### Checks for library functions
|
||||
|
||||
EFL_LIB_END([Esoap_Model])
|
||||
#### End of Esoap_Model
|
||||
|
||||
#### Esoap_Model CXX
|
||||
EFL_LIB_START([Esoap_Model_Cxx])
|
||||
|
||||
EFL_EVAL_PKGS([ESOAP_MODEL_CXX])
|
||||
|
||||
EFL_LIB_END([Esoap_Model_Cxx])
|
||||
#### End of Esoap_Model CXX
|
||||
|
||||
|
||||
### Add Wayland server library if test is enabled
|
||||
if test "x${want_tests}" = "xyes" -a "x${want_wayland}" = "xyes"; then
|
||||
EFL_DEPEND_PKG([ECORE_WAYLAND_SRV], [WAYLAND], [wayland-server >= 1.8.0])
|
||||
|
@ -4754,6 +4840,10 @@ pc/ethumb.pc
|
|||
pc/ethumb_client.pc
|
||||
pc/elocation.pc
|
||||
pc/elua.pc
|
||||
pc/eflat_xml_model.pc
|
||||
pc/eflat_xml_model-cxx.pc
|
||||
pc/esoap_model.pc
|
||||
pc/esoap_model-cxx.pc
|
||||
dbus-services/org.enlightenment.Ethumb.service
|
||||
systemd-services/ethumb.service
|
||||
$po_makefile_in
|
||||
|
@ -4803,6 +4893,14 @@ cmakeconfig/EluaConfig.cmake
|
|||
cmakeconfig/EluaConfigVersion.cmake:cmakeconfig/EFLConfigVersion.cmake.in
|
||||
cmakeconfig/EmileConfig.cmake
|
||||
cmakeconfig/EmileConfigVersion.cmake:cmakeconfig/EFLConfigVersion.cmake.in
|
||||
cmakeconfig/EflatXmlModelConfig.cmake
|
||||
cmakeconfig/EflatXmlModelConfigVersion.cmake:cmakeconfig/EFLConfigVersion.cmake.in
|
||||
cmakeconfig/EflatXmlModelCxxConfig.cmake
|
||||
cmakeconfig/EflatXmlModelCxxConfigVersion.cmake:cmakeconfig/EFLConfigVersion.cmake.in
|
||||
cmakeconfig/EsoapModelConfig.cmake
|
||||
cmakeconfig/EsoapModelConfigVersion.cmake:cmakeconfig/EFLConfigVersion.cmake.in
|
||||
cmakeconfig/EsoapModelCxxConfig.cmake
|
||||
cmakeconfig/EsoapModelCxxConfigVersion.cmake:cmakeconfig/EFLConfigVersion.cmake.in
|
||||
])
|
||||
|
||||
AC_OUTPUT
|
||||
|
@ -4916,6 +5014,8 @@ echo "Emotion.........: yes (${features_emotion})"
|
|||
echo "Ethumb..........: yes"
|
||||
echo "Ethumb_Client...: yes"
|
||||
echo "Elua............: $have_elua"
|
||||
echo "Eflat_Xml_Model.: yes"
|
||||
echo "Esoap_Model.....: yes"
|
||||
if test "${build_tests}" = "none"; then
|
||||
echo "Tests...........: no"
|
||||
elif test "${build_tests}" = "auto"; then
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
includedir=@includedir@
|
||||
|
||||
Name: Eflat_xml_model C++
|
||||
Description: "Flat" XML model for EFL
|
||||
Requires.private: @requirements_pc_eflat_xml_model@ @requirements_pc_eo@
|
||||
Version: @VERSION@
|
||||
Libs: -L${libdir} -leflat_xml_model @requirements_public_libs_eflat_xml_model@ @requirements_public_libs_eo@
|
||||
Libs.private: @requirements_libs_eflat_xml_model@ @requirements_libs_eo@
|
||||
Cflags: -I${includedir}/efl-@VMAJ@ -I${includedir}/eo-@VMAJ@ -I${includedir}/eflat_xml_model-@VMAJ@ -I${includedir}/eflat_xml_model-cxx-@VMAJ@
|
|
@ -0,0 +1,12 @@
|
|||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
includedir=@includedir@
|
||||
|
||||
Name: Eflat_xml_model
|
||||
Description: "Flat" XML model for EFL
|
||||
Requires.private: @requirements_pc_eflat_xml_model@
|
||||
Version: @VERSION@
|
||||
Libs: -L${libdir} -leflat_xml_model @requirements_public_libs_eflat_xml_model@
|
||||
Libs.private: @requirements_libs_eflat_xml_model@
|
||||
Cflags: -I${includedir}/efl-@VMAJ@ -I${includedir}/eflat_xml_model-@VMAJ@
|
|
@ -0,0 +1,12 @@
|
|||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
includedir=@includedir@
|
||||
|
||||
Name: Esoap-model C++
|
||||
Description: SOAP model for EFL
|
||||
Requires.private: @requirements_pc_esoap_model@ @requirements_pc_eo@
|
||||
Version: @VERSION@
|
||||
Libs: -L${libdir} -lesoap_model @requirements_public_libs_esoap_model@ @requirements_public_libs_eo@
|
||||
Libs.private: @requirements_libs_esoap_model@ @requirements_libs_eo@
|
||||
Cflags: -I${includedir}/efl-@VMAJ@ -I${includedir}/eo-@VMAJ@ -I${includedir}/esoap_model-@VMAJ@ -I${includedir}/esoap_model-cxx-@VMAJ@
|
|
@ -0,0 +1,12 @@
|
|||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
includedir=@includedir@
|
||||
|
||||
Name: Esoap-model
|
||||
Description: SOAP model for EFL
|
||||
Requires.private: @requirements_pc_esoap_model@
|
||||
Version: @VERSION@
|
||||
Libs: -L${libdir} -lesoap_model @requirements_public_libs_esoap_model@
|
||||
Libs.private: @requirements_libs_esoap_model@
|
||||
Cflags: -I${includedir}/efl-@VMAJ@ -I${includedir}/esoap_model-@VMAJ@
|
|
@ -60,6 +60,8 @@ include Makefile_Edje.am
|
|||
include Makefile_Emotion.am
|
||||
include Makefile_Ethumb.am
|
||||
include Makefile_Ethumb_Client.am
|
||||
include Makefile_EflatXmlModel.am
|
||||
include Makefile_EsoapModel.am
|
||||
|
||||
include Makefile_Eina_Cxx.am
|
||||
include Makefile_Ecore_Cxx.am
|
||||
|
@ -71,6 +73,8 @@ include Makefile_Efl_Cxx.am
|
|||
include Makefile_Edje_Cxx.am
|
||||
include Makefile_Evas_Cxx.am
|
||||
include Makefile_Eio_Cxx.am
|
||||
include Makefile_EflatXmlModel_Cxx.am
|
||||
include Makefile_EsoapModel_Cxx.am
|
||||
|
||||
include Makefile_Elua.am
|
||||
include Makefile_Elocation.am
|
||||
|
|
|
@ -40,6 +40,7 @@ lib_LTLIBRARIES += lib/efl/libefl.la
|
|||
|
||||
lib_efl_libefl_la_SOURCES = \
|
||||
lib/efl/interfaces/efl_interfaces_main.c \
|
||||
lib/efl/interfaces/efl_model_common.c \
|
||||
lib/efl/interfaces/efl_gfx_shape.c
|
||||
|
||||
lib_efl_libefl_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl -I$(top_srcdir)/src/lib/efl @EFL_CFLAGS@ -DEFL_GFX_FILTER_BETA
|
||||
|
|
|
@ -0,0 +1,84 @@
|
|||
### Library
|
||||
|
||||
eflat_xml_model_eolian_files = \
|
||||
lib/eflat_xml_model/eflat_xml_model.eo
|
||||
|
||||
eflat_xml_model_eolian_c = $(eflat_xml_model_eolian_files:%.eo=%.eo.c)
|
||||
eflat_xml_model_eolian_h = $(eflat_xml_model_eolian_files:%.eo=%.eo.h)
|
||||
|
||||
BUILT_SOURCES += \
|
||||
$(eflat_xml_model_eolian_c) \
|
||||
$(eflat_xml_model_eolian_h)
|
||||
|
||||
CLEANFILES += \
|
||||
$(eflat_xml_model_eolian_c) \
|
||||
$(eflat_xml_model_eolian_h)
|
||||
|
||||
eflat_xml_modeleolianfilesdir = $(datadir)/eolian/include/eflat_xml_model-@VMAJ@
|
||||
eflat_xml_modeleolianfiles_DATA = \
|
||||
$(eflat_xml_model_eolian_files)
|
||||
|
||||
EXTRA_DIST += \
|
||||
${eflat_xml_modeleolianfiles_DATA}
|
||||
|
||||
lib_LTLIBRARIES += lib/eflat_xml_model/libeflat_xml_model.la
|
||||
|
||||
installed_eflat_xml_modelmainheadersdir = $(includedir)/eflat_xml_model-@VMAJ@
|
||||
dist_installed_eflat_xml_modelmainheaders_DATA = \
|
||||
lib/eflat_xml_model/Eflat_Xml_Model.h
|
||||
|
||||
nodist_installed_eflat_xml_modelmainheaders_DATA = \
|
||||
$(eflat_xml_model_eolian_h)
|
||||
|
||||
lib_eflat_xml_model_libeflat_xml_model_la_SOURCES = \
|
||||
lib/eflat_xml_model/eflat_xml_model_private.h \
|
||||
lib/eflat_xml_model/eflat_xml_model.c
|
||||
|
||||
lib_eflat_xml_model_libeflat_xml_model_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl @EFLAT_XML_MODEL_CFLAGS@ @EFL_CFLAGS@
|
||||
lib_eflat_xml_model_libeflat_xml_model_la_LIBADD = @EFLAT_XML_MODEL_LIBS@ @EFL_LIBS@
|
||||
lib_eflat_xml_model_libeflat_xml_model_la_DEPENDENCIES = @EFLAT_XML_MODEL_INTERNAL_LIBS@ @EFL_INTERNAL_LIBS@
|
||||
lib_eflat_xml_model_libeflat_xml_model_la_LDFLAGS = @EFL_LTLIBRARY_FLAGS@
|
||||
|
||||
### Unit tests
|
||||
|
||||
if EFL_ENABLE_TESTS
|
||||
|
||||
check_PROGRAMS += tests/eflat_xml_model/eflat_xml_model_suite
|
||||
TESTS += tests/eflat_xml_model/eflat_xml_model_suite
|
||||
|
||||
tests_eflat_xml_model_eflat_xml_model_suite_SOURCES = \
|
||||
tests/eflat_xml_model/eflat_xml_model_suite.c \
|
||||
tests/eflat_xml_model/eflat_xml_model_suite.h \
|
||||
tests/eflat_xml_model/eflat_xml_model_test_eflat_xml_model.c \
|
||||
tests/eflat_xml_model/eflat_xml_model_test_eflat_xml_model.h
|
||||
|
||||
tests_eflat_xml_model_eflat_xml_model_suite_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
|
||||
-DTESTS_SRC_DIR=\"$(abs_top_srcdir)/src/tests/eflat_xml_model\" \
|
||||
-DTESTS_BUILD_DIR=\"$(abs_top_builddir)/src/tests/eflat_xml_model\" \
|
||||
@CHECK_CFLAGS@ \
|
||||
@EFLAT_XML_MODEL_CFLAGS@ @EFL_CFLAGS@
|
||||
|
||||
tests_eflat_xml_model_eflat_xml_model_suite_LDADD = \
|
||||
@CHECK_LIBS@ \
|
||||
@USE_EFLAT_XML_MODEL_LIBS@ \
|
||||
@USE_EFL_LIBS@
|
||||
|
||||
tests_eflat_xml_model_eflat_xml_model_suite_DEPENDENCIES = \
|
||||
@USE_EFLAT_XML_MODEL_INTERNAL_LIBS@
|
||||
|
||||
endif
|
||||
|
||||
EXTRA_DIST += $(EFLAT_XML_MODEL_DATA_FILES)
|
||||
|
||||
if HAVE_ELUA
|
||||
|
||||
eflat_xml_model_eolian_lua = $(eflat_xml_model_eolian_files:%.eo=%.eo.lua)
|
||||
|
||||
generated_eflat_xml_model_lua_all = $(eflat_xml_model_eolian_lua)
|
||||
|
||||
CLEANFILES += $(generated_eflat_xml_model_lua_all)
|
||||
|
||||
installed_eflat_xml_modelluadir = $(datadir)/elua/modules/eflat_xml_model
|
||||
nodist_installed_eflat_xml_modellua_DATA = $(generated_eflat_xml_model_lua_all)
|
||||
|
||||
endif
|
|
@ -0,0 +1,22 @@
|
|||
if HAVE_CXX11
|
||||
|
||||
### Generated headers
|
||||
|
||||
generated_eflat_xml_model_cxx_bindings = $(eflat_xml_model_eolian_files:%.eo=%.eo.hh)
|
||||
|
||||
lib/eflat_xml_model/Eflat_xml_model.hh: $(generated_eflat_xml_model_cxx_bindings)
|
||||
@echo @ECHO_E@ "#ifndef EFL_CXX_EFLAT_XML_MODEL_HH\n#define EFL_CXX_EFLAT_XML_MODEL_HH\n" > $(top_builddir)/src/lib/eflat_xml_model/Eflat_xml_model.hh
|
||||
@echo @ECHO_E@ "#ifdef EFL_BETA_API_SUPPORT" >> $(top_builddir)/src/lib/eflat_xml_model/Eflat_xml_model.hh
|
||||
@for i in $(generated_eflat_xml_model_cxx_bindings); do echo "#include <$$(basename $$i)>" >> $(top_builddir)/src/lib/eflat_xml_model/Eflat_xml_model.hh; done
|
||||
@echo @ECHO_E@ "#endif\n\n#endif\n" >> $(top_builddir)/src/lib/eflat_xml_model/Eflat_xml_model.hh
|
||||
|
||||
generated_eflat_xml_model_cxx_all = \
|
||||
$(generated_eflat_xml_model_cxx_bindings) \
|
||||
lib/eflat_xml_model/Eflat_xml_model.hh
|
||||
|
||||
CLEANFILES += $(generated_eflat_xml_model_cxx_all)
|
||||
|
||||
installed_eflat_xml_modelcxxmainheadersdir = $(includedir)/eflat_xml_model-cxx-@VMAJ@/
|
||||
nodist_installed_eflat_xml_modelcxxmainheaders_DATA = $(generated_eflat_xml_model_cxx_all)
|
||||
|
||||
endif
|
|
@ -0,0 +1,84 @@
|
|||
### Library
|
||||
|
||||
esoap_model_eolian_files = \
|
||||
lib/esoap_model/esoap_model.eo
|
||||
|
||||
esoap_model_eolian_c = $(esoap_model_eolian_files:%.eo=%.eo.c)
|
||||
esoap_model_eolian_h = $(esoap_model_eolian_files:%.eo=%.eo.h)
|
||||
|
||||
BUILT_SOURCES += \
|
||||
$(esoap_model_eolian_c) \
|
||||
$(esoap_model_eolian_h)
|
||||
|
||||
CLEANFILES += \
|
||||
$(esoap_model_eolian_c) \
|
||||
$(esoap_model_eolian_h)
|
||||
|
||||
esoap_modeleolianfilesdir = $(datadir)/eolian/include/esoap_model-@VMAJ@
|
||||
esoap_modeleolianfiles_DATA = \
|
||||
$(esoap_model_eolian_files)
|
||||
|
||||
EXTRA_DIST += \
|
||||
${esoap_modeleolianfiles_DATA}
|
||||
|
||||
lib_LTLIBRARIES += lib/esoap_model/libesoap_model.la
|
||||
|
||||
installed_esoap_modelmainheadersdir = $(includedir)/esoap_model-@VMAJ@
|
||||
dist_installed_esoap_modelmainheaders_DATA = \
|
||||
lib/esoap_model/Esoap_Model.h
|
||||
|
||||
nodist_installed_esoap_modelmainheaders_DATA = \
|
||||
$(esoap_model_eolian_h)
|
||||
|
||||
lib_esoap_model_libesoap_model_la_SOURCES = \
|
||||
lib/esoap_model/esoap_model_private.h \
|
||||
lib/esoap_model/esoap_model.c
|
||||
|
||||
lib_esoap_model_libesoap_model_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl @ESOAP_MODEL_CFLAGS@ @EFL_CFLAGS@
|
||||
lib_esoap_model_libesoap_model_la_LIBADD = @ESOAP_MODEL_LIBS@ @EFL_LIBS@
|
||||
lib_esoap_model_libesoap_model_la_DEPENDENCIES = @ESOAP_MODEL_INTERNAL_LIBS@ @EFL_INTERNAL_LIBS@
|
||||
lib_esoap_model_libesoap_model_la_LDFLAGS = @EFL_LTLIBRARY_FLAGS@
|
||||
|
||||
### Unit tests
|
||||
|
||||
if EFL_ENABLE_TESTS
|
||||
|
||||
check_PROGRAMS += tests/esoap_model/esoap_model_suite
|
||||
TESTS += tests/esoap_model/esoap_model_suite
|
||||
|
||||
tests_esoap_model_esoap_model_suite_SOURCES = \
|
||||
tests/esoap_model/esoap_model_suite.c \
|
||||
tests/esoap_model/esoap_model_suite.h \
|
||||
tests/esoap_model/esoap_model_test_esoap_model.c \
|
||||
tests/esoap_model/esoap_model_test_esoap_model.h
|
||||
|
||||
tests_esoap_model_esoap_model_suite_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
|
||||
-DTESTS_SRC_DIR=\"$(abs_top_srcdir)/src/tests/esoap_model\" \
|
||||
-DTESTS_BUILD_DIR=\"$(abs_top_builddir)/src/tests/esoap_model\" \
|
||||
@CHECK_CFLAGS@ \
|
||||
@ESOAP_MODEL_CFLAGS@ @EFL_CFLAGS@
|
||||
|
||||
tests_esoap_model_esoap_model_suite_LDADD = \
|
||||
@CHECK_LIBS@ \
|
||||
@USE_ESOAP_MODEL_LIBS@ \
|
||||
@USE_EFL_LIBS@
|
||||
|
||||
tests_esoap_model_esoap_model_suite_DEPENDENCIES = \
|
||||
@USE_ESOAP_MODEL_INTERNAL_LIBS@
|
||||
|
||||
endif
|
||||
|
||||
EXTRA_DIST += $(ESOAP_MODEL_DATA_FILES)
|
||||
|
||||
if HAVE_ELUA
|
||||
|
||||
esoap_model_eolian_lua = $(esoap_model_eolian_files:%.eo=%.eo.lua)
|
||||
|
||||
generated_esoap_model_lua_all = $(esoap_model_eolian_lua)
|
||||
|
||||
CLEANFILES += $(generated_esoap_model_lua_all)
|
||||
|
||||
installed_esoap_modelluadir = $(datadir)/elua/modules/esoap_model
|
||||
nodist_installed_esoap_modellua_DATA = $(generated_esoap_model_lua_all)
|
||||
|
||||
endif
|
|
@ -0,0 +1,22 @@
|
|||
if HAVE_CXX11
|
||||
|
||||
### Generated headers
|
||||
|
||||
generated_esoap_model_cxx_bindings = $(esoap_model_eolian_files:%.eo=%.eo.hh)
|
||||
|
||||
lib/esoap_model/Esoap_Model.hh: $(generated_esoap_model_cxx_bindings)
|
||||
@echo @ECHO_E@ "#ifndef EFL_CXX_ESOAP_MODEL_HH\n#define EFL_CXX_ESOAP_MODEL_HH\n" > $(top_builddir)/src/lib/esoap_model/Esoap_Model.hh
|
||||
@echo @ECHO_E@ "#ifdef EFL_BETA_API_SUPPORT" >> $(top_builddir)/src/lib/esoap_model/Esoap_Model.hh
|
||||
@for i in $(generated_esoap_model_cxx_bindings); do echo "#include <$$(basename $$i)>" >> $(top_builddir)/src/lib/esoap_model/Esoap_Model.hh; done
|
||||
@echo @ECHO_E@ "#endif\n\n#endif\n" >> $(top_builddir)/src/lib/esoap_model/Esoap_Model.hh
|
||||
|
||||
generated_esoap_model_cxx_all = \
|
||||
$(generated_esoap_model_cxx_bindings) \
|
||||
lib/esoap_model/Esoap_Model.hh
|
||||
|
||||
CLEANFILES += $(generated_esoap_model_cxx_all)
|
||||
|
||||
installed_esoap_modelcxxmainheadersdir = $(includedir)/esoap_model-cxx-@VMAJ@/
|
||||
nodist_installed_esoap_modelcxxmainheaders_DATA = $(generated_esoap_model_cxx_all)
|
||||
|
||||
endif
|
|
@ -139,7 +139,7 @@ typedef enum _Efl_Gfx_Fill_Spread
|
|||
#ifdef EFL_BETA_API_SUPPORT
|
||||
|
||||
#include <Efl_Model_Common.h>
|
||||
|
||||
|
||||
/* Interfaces */
|
||||
#include "interfaces/efl_control.eo.h"
|
||||
#include "interfaces/efl_file.eo.h"
|
||||
|
@ -147,7 +147,6 @@ typedef enum _Efl_Gfx_Fill_Spread
|
|||
#include "interfaces/efl_player.eo.h"
|
||||
#include "interfaces/efl_text.eo.h"
|
||||
#include "interfaces/efl_text_properties.eo.h"
|
||||
#include "interfaces/efl_model_base.eo.h"
|
||||
|
||||
EAPI extern const Eo_Event_Description _EFL_GFX_CHANGED;
|
||||
EAPI extern const Eo_Event_Description _EFL_GFX_PATH_CHANGED;
|
||||
|
|
|
@ -1,10 +1,3 @@
|
|||
#ifndef _EFL_MODEL_COMMON_H
|
||||
#define _EFL_MODEL_COMMON_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @struct _Efl_Model_Children_Event
|
||||
* Every time a child id added the event
|
||||
|
@ -31,8 +24,74 @@ struct _Efl_Model_Children_Event
|
|||
*/
|
||||
typedef struct _Efl_Model_Children_Event Efl_Model_Children_Event;
|
||||
|
||||
#include "interfaces/efl_model_base.eo.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
/**
|
||||
* @brief Sets the new load status signaling an event if changed
|
||||
*
|
||||
* @param model The model to call the event @c EFL_MODEL_EVENT_LOAD_STATUS
|
||||
* @param load The load status to be changed
|
||||
* @param status The new status
|
||||
*/
|
||||
EAPI void efl_model_load_set(Efl_Model_Base *model, Efl_Model_Load *load, Efl_Model_Load_Status status) EINA_ARG_NONNULL(1, 2);
|
||||
|
||||
/**
|
||||
* @brief Slices a list
|
||||
*
|
||||
* If the @p start and @p count are 0, a new accessor of the entire list is returned
|
||||
*
|
||||
* @param list The list to get the slice
|
||||
* @param start The nth element to start the slice
|
||||
* @param count The number of elements
|
||||
* @return The accessor to the sliced elements or @c NULL if error
|
||||
*/
|
||||
EAPI Eina_Accessor *efl_model_list_slice(Eina_List *list, unsigned start, unsigned count) EINA_ARG_NONNULL(1);
|
||||
|
||||
/**
|
||||
* @brief Notifies an error with an @c EFL_MODEL_EVENT_LOAD_STATUS
|
||||
*
|
||||
* @param model The model to be notified
|
||||
*/
|
||||
EAPI void efl_model_error_notify(Efl_Model_Base *model) EINA_ARG_NONNULL(1);
|
||||
|
||||
/**
|
||||
* @brief Notifies a property changed event with an @c EFL_MODEL_EVENT_PROPERTIES_CHANGED
|
||||
*
|
||||
* @param model The model to be notified
|
||||
* @param property The changed property
|
||||
*/
|
||||
EAPI void efl_model_property_changed_notify(Efl_Model_Base *model, const char *property);
|
||||
|
||||
/**
|
||||
* @brief Notifies a property invalidated event with an @c EFL_MODEL_EVENT_PROPERTIES_CHANGED
|
||||
*
|
||||
* @param model The model to be notified
|
||||
* @param property The invalidated property
|
||||
*/
|
||||
EAPI void efl_model_property_invalidated_notify(Efl_Model_Base *model, const char *property);
|
||||
|
||||
/**
|
||||
* @brief Callback to setup a member of @c Eina_Value_Struct
|
||||
*
|
||||
* @param data The user data
|
||||
* @param index The member index
|
||||
* @param member The member to fill its name and type. Must use @c Eina_Stringshare for name.
|
||||
*/
|
||||
typedef void (*Efl_Model_Value_Struct_Member_Setup_Cb)(void *data, int index, Eina_Value_Struct_Member *member);
|
||||
|
||||
/**
|
||||
* @brief Creates a new struct description
|
||||
*
|
||||
* @param member_count The number of struct members
|
||||
* @param setup_cb The callback to setup struct members
|
||||
* @param data The user data
|
||||
* @return Returns the struct description
|
||||
*/
|
||||
EAPI Eina_Value_Struct_Desc *efl_model_value_struct_desc_new(unsigned int member_count, Efl_Model_Value_Struct_Member_Setup_Cb setup_cb, void *data) EINA_ARG_NONNULL(2);
|
||||
|
||||
/**
|
||||
* @brief Frees the memory allocated to the struct description.
|
||||
*
|
||||
* @param desc The struct description. If @c NULL, the function returns immediately.
|
||||
*/
|
||||
EAPI void efl_model_value_struct_desc_free(Eina_Value_Struct_Desc *desc);
|
||||
|
|
|
@ -0,0 +1,166 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "Efl.h"
|
||||
|
||||
void
|
||||
efl_model_load_set(Efl_Model_Base *model, Efl_Model_Load *load, Efl_Model_Load_Status status)
|
||||
{
|
||||
Efl_Model_Load new_load = {.status = status};
|
||||
|
||||
if ((load->status & (EFL_MODEL_LOAD_STATUS_LOADED | EFL_MODEL_LOAD_STATUS_LOADING)) &&
|
||||
(new_load.status & (EFL_MODEL_LOAD_STATUS_LOADED | EFL_MODEL_LOAD_STATUS_LOADING)))
|
||||
{
|
||||
// Merge status
|
||||
new_load.status = load->status | new_load.status;
|
||||
|
||||
// Removes incompatible statuses (LOADING vs LOADED)
|
||||
switch (status)
|
||||
{
|
||||
case EFL_MODEL_LOAD_STATUS_LOADED_PROPERTIES:
|
||||
new_load.status &= ~EFL_MODEL_LOAD_STATUS_LOADING_PROPERTIES;
|
||||
break;
|
||||
case EFL_MODEL_LOAD_STATUS_LOADING_PROPERTIES:
|
||||
new_load.status &= ~EFL_MODEL_LOAD_STATUS_LOADED_PROPERTIES;
|
||||
break;
|
||||
case EFL_MODEL_LOAD_STATUS_LOADED_CHILDREN:
|
||||
new_load.status &= ~EFL_MODEL_LOAD_STATUS_LOADING_CHILDREN;
|
||||
break;
|
||||
case EFL_MODEL_LOAD_STATUS_LOADING_CHILDREN:
|
||||
new_load.status &= ~EFL_MODEL_LOAD_STATUS_LOADED_CHILDREN;
|
||||
break;
|
||||
case EFL_MODEL_LOAD_STATUS_LOADED:
|
||||
new_load.status &= ~EFL_MODEL_LOAD_STATUS_LOADING;
|
||||
break;
|
||||
case EFL_MODEL_LOAD_STATUS_LOADING:
|
||||
new_load.status &= ~EFL_MODEL_LOAD_STATUS_LOADED;
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
if (load->status != new_load.status)
|
||||
{
|
||||
load->status = new_load.status;
|
||||
eo_do(model, eo_event_callback_call(EFL_MODEL_BASE_EVENT_LOAD_STATUS, load));
|
||||
}
|
||||
}
|
||||
|
||||
Eina_Accessor *
|
||||
efl_model_list_slice(Eina_List *list, unsigned start, unsigned count)
|
||||
{
|
||||
fprintf(stderr, "efl_model_list_slice\n");
|
||||
if ((start == 0) && (count == 0))
|
||||
{
|
||||
fprintf(stderr, "efl_model_list_slice start == 0 count == 0\n");
|
||||
return eina_list_accessor_new(list);
|
||||
}
|
||||
|
||||
Eina_List *nth_list = eina_list_nth_list(list, (start - 1));
|
||||
if (!nth_list)
|
||||
return NULL;
|
||||
|
||||
Eina_List *it, *result = NULL;
|
||||
const void *data;
|
||||
EINA_LIST_FOREACH(nth_list, it, data)
|
||||
{
|
||||
result = eina_list_append(result, data);
|
||||
if (eina_list_count(result) == count)
|
||||
break;
|
||||
}
|
||||
|
||||
return eina_list_accessor_new(result);
|
||||
}
|
||||
|
||||
void
|
||||
efl_model_error_notify(Efl_Model_Base *model)
|
||||
{
|
||||
Efl_Model_Load load = {.status = EFL_MODEL_LOAD_STATUS_ERROR};
|
||||
eo_do(model, eo_event_callback_call(EFL_MODEL_BASE_EVENT_LOAD_STATUS, &load));
|
||||
}
|
||||
|
||||
EAPI void
|
||||
efl_model_property_changed_notify(Efl_Model_Base *model, const char *property)
|
||||
{
|
||||
Eina_Array *changed_properties = eina_array_new(1);
|
||||
EINA_SAFETY_ON_NULL_RETURN(changed_properties);
|
||||
|
||||
Eina_Bool ret = eina_array_push(changed_properties, property);
|
||||
EINA_SAFETY_ON_FALSE_GOTO(ret, on_error);
|
||||
|
||||
Efl_Model_Property_Event evt = {.changed_properties = changed_properties};
|
||||
eo_do(model, eo_event_callback_call(EFL_MODEL_BASE_EVENT_PROPERTIES_CHANGED, &evt));
|
||||
|
||||
on_error:
|
||||
eina_array_free(changed_properties);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
efl_model_property_invalidated_notify(Efl_Model_Base *model, const char *property)
|
||||
{
|
||||
Eina_Array *invalidated_properties = eina_array_new(1);
|
||||
EINA_SAFETY_ON_NULL_RETURN(invalidated_properties);
|
||||
|
||||
Eina_Bool ret = eina_array_push(invalidated_properties, property);
|
||||
EINA_SAFETY_ON_FALSE_GOTO(ret, on_error);
|
||||
|
||||
Efl_Model_Property_Event evt = {.invalidated_properties = invalidated_properties};
|
||||
eo_do(model, eo_event_callback_call(EFL_MODEL_BASE_EVENT_PROPERTIES_CHANGED, &evt));
|
||||
|
||||
on_error:
|
||||
eina_array_free(invalidated_properties);
|
||||
}
|
||||
|
||||
typedef struct _Efl_Model_Value_Struct_Desc
|
||||
{
|
||||
Eina_Value_Struct_Desc base;
|
||||
void *data;
|
||||
Eina_Value_Struct_Member members[];
|
||||
} Efl_Model_Value_Struct_Desc;
|
||||
|
||||
Eina_Value_Struct_Desc *
|
||||
efl_model_value_struct_desc_new(unsigned int member_count, Efl_Model_Value_Struct_Member_Setup_Cb setup_cb, void *data)
|
||||
{
|
||||
EINA_SAFETY_ON_FALSE_RETURN_VAL(member_count > 0, NULL);
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(setup_cb, NULL);
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(data, NULL);
|
||||
|
||||
Efl_Model_Value_Struct_Desc *desc = malloc(sizeof(Efl_Model_Value_Struct_Desc) + member_count * sizeof(Eina_Value_Struct_Member));
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(desc, NULL);
|
||||
|
||||
desc->base.version = EINA_VALUE_STRUCT_DESC_VERSION;
|
||||
desc->base.ops = EINA_VALUE_STRUCT_OPERATIONS_STRINGSHARE;
|
||||
desc->base.members = desc->members;
|
||||
desc->base.member_count = member_count;
|
||||
desc->base.size = 0;
|
||||
desc->data = data;
|
||||
|
||||
unsigned int offset = 0;
|
||||
for (size_t i = 0; i < member_count; ++i)
|
||||
{
|
||||
Eina_Value_Struct_Member *m = (Eina_Value_Struct_Member *)desc->members + i;
|
||||
|
||||
m->offset = offset;
|
||||
setup_cb(data, i, m);
|
||||
|
||||
unsigned int size = m->type->value_size;
|
||||
if (size % sizeof(void *) != 0)
|
||||
size += size - (size % sizeof(void *));
|
||||
|
||||
offset += size;
|
||||
}
|
||||
|
||||
desc->base.size = offset;
|
||||
return &desc->base;
|
||||
}
|
||||
|
||||
void
|
||||
efl_model_value_struct_desc_free(Eina_Value_Struct_Desc *desc)
|
||||
{
|
||||
if (!desc) return;
|
||||
|
||||
for (size_t i = 0; i < desc->member_count; i++)
|
||||
eina_stringshare_del(desc->members[i].name);
|
||||
free(desc);
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
#ifndef EFLAT_XML_H
|
||||
#define EFLAT_XML_H
|
||||
|
||||
#include <Ecore.h>
|
||||
#include <Efl.h>
|
||||
#include <Efl_Config.h>
|
||||
|
||||
#ifdef EAPI
|
||||
# undef EAPI
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
# ifdef EFL_EFLAT_XML_MODEL_BUILD
|
||||
# ifdef DLL_EXPORT
|
||||
# define EAPI __declspec(dllexport)
|
||||
# else
|
||||
# define EAPI
|
||||
# endif /* ! DLL_EXPORT */
|
||||
# else
|
||||
# define EAPI __declspec(dllimport)
|
||||
# endif /* ! EFL_EFLAT_XML_MODEL_BUILD */
|
||||
#else
|
||||
# ifdef __GNUC__
|
||||
# if __GNUC__ >= 4
|
||||
# define EAPI __attribute__ ((visibility("default")))
|
||||
# else
|
||||
# define EAPI
|
||||
# endif
|
||||
# else
|
||||
# define EAPI
|
||||
# endif
|
||||
#endif /* ! _WIN32 */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Initialize eflat_xml_model.
|
||||
*
|
||||
* @return 1 or greater on success, 0 otherwise
|
||||
*/
|
||||
EAPI int eflat_xml_model_init(void);
|
||||
/**
|
||||
* @brief Shutdown eflat_xml_model.
|
||||
*
|
||||
* @return 0 if eflat_xml_model shuts down, greater than 0 otherwise.
|
||||
*/
|
||||
EAPI int eflat_xml_model_shutdown(void);
|
||||
|
||||
#ifdef EFL_EO_API_SUPPORT
|
||||
# include <eflat_xml_model.eo.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#undef EAPI
|
||||
#define EAPI
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,34 @@
|
|||
class Eflat_Xml.Model (Eo.Base, Efl.Model.Base) {
|
||||
legacy_prefix: null;
|
||||
methods {
|
||||
constructor {
|
||||
[[Custom Eflat_Xml_Model constructor.
|
||||
@.constructor
|
||||
|
||||
@since 1.13
|
||||
]]
|
||||
params {
|
||||
xml: const(char)*; [[The XML document]]
|
||||
}
|
||||
}
|
||||
}
|
||||
implements {
|
||||
Eo.Base.constructor;
|
||||
Eo.Base.destructor;
|
||||
Efl.Model.Base.properties.get;
|
||||
Efl.Model.Base.properties_load;
|
||||
Efl.Model.Base.property.set;
|
||||
Efl.Model.Base.property.get;
|
||||
Efl.Model.Base.load;
|
||||
Efl.Model.Base.load_status.get;
|
||||
Efl.Model.Base.unload;
|
||||
Efl.Model.Base.child_add;
|
||||
Efl.Model.Base.child_del;
|
||||
Efl.Model.Base.children_slice.get;
|
||||
Efl.Model.Base.children_count.get;
|
||||
Efl.Model.Base.children_load;
|
||||
}
|
||||
constructors {
|
||||
.constructor;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
#ifndef _EFLAT_XML_MODEL_PRIVATE_H
|
||||
#define _EFLAT_XML_MODEL_PRIVATE_H
|
||||
|
||||
#include "Eflat_Xml_Model.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
/* logging support */
|
||||
extern int _eflat_xml_model_log_dom;
|
||||
|
||||
#define CRI(...) EINA_LOG_DOM_CRIT(_eflat_xml_model_log_dom, __VA_ARGS__)
|
||||
#define ERR(...) EINA_LOG_DOM_ERR(_eflat_xml_model_log_dom, __VA_ARGS__)
|
||||
#define WRN(...) EINA_LOG_DOM_WARN(_eflat_xml_model_log_dom, __VA_ARGS__)
|
||||
#define INF(...) EINA_LOG_DOM_INFO(_eflat_xml_model_log_dom, __VA_ARGS__)
|
||||
#define DBG(...) EINA_LOG_DOM_DBG(_eflat_xml_model_log_dom, __VA_ARGS__)
|
||||
|
||||
typedef struct _Eflat_Xml_Model_Data Eflat_Xml_Model_Data;
|
||||
|
||||
/**
|
||||
* eflat_xml_model
|
||||
*/
|
||||
struct _Eflat_Xml_Model_Data
|
||||
{
|
||||
Eo *obj;
|
||||
Efl_Model_Load load;
|
||||
Eina_Array *properties_array;
|
||||
Eina_Hash *properties_hash;
|
||||
Eina_Simple_XML_Node_Root *root;
|
||||
char *xml;
|
||||
Eina_Value xml_value;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
#ifndef ESOAP_MODEL_H
|
||||
#define ESOAP_MODEL_H
|
||||
|
||||
#include <Ecore.h>
|
||||
#include <Efl.h>
|
||||
#include <Efl_Config.h>
|
||||
|
||||
#ifdef EAPI
|
||||
# undef EAPI
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
# ifdef EFL_ESOAP_MODEL_BUILD
|
||||
# ifdef DLL_EXPORT
|
||||
# define EAPI __declspec(dllexport)
|
||||
# else
|
||||
# define EAPI
|
||||
# endif /* ! DLL_EXPORT */
|
||||
# else
|
||||
# define EAPI __declspec(dllimport)
|
||||
# endif /* ! EFL_ESOAP_MODEL_BUILD */
|
||||
#else
|
||||
# ifdef __GNUC__
|
||||
# if __GNUC__ >= 4
|
||||
# define EAPI __attribute__ ((visibility("default")))
|
||||
# else
|
||||
# define EAPI
|
||||
# endif
|
||||
# else
|
||||
# define EAPI
|
||||
# endif
|
||||
#endif /* ! _WIN32 */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Initialize esoap_model.
|
||||
*
|
||||
* @return 1 or greater on success, 0 otherwise
|
||||
*/
|
||||
EAPI int esoap_model_init(void);
|
||||
|
||||
/**
|
||||
* @brief Shutdown esoap_model.
|
||||
*
|
||||
* @return 0 if esoap_model shuts down, greater than 0 otherwise.
|
||||
*/
|
||||
EAPI int esoap_model_shutdown(void);
|
||||
|
||||
#ifdef EFL_EO_API_SUPPORT
|
||||
# include <esoap_model.eo.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#undef EAPI
|
||||
#define EAPI
|
||||
|
||||
#endif
|
|
@ -0,0 +1,470 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "esoap_model_private.h"
|
||||
|
||||
#include <curl/curl.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define MY_CLASS ESOAP_MODEL_CLASS
|
||||
#define MY_CLASS_NAME "Esoap_Model"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Esoap_Model_Data *pd;
|
||||
Eina_Strbuf *response;
|
||||
struct curl_slist *header;
|
||||
char *soap_action;
|
||||
CURL *curl;
|
||||
Ecore_Thread *thread;
|
||||
} Esoap_Model_Perform_Data;
|
||||
|
||||
static void _properties_load(Esoap_Model_Data *);
|
||||
static void _children_load(Esoap_Model_Data *);
|
||||
static bool _init(Esoap_Model_Data *);
|
||||
static void _clear(Esoap_Model_Data *);
|
||||
static void _perform(Esoap_Model_Data *, const char *);
|
||||
static void _perform_cb(Esoap_Model_Perform_Data *, Ecore_Thread *);
|
||||
static void _perform_end_cb(Esoap_Model_Perform_Data *, Ecore_Thread *);
|
||||
static void _perform_cancel_cb(Esoap_Model_Perform_Data *, Ecore_Thread *);
|
||||
static Eina_Bool _properties_changed_cb(void *, Eo *, const Eo_Event_Description *, void *);
|
||||
static size_t _write_data_cb(void *, size_t, size_t, void *);
|
||||
static void _perform_data_free(Esoap_Model_Perform_Data *data);
|
||||
|
||||
static int _esoap_model_init_count = 0;
|
||||
int _esoap_model_log_dom = -1;
|
||||
|
||||
EAPI int
|
||||
esoap_model_init(void)
|
||||
{
|
||||
if (_esoap_model_init_count++ > 0)
|
||||
return _esoap_model_init_count;
|
||||
|
||||
if (!eina_init())
|
||||
{
|
||||
fputs("Esoap_Model: Unable to initialize eina\n", stderr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
_esoap_model_log_dom = eina_log_domain_register("Esoap_Model", EINA_COLOR_CYAN);
|
||||
if (_esoap_model_log_dom < 0)
|
||||
{
|
||||
EINA_LOG_ERR("Unable to create an 'Esoap_Model' log domain");
|
||||
_esoap_model_log_dom = -1;
|
||||
eina_shutdown();
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!ecore_init())
|
||||
{
|
||||
ERR("Unable to initialize ecore");
|
||||
goto on_error;
|
||||
}
|
||||
|
||||
if (!eflat_xml_model_init())
|
||||
{
|
||||
ERR("Unable to initialize eflat_xml_model");
|
||||
goto on_error;
|
||||
}
|
||||
|
||||
CURLcode code = curl_global_init(CURL_GLOBAL_ALL);
|
||||
if (CURLE_OK != code)
|
||||
{
|
||||
ERR("Unable to initialize curl");
|
||||
goto on_error;
|
||||
}
|
||||
|
||||
return _esoap_model_init_count;
|
||||
|
||||
on_error:
|
||||
eina_log_domain_unregister(_esoap_model_log_dom);
|
||||
_esoap_model_log_dom = -1;
|
||||
eina_shutdown();
|
||||
return 0;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
esoap_model_shutdown(void)
|
||||
{
|
||||
if (_esoap_model_init_count <= 0)
|
||||
{
|
||||
ERR("Init count not greater than 0 in shutdown.");
|
||||
_esoap_model_init_count = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (--_esoap_model_init_count)
|
||||
return _esoap_model_init_count;
|
||||
|
||||
curl_global_cleanup();
|
||||
eflat_xml_model_shutdown();
|
||||
ecore_shutdown();
|
||||
eina_log_domain_unregister(_esoap_model_log_dom);
|
||||
_esoap_model_log_dom = -1;
|
||||
eina_shutdown();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static Eo_Base *
|
||||
_esoap_model_eo_base_constructor(Eo *obj, Esoap_Model_Data *pd)
|
||||
{
|
||||
DBG("(%p)", obj);
|
||||
|
||||
pd->obj = obj;
|
||||
pd->load.status = EFL_MODEL_LOAD_STATUS_UNLOADED;
|
||||
pd->children_list = NULL;
|
||||
pd->xml = NULL;
|
||||
|
||||
return eo_do_super_ret(obj, MY_CLASS, obj, eo_constructor());
|
||||
}
|
||||
|
||||
static void
|
||||
_esoap_model_constructor(Eo *obj EINA_UNUSED,
|
||||
Esoap_Model_Data *pd EINA_UNUSED,
|
||||
const char *url,
|
||||
const char *action)
|
||||
{
|
||||
DBG("(%p)", obj);
|
||||
EINA_SAFETY_ON_NULL_RETURN(url);
|
||||
EINA_SAFETY_ON_NULL_RETURN(action);
|
||||
|
||||
pd->url = strdup(url);
|
||||
pd->action = strdup(action);
|
||||
}
|
||||
|
||||
static void
|
||||
_esoap_model_eo_base_destructor(Eo *obj, Esoap_Model_Data *pd)
|
||||
{
|
||||
DBG("(%p)", obj);
|
||||
|
||||
_clear(pd);
|
||||
free(pd->url);
|
||||
free(pd->action);
|
||||
|
||||
eo_do_super(obj, MY_CLASS, eo_destructor());
|
||||
}
|
||||
|
||||
static Efl_Model_Load_Status
|
||||
_esoap_model_efl_model_base_properties_get(Eo *obj EINA_UNUSED,
|
||||
Esoap_Model_Data *pd,
|
||||
Eina_Array * const* properties_array)
|
||||
{
|
||||
DBG("(%p)", obj);
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(pd, EFL_MODEL_LOAD_STATUS_ERROR);
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(pd->obj, EFL_MODEL_LOAD_STATUS_ERROR);
|
||||
|
||||
eo_do(pd->xml, efl_model_properties_get(properties_array));
|
||||
return pd->load.status;
|
||||
}
|
||||
|
||||
static void
|
||||
_esoap_model_efl_model_base_properties_load(Eo *obj, Esoap_Model_Data *pd)
|
||||
{
|
||||
DBG("(%p)", obj);
|
||||
|
||||
if (pd->load.status & EFL_MODEL_LOAD_STATUS_LOADED_PROPERTIES)
|
||||
return;
|
||||
|
||||
if (!_init(pd))
|
||||
return;
|
||||
|
||||
_properties_load(pd);
|
||||
}
|
||||
|
||||
static void
|
||||
_properties_load(Esoap_Model_Data *pd)
|
||||
{
|
||||
DBG("(%p)", pd->obj);
|
||||
efl_model_load_set(pd->obj,
|
||||
&pd->load,
|
||||
EFL_MODEL_LOAD_STATUS_LOADING_PROPERTIES);
|
||||
eo_do(pd->xml, efl_model_properties_load());
|
||||
efl_model_load_set(pd->obj,
|
||||
&pd->load,
|
||||
EFL_MODEL_LOAD_STATUS_LOADED_PROPERTIES);
|
||||
}
|
||||
|
||||
static Efl_Model_Load_Status
|
||||
_esoap_model_efl_model_base_property_set(Eo *obj EINA_UNUSED,
|
||||
Esoap_Model_Data *pd,
|
||||
const char *property,
|
||||
const Eina_Value *value)
|
||||
{
|
||||
Efl_Model_Load_Status status;
|
||||
eo_do(pd->xml, status = efl_model_property_set(property, value));
|
||||
EINA_SAFETY_ON_FALSE_RETURN_VAL(status != EFL_MODEL_LOAD_STATUS_ERROR, EFL_MODEL_LOAD_STATUS_ERROR);
|
||||
return pd->load.status;
|
||||
}
|
||||
|
||||
static Efl_Model_Load_Status
|
||||
_esoap_model_efl_model_base_property_get(Eo *obj EINA_UNUSED,
|
||||
Esoap_Model_Data *pd,
|
||||
const char *property,
|
||||
const Eina_Value **value)
|
||||
{
|
||||
Efl_Model_Load_Status status;
|
||||
eo_do(pd->xml, status = efl_model_property_get(property, value));
|
||||
EINA_SAFETY_ON_FALSE_RETURN_VAL(status != EFL_MODEL_LOAD_STATUS_ERROR, EFL_MODEL_LOAD_STATUS_ERROR);
|
||||
return pd->load.status;
|
||||
}
|
||||
|
||||
static void
|
||||
_esoap_model_efl_model_base_load(Eo *obj EINA_UNUSED, Esoap_Model_Data *pd)
|
||||
{
|
||||
DBG("(%p)", obj);
|
||||
|
||||
if ((pd->load.status & EFL_MODEL_LOAD_STATUS_LOADED) == EFL_MODEL_LOAD_STATUS_LOADED)
|
||||
return;
|
||||
|
||||
if (!_init(pd))
|
||||
return;
|
||||
|
||||
if (!(pd->load.status & EFL_MODEL_LOAD_STATUS_LOADED_PROPERTIES))
|
||||
_properties_load(pd);
|
||||
|
||||
if (!(pd->load.status & EFL_MODEL_LOAD_STATUS_LOADED_CHILDREN))
|
||||
_children_load(pd);
|
||||
}
|
||||
|
||||
static Efl_Model_Load_Status
|
||||
_esoap_model_efl_model_base_load_status_get(Eo *obj EINA_UNUSED,
|
||||
Esoap_Model_Data *pd)
|
||||
{
|
||||
DBG("(%p)", obj);
|
||||
return pd->load.status;
|
||||
}
|
||||
|
||||
static void
|
||||
_esoap_model_efl_model_base_unload(Eo *obj EINA_UNUSED, Esoap_Model_Data *pd)
|
||||
{
|
||||
DBG("(%p)", obj);
|
||||
|
||||
_clear(pd);
|
||||
|
||||
efl_model_load_set(pd->obj, &pd->load, EFL_MODEL_LOAD_STATUS_UNLOADED);
|
||||
}
|
||||
|
||||
Eo *
|
||||
_esoap_model_efl_model_base_child_add(Eo *obj, Esoap_Model_Data *pd EINA_UNUSED)
|
||||
{
|
||||
DBG("(%p)", obj);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static Efl_Model_Load_Status
|
||||
_esoap_model_efl_model_base_child_del(Eo *obj,
|
||||
Esoap_Model_Data *pd EINA_UNUSED,
|
||||
Eo *child EINA_UNUSED)
|
||||
{
|
||||
DBG("(%p)", obj);
|
||||
return EFL_MODEL_LOAD_STATUS_ERROR;
|
||||
}
|
||||
|
||||
static Efl_Model_Load_Status
|
||||
_esoap_model_efl_model_base_children_slice_get(Eo *obj EINA_UNUSED,
|
||||
Esoap_Model_Data *pd,
|
||||
unsigned start EINA_UNUSED,
|
||||
unsigned count EINA_UNUSED,
|
||||
Eina_Accessor **children_accessor)
|
||||
{
|
||||
DBG("(%p)", obj);
|
||||
|
||||
if (!(pd->load.status & EFL_MODEL_LOAD_STATUS_LOADED_CHILDREN))
|
||||
{
|
||||
WRN("(%p): Children not loaded", obj);
|
||||
*children_accessor = NULL;
|
||||
return pd->load.status;
|
||||
}
|
||||
|
||||
*children_accessor = efl_model_list_slice(pd->children_list, start, count);
|
||||
return pd->load.status;
|
||||
}
|
||||
|
||||
static Efl_Model_Load_Status
|
||||
_esoap_model_efl_model_base_children_count_get(Eo *obj EINA_UNUSED,
|
||||
Esoap_Model_Data *pd,
|
||||
unsigned *children_count)
|
||||
{
|
||||
DBG("(%p)", obj);
|
||||
*children_count = eina_list_count(pd->children_list);
|
||||
return pd->load.status;
|
||||
}
|
||||
|
||||
static void
|
||||
_esoap_model_efl_model_base_children_load(Eo *obj EINA_UNUSED, Esoap_Model_Data *pd)
|
||||
{
|
||||
DBG("(%p)", obj);
|
||||
|
||||
if (pd->load.status & EFL_MODEL_LOAD_STATUS_LOADED_CHILDREN)
|
||||
return;
|
||||
|
||||
if (!_init(pd))
|
||||
return;
|
||||
|
||||
_children_load(pd);
|
||||
}
|
||||
|
||||
static void
|
||||
_children_load(Esoap_Model_Data *pd)
|
||||
{
|
||||
DBG("(%p)", pd->obj);
|
||||
|
||||
efl_model_load_set(pd->obj, &pd->load, EFL_MODEL_LOAD_STATUS_LOADING_CHILDREN);
|
||||
|
||||
const Eina_Value *xml_value;
|
||||
Efl_Model_Load_Status status;
|
||||
eo_do(pd->xml, status = efl_model_property_get("/", &xml_value));
|
||||
EINA_SAFETY_ON_FALSE_RETURN(EFL_MODEL_LOAD_STATUS_LOADED_PROPERTIES & status);
|
||||
|
||||
const char *xml = NULL;
|
||||
eina_value_get(xml_value, &xml);
|
||||
_perform(pd, xml);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_properties_changed_cb(void *data,
|
||||
Eo *child EINA_UNUSED,
|
||||
const Eo_Event_Description *desc EINA_UNUSED,
|
||||
void *event_info)
|
||||
{
|
||||
eo_do(data, eo_event_callback_call(EFL_MODEL_BASE_EVENT_PROPERTIES_CHANGED, event_info));
|
||||
return EO_CALLBACK_CONTINUE;
|
||||
}
|
||||
|
||||
static bool
|
||||
_init(Esoap_Model_Data *pd)
|
||||
{
|
||||
if (pd->xml)
|
||||
return true;
|
||||
|
||||
pd->xml = eo_add(EFLAT_XML_MODEL_CLASS,
|
||||
NULL,
|
||||
eflat_xml_model_constructor(NULL));
|
||||
|
||||
eo_do(pd->xml, eo_event_callback_add(EFL_MODEL_BASE_EVENT_PROPERTIES_CHANGED,
|
||||
_properties_changed_cb,
|
||||
pd->obj));
|
||||
return true;
|
||||
}
|
||||
|
||||
static void
|
||||
_clear(Esoap_Model_Data *pd)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN(pd);
|
||||
|
||||
if (pd->xml)
|
||||
{
|
||||
eo_unref(pd->xml);
|
||||
pd->xml = NULL;
|
||||
}
|
||||
|
||||
Eo *child;
|
||||
EINA_LIST_FREE(pd->children_list, child)
|
||||
eo_del(child);
|
||||
}
|
||||
|
||||
static size_t
|
||||
_write_data_cb(void *ptr, size_t size, size_t nmeb, void *data)
|
||||
{
|
||||
Eina_Strbuf *buf = (Eina_Strbuf *)data;
|
||||
Eina_Bool ret = eina_strbuf_append_length(buf, ptr, size * nmeb);
|
||||
EINA_SAFETY_ON_FALSE_RETURN_VAL(ret, 0);
|
||||
return size * nmeb;
|
||||
}
|
||||
|
||||
static void
|
||||
_perform(Esoap_Model_Data *pd, const char *xml)
|
||||
{
|
||||
DBG("(%p)", pd->obj);
|
||||
Esoap_Model_Perform_Data *data = calloc(1, sizeof(Esoap_Model_Perform_Data));
|
||||
data->pd = pd;
|
||||
data->response = eina_strbuf_new();
|
||||
|
||||
const char *SOAP_ACTION = "SOAPAction:";
|
||||
const size_t soap_action_lenght = strlen(SOAP_ACTION) + strlen(pd->action) + 1;
|
||||
data->soap_action = malloc(soap_action_lenght);
|
||||
snprintf(data->soap_action, soap_action_lenght, "%s%s", SOAP_ACTION, pd->action);
|
||||
|
||||
data->header = curl_slist_append(data->header, "Content-Type:application/soap+xml");
|
||||
data->header = curl_slist_append(data->header, data->soap_action);
|
||||
data->header = curl_slist_append(data->header, "Transfer-Encoding: chunked");
|
||||
data->header = curl_slist_append(data->header, "Expect:");
|
||||
|
||||
data->curl = curl_easy_init();
|
||||
EINA_SAFETY_ON_NULL_RETURN(data->curl);
|
||||
|
||||
curl_easy_setopt(data->curl, CURLOPT_URL, pd->url);
|
||||
curl_easy_setopt(data->curl, CURLOPT_POST, 1L);
|
||||
curl_easy_setopt(data->curl, CURLOPT_WRITEFUNCTION, _write_data_cb);
|
||||
curl_easy_setopt(data->curl, CURLOPT_WRITEDATA, data->response);
|
||||
curl_easy_setopt(data->curl, CURLOPT_HTTPHEADER, data->header);
|
||||
curl_easy_setopt(data->curl, CURLOPT_COPYPOSTFIELDS, xml);
|
||||
curl_easy_setopt(data->curl, CURLOPT_VERBOSE, 1L);
|
||||
|
||||
data->thread = ecore_thread_run((Ecore_Thread_Cb)_perform_cb,
|
||||
(Ecore_Thread_Cb)_perform_end_cb,
|
||||
(Ecore_Thread_Cb)_perform_cancel_cb, data);
|
||||
EINA_SAFETY_ON_NULL_RETURN(data->thread);
|
||||
}
|
||||
|
||||
static void
|
||||
_perform_cb(Esoap_Model_Perform_Data *data, Ecore_Thread *thread)
|
||||
{
|
||||
DBG("(%p)", data->pd->obj);
|
||||
CURLcode res = curl_easy_perform(data->curl);
|
||||
if (CURLE_OK != res)
|
||||
{
|
||||
ERR("Could not perform: %d", res);
|
||||
ecore_thread_cancel(thread);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_perform_end_cb(Esoap_Model_Perform_Data *data,
|
||||
Ecore_Thread *thread EINA_UNUSED)
|
||||
{
|
||||
DBG("(%p)", data->pd->obj);
|
||||
const char *response = eina_strbuf_string_get(data->response);
|
||||
|
||||
DBG("(%p) response: %s", data->pd->obj, response);
|
||||
|
||||
Eo *child = eo_add(EFLAT_XML_MODEL_CLASS,
|
||||
NULL,
|
||||
eflat_xml_model_constructor(response));
|
||||
data->pd->children_list = eina_list_append(data->pd->children_list, child);
|
||||
|
||||
unsigned int count = eina_list_count(data->pd->children_list);
|
||||
Efl_Model_Children_Event evt = {.child = child, .index = count};
|
||||
eo_do(data->pd->obj, eo_event_callback_call(EFL_MODEL_BASE_EVENT_CHILD_ADDED, &evt),
|
||||
eo_event_callback_call(EFL_MODEL_BASE_EVENT_CHILDREN_COUNT_CHANGED, &count));
|
||||
|
||||
efl_model_load_set(data->pd->obj, &data->pd->load, EFL_MODEL_LOAD_STATUS_LOADED_CHILDREN);
|
||||
|
||||
_perform_data_free(data);
|
||||
}
|
||||
|
||||
static void
|
||||
_perform_cancel_cb(Esoap_Model_Perform_Data *data,
|
||||
Ecore_Thread *thread EINA_UNUSED)
|
||||
{
|
||||
DBG("(%p)", data->pd->obj);
|
||||
efl_model_error_notify(data->pd->obj);
|
||||
_perform_data_free(data);
|
||||
}
|
||||
|
||||
static void
|
||||
_perform_data_free(Esoap_Model_Perform_Data *data)
|
||||
{
|
||||
DBG("(%p)", data->pd->obj);
|
||||
curl_easy_cleanup(data->curl);
|
||||
eina_strbuf_free(data->response);
|
||||
curl_slist_free_all(data->header);
|
||||
free(data->soap_action);
|
||||
free(data);
|
||||
}
|
||||
|
||||
#include "Esoap_Model.eo.c"
|
|
@ -0,0 +1,36 @@
|
|||
class Esoap.Model (Eo.Base, Efl.Model.Base) {
|
||||
legacy_prefix: null;
|
||||
methods {
|
||||
constructor {
|
||||
[[
|
||||
Custom Soap_Model constructor.
|
||||
@.constructor
|
||||
|
||||
@since 1.13
|
||||
]]
|
||||
params {
|
||||
url: const(char)*; [[The webservice URL]]
|
||||
action: const(char)*; [[The soap action]]
|
||||
}
|
||||
}
|
||||
}
|
||||
implements {
|
||||
Eo.Base.constructor;
|
||||
Eo.Base.destructor;
|
||||
Efl.Model.Base.properties.get;
|
||||
Efl.Model.Base.properties_load;
|
||||
Efl.Model.Base.property.set;
|
||||
Efl.Model.Base.property.get;
|
||||
Efl.Model.Base.load;
|
||||
Efl.Model.Base.load_status.get;
|
||||
Efl.Model.Base.unload;
|
||||
Efl.Model.Base.child_add;
|
||||
Efl.Model.Base.child_del;
|
||||
Efl.Model.Base.children_slice.get;
|
||||
Efl.Model.Base.children_count.get;
|
||||
Efl.Model.Base.children_load;
|
||||
}
|
||||
constructors {
|
||||
.constructor;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
#ifndef _ESOAP_MODEL_PRIVATE_H
|
||||
#define _ESOAP_MODEL_PRIVATE_H
|
||||
|
||||
#include "Esoap_Model.h"
|
||||
|
||||
#include <Eflat_Xml_Model.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
/* logging support */
|
||||
extern int _esoap_model_log_dom;
|
||||
|
||||
#define CRI(...) EINA_LOG_DOM_CRIT(_esoap_model_log_dom, __VA_ARGS__)
|
||||
#define ERR(...) EINA_LOG_DOM_ERR(_esoap_model_log_dom, __VA_ARGS__)
|
||||
#define WRN(...) EINA_LOG_DOM_WARN(_esoap_model_log_dom, __VA_ARGS__)
|
||||
#define INF(...) EINA_LOG_DOM_INFO(_esoap_model_log_dom, __VA_ARGS__)
|
||||
#define DBG(...) EINA_LOG_DOM_DBG(_esoap_model_log_dom, __VA_ARGS__)
|
||||
|
||||
typedef struct _Esoap_Model_Data Esoap_Model_Data;
|
||||
|
||||
/**
|
||||
* esoap_model
|
||||
*/
|
||||
struct _Esoap_Model_Data
|
||||
{
|
||||
Eo *obj;
|
||||
Efl_Model_Load load;
|
||||
Eina_List *children_list;
|
||||
Eflat_Xml_Model *xml;
|
||||
char *url;
|
||||
char *action;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -705,7 +705,7 @@ _lua_implicit_metatable_drop(lua_State *L, const char *name)
|
|||
if (lua_istable(L, 1) && lua_getmetatable(L, 1))
|
||||
{
|
||||
luaL_getmetatable(L, name);
|
||||
if (lua_equal(L, -1, -2))
|
||||
if (lua_compare(L, -1, -2, LUA_OPEQ))
|
||||
{
|
||||
lua_remove(L, 1);
|
||||
ret = 1;
|
||||
|
@ -1931,7 +1931,7 @@ _lua_parameter_parse(Evas_Filter_Program *pgm, lua_State *L,
|
|||
{
|
||||
luaL_getmetatable(L, _lua_color_meta);
|
||||
lua_getmetatable(L, i);
|
||||
if (!lua_isnil(L, -1) && lua_equal(L, -2, -1))
|
||||
if (!lua_isnil(L, -1) && lua_compare(L, -2, -1, LUA_OPEQ))
|
||||
{
|
||||
// this is a color already
|
||||
cid = i;
|
||||
|
@ -2321,7 +2321,8 @@ _lua_class_create(lua_State *L, const char *name,
|
|||
const luaL_Reg *meta, const luaL_Reg *methods)
|
||||
{
|
||||
luaL_newmetatable(L, name);
|
||||
luaL_register(L, NULL, meta);
|
||||
lua_pushvalue(L, -1);
|
||||
lua_setglobal(L, meta);
|
||||
lua_pushliteral(L, "__metatable");
|
||||
lua_pushvalue(L, -2);
|
||||
lua_rawset(L, -3);
|
||||
|
@ -2329,7 +2330,8 @@ _lua_class_create(lua_State *L, const char *name,
|
|||
{
|
||||
lua_pushliteral(L, _lua_methods_table);
|
||||
lua_newtable(L);
|
||||
luaL_register(L, NULL, methods);
|
||||
lua_pushvalue(L, -1);
|
||||
lua_setglobal(L, methods);
|
||||
lua_rawset(L, -3);
|
||||
}
|
||||
lua_pushvalue(L, -1);
|
||||
|
@ -2358,7 +2360,8 @@ _lua_state_create(Evas_Filter_Program *pgm)
|
|||
|
||||
// Implement print
|
||||
lua_getglobal(L, "_G");
|
||||
luaL_register(L, NULL, printlib);
|
||||
lua_pushvalue(L, -1);
|
||||
lua_setglobal(L, printlib);
|
||||
lua_pop(L, 1);
|
||||
|
||||
// Add backtrace error function
|
||||
|
@ -2431,7 +2434,7 @@ _lua_backtrace(lua_State *L)
|
|||
if (!lua_isstring(L, 1)) /* 'message' not a string? */
|
||||
return 1; /* keep it intact */
|
||||
ERR("Lua error: %s", lua_tolstring(L, 1, NULL));
|
||||
lua_getfield(L, LUA_GLOBALSINDEX, "debug");
|
||||
lua_getglobal(L, "debug");
|
||||
if (!lua_istable(L, -1))
|
||||
{
|
||||
lua_pop(L, 1);
|
||||
|
|
|
@ -0,0 +1,121 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "eflat_xml_model_suite.h"
|
||||
|
||||
#include <Eina.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int _test_eflat_xml_model_log_dom = -1;
|
||||
|
||||
typedef struct _Eflat_Xml_Test_Case Eflat_Xml_Test_Case;
|
||||
|
||||
struct _Eflat_Xml_Test_Case
|
||||
{
|
||||
const char *test_case;
|
||||
void (*build)(TCase *tc);
|
||||
};
|
||||
|
||||
static const Eflat_Xml_Test_Case etc[] = {
|
||||
{ "Eflat_Xml_Model", eflat_xml_test_eflat_xml_model },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
static void
|
||||
_list_tests(void)
|
||||
{
|
||||
const Eflat_Xml_Test_Case *it = etc;
|
||||
fputs("Available Test Cases:\n", stderr);
|
||||
for (; it->test_case; it++)
|
||||
fprintf(stderr, "\t%s\n", it->test_case);
|
||||
}
|
||||
|
||||
static bool
|
||||
_use_test(int argc, const char **argv, const char *test_case)
|
||||
{
|
||||
if (argc < 1)
|
||||
return true;
|
||||
|
||||
for (; argc > 0; argc--, argv++)
|
||||
if (strcmp(test_case, *argv) == 0)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
static Suite *
|
||||
_eflat_xml_suite_build(int argc, const char **argv)
|
||||
{
|
||||
Suite *s = suite_create("Eflat_Xml");
|
||||
|
||||
for (int i = 0; etc[i].test_case; ++i)
|
||||
{
|
||||
if (!_use_test(argc, argv, etc[i].test_case)) continue;
|
||||
TCase *tc = tcase_create(etc[i].test_case);
|
||||
|
||||
etc[i].build(tc);
|
||||
|
||||
suite_add_tcase(s, tc);
|
||||
//tcase_set_timeout(tc, 0);
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
static void
|
||||
_init_logging(void)
|
||||
{
|
||||
_test_eflat_xml_model_log_dom = eina_log_domain_register("test_eflat_xml_model", EINA_COLOR_LIGHTBLUE);
|
||||
if (_test_eflat_xml_model_log_dom < 0)
|
||||
ck_abort_msg("Could not register log domain: test_eflat_xml_model");
|
||||
|
||||
//eina_log_domain_level_set("esskyuehl", EINA_LOG_LEVEL_DBG);
|
||||
//eina_log_domain_level_set("eflat_xml_model", EINA_LOG_LEVEL_DBG);
|
||||
eina_log_domain_level_set("test_eflat_xml_model", EINA_LOG_LEVEL_DBG);
|
||||
}
|
||||
|
||||
static void
|
||||
_shutdown_logging(void)
|
||||
{
|
||||
eina_log_domain_unregister(_test_eflat_xml_model_log_dom);
|
||||
_test_eflat_xml_model_log_dom = -1;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
for (int i = 1; i < argc; ++i)
|
||||
{
|
||||
if ((strcmp(argv[i], "-h") == 0) ||
|
||||
(strcmp(argv[i], "--help") == 0))
|
||||
{
|
||||
fprintf(stderr, "Usage:\n\t%s [test_case1 .. [test_caseN]]\n", argv[0]);
|
||||
_list_tests();
|
||||
return 0;
|
||||
}
|
||||
else if ((strcmp(argv[i], "-l") == 0) ||
|
||||
(strcmp(argv[i], "--list") == 0))
|
||||
{
|
||||
_list_tests();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
_init_logging();
|
||||
|
||||
Suite *s = _eflat_xml_suite_build(argc - 1, (const char **)argv + 1);
|
||||
SRunner *sr = srunner_create(s);
|
||||
|
||||
srunner_set_xml(sr, TESTS_BUILD_DIR "/check-results.xml");
|
||||
|
||||
srunner_run_all(sr, CK_ENV);
|
||||
int failed_count = srunner_ntests_failed(sr);
|
||||
srunner_free(sr);
|
||||
|
||||
_shutdown_logging();
|
||||
|
||||
return (failed_count == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
#ifndef _EFLAT_XML_SUITE_H
|
||||
#define _EFLAT_XML_SUITE_H
|
||||
|
||||
#include <check.h>
|
||||
|
||||
extern int _test_eflat_xml_model_log_dom;
|
||||
|
||||
#define CRI(...) EINA_LOG_DOM_CRIT(_test_eflat_xml_model_log_dom, __VA_ARGS__)
|
||||
#define ERR(...) EINA_LOG_DOM_ERR(_test_eflat_xml_model_log_dom, __VA_ARGS__)
|
||||
#define WRN(...) EINA_LOG_DOM_WARN(_test_eflat_xml_model_log_dom, __VA_ARGS__)
|
||||
#define INF(...) EINA_LOG_DOM_INFO(_test_eflat_xml_model_log_dom, __VA_ARGS__)
|
||||
#define DBG(...) EINA_LOG_DOM_DBG(_test_eflat_xml_model_log_dom, __VA_ARGS__)
|
||||
|
||||
void eflat_xml_test_eflat_xml_model(TCase *tc);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,503 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "eflat_xml_model_test_eflat_xml_model.h"
|
||||
#include "eflat_xml_model_suite.h"
|
||||
|
||||
#include <Ecore.h>
|
||||
#include <Eina.h>
|
||||
#include <Eflat_Xml_Model.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
static void
|
||||
_setup(void)
|
||||
{
|
||||
int ret = eflat_xml_model_init();
|
||||
ck_assert_int_ge(ret, 1);
|
||||
}
|
||||
|
||||
static void
|
||||
_teardown(void)
|
||||
{
|
||||
int ret = eflat_xml_model_shutdown();
|
||||
ck_assert_int_eq(ret, 0);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_eo_event_load_status_cb(void *data,
|
||||
Eo *obj EINA_UNUSED,
|
||||
const Eo_Event_Description *desc EINA_UNUSED,
|
||||
void *event_info EINA_UNUSED)
|
||||
{
|
||||
Efl_Model_Load_Status expected_status = *((Efl_Model_Load_Status*)data);
|
||||
Efl_Model_Load load = *((Efl_Model_Load*)event_info);
|
||||
if ((load.status & expected_status) != expected_status)
|
||||
return EINA_TRUE;
|
||||
|
||||
ecore_main_loop_quit();
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
_wait_until_load_status(Efl_Model_Base *emodel,
|
||||
Efl_Model_Load_Status expected_status)
|
||||
{
|
||||
Efl_Model_Load_Status actual_status;
|
||||
eo_do(emodel, actual_status = efl_model_load_status_get());
|
||||
if (expected_status == actual_status) return;
|
||||
|
||||
eo_do(emodel, eo_event_callback_add(EFL_MODEL_BASE_EVENT_LOAD_STATUS,
|
||||
_eo_event_load_status_cb,
|
||||
&expected_status));
|
||||
ecore_main_loop_begin();
|
||||
eo_do(emodel, eo_event_callback_del(EFL_MODEL_BASE_EVENT_LOAD_STATUS,
|
||||
_eo_event_load_status_cb,
|
||||
&expected_status));
|
||||
}
|
||||
|
||||
static void
|
||||
_check_efl_model_property_str_eq(Efl_Model_Base *emodel,
|
||||
const char *property,
|
||||
const char *expected_value)
|
||||
{
|
||||
const Eina_Value *value;
|
||||
Efl_Model_Load_Status status;
|
||||
eo_do(emodel, status = efl_model_property_get(property, &value));
|
||||
ck_assert_int_eq(EFL_MODEL_LOAD_STATUS_LOADED, status);
|
||||
ck_assert_ptr_ne(NULL, value);
|
||||
|
||||
const Eina_Value_Type *property_type = eina_value_type_get(value);
|
||||
fail_if(EINA_VALUE_TYPE_STRING != property_type &&
|
||||
EINA_VALUE_TYPE_STRINGSHARE != property_type);
|
||||
|
||||
const char *actual_value = NULL;
|
||||
eina_value_get(value, &actual_value);
|
||||
ck_assert_str_eq(expected_value, actual_value);
|
||||
}
|
||||
|
||||
static void
|
||||
_check_efl_model_load(Efl_Model_Base *model)
|
||||
{
|
||||
eo_do(model, efl_model_load());
|
||||
_wait_until_load_status(model, EFL_MODEL_LOAD_STATUS_LOADED);
|
||||
}
|
||||
|
||||
static void
|
||||
_check_efl_model_properties(Efl_Model_Base *model,
|
||||
const char *expected_properties[])
|
||||
{
|
||||
Eina_Array *properties = NULL;
|
||||
Efl_Model_Load_Status status;
|
||||
eo_do(model, status = efl_model_properties_get(&properties));
|
||||
ck_assert_int_eq(EFL_MODEL_LOAD_STATUS_LOADED, status);
|
||||
ck_assert_ptr_ne(NULL, properties);
|
||||
|
||||
unsigned int actual_properties_count = eina_array_count(properties);
|
||||
|
||||
unsigned int expected_properties_count = 0;
|
||||
const char *expected_property = NULL;
|
||||
while ((expected_property = *expected_properties++))
|
||||
{
|
||||
const char *actual_property = eina_array_data_get(properties,
|
||||
expected_properties_count);
|
||||
ck_assert_str_eq(expected_property, actual_property);
|
||||
++expected_properties_count;
|
||||
ck_assert_int_le(expected_properties_count, actual_properties_count);
|
||||
}
|
||||
|
||||
ck_assert_int_eq(expected_properties_count, actual_properties_count);
|
||||
}
|
||||
|
||||
static Eflat_Xml_Model *
|
||||
_create_flat_xml_model(void)
|
||||
{
|
||||
Efl_Model_Base *xml_model = eo_add(EFLAT_XML_MODEL_CLASS,
|
||||
NULL,
|
||||
eflat_xml_model_constructor(NULL));
|
||||
ck_assert_ptr_ne(NULL, xml_model);
|
||||
return xml_model;
|
||||
}
|
||||
|
||||
START_TEST(smoke)
|
||||
{
|
||||
Efl_Model_Base *xml_model = _create_flat_xml_model();
|
||||
eo_unref(xml_model);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
static void
|
||||
_check_string_property_set(Efl_Model_Base *model,
|
||||
const char *property,
|
||||
const char *v)
|
||||
{
|
||||
Eina_Value value;
|
||||
eina_value_setup(&value, EINA_VALUE_TYPE_STRING);
|
||||
eina_value_set(&value, v);
|
||||
Efl_Model_Load_Status status;
|
||||
eo_do(model, status = efl_model_property_set(property, &value));
|
||||
eina_value_flush(&value);
|
||||
ck_assert_int_eq(EFL_MODEL_LOAD_STATUS_LOADED, status);
|
||||
}
|
||||
|
||||
static void
|
||||
_check_xml_string(Efl_Model_Base *model, const char *expected_xml_string)
|
||||
{
|
||||
_check_efl_model_property_str_eq(model, "/", expected_xml_string);
|
||||
}
|
||||
|
||||
static const char *SAMPLE_XML =
|
||||
"<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"
|
||||
"<soap:Envelope xmlns:soap=\"http://www.w3.org/2001/12/soap-envelope\" soap:encodingStyle=\"http://www.w3.org/2001/12/soap-encoding\">\n"
|
||||
" <soap:Header>\n"
|
||||
" <m:Trans xmlns:m=\"http://my.namespace/header\" soap:mustUnderstand=\"1\">\n"
|
||||
" 1234\n"
|
||||
" </m:Trans>\n"
|
||||
" </soap:Header>\n"
|
||||
" <soap:Body>\n"
|
||||
" <m:MethodName xmlns:m=\"http://my.namespece/body\">\n"
|
||||
" <m:Item>\n"
|
||||
" Value\n"
|
||||
" </m:Item>\n"
|
||||
" </m:MethodName>\n"
|
||||
" </soap:Body>\n"
|
||||
"</soap:Envelope>\n";
|
||||
|
||||
static void
|
||||
_check_sample_xml_properties_names(Efl_Model_Base *xml_model)
|
||||
{
|
||||
_check_efl_model_properties(xml_model, (const char*[]){
|
||||
"?xml",
|
||||
"soap:Envelope@xmlns:soap",
|
||||
"soap:Envelope@soap:encodingStyle",
|
||||
"soap:Envelope/soap:Header/m:Trans@xmlns:m",
|
||||
"soap:Envelope/soap:Header/m:Trans@soap:mustUnderstand",
|
||||
"soap:Envelope/soap:Header/m:Trans",
|
||||
"soap:Envelope/soap:Body/m:MethodName@xmlns:m",
|
||||
"soap:Envelope/soap:Body/m:MethodName/m:Item",
|
||||
NULL});
|
||||
}
|
||||
|
||||
static void
|
||||
_check_sample_xml_properties_values(Efl_Model_Base *xml_model)
|
||||
{
|
||||
_check_efl_model_property_str_eq(xml_model, "?xml", "version=\"1.0\" encoding=\"UTF-8\"");
|
||||
_check_efl_model_property_str_eq(xml_model, "soap:Envelope@xmlns:soap", "http://www.w3.org/2001/12/soap-envelope");
|
||||
_check_efl_model_property_str_eq(xml_model, "soap:Envelope@soap:encodingStyle", "http://www.w3.org/2001/12/soap-encoding");
|
||||
_check_efl_model_property_str_eq(xml_model, "soap:Envelope/soap:Header/m:Trans@xmlns:m", "http://my.namespace/header");
|
||||
_check_efl_model_property_str_eq(xml_model, "soap:Envelope/soap:Header/m:Trans@soap:mustUnderstand", "1");
|
||||
_check_efl_model_property_str_eq(xml_model, "soap:Envelope/soap:Header/m:Trans", "1234");
|
||||
_check_efl_model_property_str_eq(xml_model, "soap:Envelope/soap:Body/m:MethodName@xmlns:m", "http://my.namespece/body");
|
||||
_check_efl_model_property_str_eq(xml_model, "soap:Envelope/soap:Body/m:MethodName/m:Item", "Value");
|
||||
}
|
||||
|
||||
static void
|
||||
_check_property_set(Efl_Model_Base *xml_model)
|
||||
{
|
||||
_check_string_property_set(xml_model, "?xml", "version=\"1.0\" encoding=\"UTF-8\"");
|
||||
_check_string_property_set(xml_model, "soap:Envelope@xmlns:soap", "http://www.w3.org/2001/12/soap-envelope");
|
||||
_check_string_property_set(xml_model, "soap:Envelope@soap:encodingStyle", "http://www.w3.org/2001/12/soap-encoding");
|
||||
_check_string_property_set(xml_model, "soap:Envelope/soap:Header/m:Trans@xmlns:m", "http://my.namespace/header");
|
||||
_check_string_property_set(xml_model, "soap:Envelope/soap:Header/m:Trans@soap:mustUnderstand", "1");
|
||||
_check_string_property_set(xml_model, "soap:Envelope/soap:Header/m:Trans", "1234");
|
||||
_check_string_property_set(xml_model, "soap:Envelope/soap:Body/m:MethodName@xmlns:m", "http://my.namespece/body");
|
||||
_check_string_property_set(xml_model, "soap:Envelope/soap:Body/m:MethodName/m:Item", "Value");
|
||||
|
||||
_check_xml_string(xml_model, SAMPLE_XML);
|
||||
|
||||
_check_sample_xml_properties_names(xml_model);
|
||||
|
||||
_check_efl_model_property_str_eq(xml_model, "?xml", "version=\"1.0\" encoding=\"UTF-8\"");
|
||||
}
|
||||
|
||||
START_TEST(property_set_basic)
|
||||
{
|
||||
Efl_Model_Base *xml_model = _create_flat_xml_model();
|
||||
|
||||
_check_efl_model_load(xml_model);
|
||||
|
||||
_check_property_set(xml_model);
|
||||
|
||||
eo_unref(xml_model);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
static void
|
||||
_check_property_not_exists(Efl_Model_Base *model, const char *property)
|
||||
{
|
||||
const Eina_Value *value;
|
||||
Efl_Model_Load_Status status;
|
||||
eo_do(model, status = efl_model_property_get(property, &value));
|
||||
ck_assert_int_eq(EFL_MODEL_LOAD_STATUS_ERROR, status);
|
||||
|
||||
Eina_Array *properties = NULL;
|
||||
eo_do(model, status = efl_model_properties_get(&properties));
|
||||
ck_assert_int_eq(EFL_MODEL_LOAD_STATUS_LOADED, status);
|
||||
ck_assert_ptr_ne(NULL, properties);
|
||||
|
||||
unsigned int i;
|
||||
char *item;
|
||||
Eina_Array_Iterator it;
|
||||
EINA_ARRAY_ITER_NEXT(properties, i, item, it)
|
||||
ck_assert_str_ne(property, item);
|
||||
}
|
||||
|
||||
START_TEST(property_set_existing)
|
||||
{
|
||||
Efl_Model_Base *xml_model = _create_flat_xml_model();
|
||||
|
||||
_check_efl_model_load(xml_model);
|
||||
|
||||
_check_property_set(xml_model);
|
||||
|
||||
// replaces an attribute
|
||||
_check_string_property_set(xml_model, "soap:Envelope/soap:Header/m:Trans@xmlns:m", "http://other.namespace/header");
|
||||
|
||||
_check_efl_model_properties(xml_model, (const char*[]){
|
||||
"?xml",
|
||||
"soap:Envelope@xmlns:soap",
|
||||
"soap:Envelope@soap:encodingStyle",
|
||||
"soap:Envelope/soap:Header/m:Trans@soap:mustUnderstand",
|
||||
"soap:Envelope/soap:Header/m:Trans",
|
||||
"soap:Envelope/soap:Body/m:MethodName@xmlns:m",
|
||||
"soap:Envelope/soap:Body/m:MethodName/m:Item",
|
||||
"soap:Envelope/soap:Header/m:Trans@xmlns:m",
|
||||
NULL});
|
||||
|
||||
// replaces a value
|
||||
_check_string_property_set(xml_model, "soap:Envelope/soap:Header/m:Trans", "4321");
|
||||
|
||||
_check_efl_model_properties(xml_model, (const char*[]){
|
||||
"?xml",
|
||||
"soap:Envelope@xmlns:soap",
|
||||
"soap:Envelope@soap:encodingStyle",
|
||||
"soap:Envelope/soap:Header/m:Trans@soap:mustUnderstand",
|
||||
"soap:Envelope/soap:Body/m:MethodName@xmlns:m",
|
||||
"soap:Envelope/soap:Body/m:MethodName/m:Item",
|
||||
"soap:Envelope/soap:Header/m:Trans@xmlns:m",
|
||||
"soap:Envelope/soap:Header/m:Trans",
|
||||
NULL});
|
||||
|
||||
// clears a value
|
||||
_check_string_property_set(xml_model, "soap:Envelope/soap:Body/m:MethodName/m:Item", "");
|
||||
|
||||
_check_xml_string(xml_model,
|
||||
"<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"
|
||||
"<soap:Envelope xmlns:soap=\"http://www.w3.org/2001/12/soap-envelope\" soap:encodingStyle=\"http://www.w3.org/2001/12/soap-encoding\">\n"
|
||||
" <soap:Header>\n"
|
||||
" <m:Trans xmlns:m=\"http://other.namespace/header\" soap:mustUnderstand=\"1\">\n"
|
||||
" 4321\n"
|
||||
" </m:Trans>\n"
|
||||
" </soap:Header>\n"
|
||||
" <soap:Body>\n"
|
||||
" <m:MethodName xmlns:m=\"http://my.namespece/body\">\n"
|
||||
" <m:Item/>\n"
|
||||
" </m:MethodName>\n"
|
||||
" </soap:Body>\n"
|
||||
"</soap:Envelope>\n"
|
||||
);
|
||||
|
||||
_check_efl_model_properties(xml_model, (const char*[]){
|
||||
"?xml",
|
||||
"soap:Envelope@xmlns:soap",
|
||||
"soap:Envelope@soap:encodingStyle",
|
||||
"soap:Envelope/soap:Header/m:Trans@soap:mustUnderstand",
|
||||
"soap:Envelope/soap:Body/m:MethodName@xmlns:m",
|
||||
"soap:Envelope/soap:Header/m:Trans@xmlns:m",
|
||||
"soap:Envelope/soap:Header/m:Trans",
|
||||
"soap:Envelope/soap:Body/m:MethodName/m:Item",
|
||||
NULL});
|
||||
|
||||
// clearing a value clears its children too
|
||||
_check_string_property_set(xml_model, "soap:Envelope/soap:Body", "");
|
||||
|
||||
_check_property_not_exists(xml_model, "soap:Envelope/soap:Body/m:MethodName/m:Item");
|
||||
_check_property_not_exists(xml_model, "soap:Envelope/soap:Body/m:MethodName@xmlns:m");
|
||||
|
||||
_check_xml_string(xml_model,
|
||||
"<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"
|
||||
"<soap:Envelope xmlns:soap=\"http://www.w3.org/2001/12/soap-envelope\" soap:encodingStyle=\"http://www.w3.org/2001/12/soap-encoding\">\n"
|
||||
" <soap:Header>\n"
|
||||
" <m:Trans xmlns:m=\"http://other.namespace/header\" soap:mustUnderstand=\"1\">\n"
|
||||
" 4321\n"
|
||||
" </m:Trans>\n"
|
||||
" </soap:Header>\n"
|
||||
" <soap:Body/>\n"
|
||||
"</soap:Envelope>\n"
|
||||
);
|
||||
|
||||
_check_efl_model_properties(xml_model, (const char*[]){
|
||||
"?xml",
|
||||
"soap:Envelope@xmlns:soap",
|
||||
"soap:Envelope@soap:encodingStyle",
|
||||
"soap:Envelope/soap:Header/m:Trans@soap:mustUnderstand",
|
||||
"soap:Envelope/soap:Header/m:Trans@xmlns:m",
|
||||
"soap:Envelope/soap:Header/m:Trans",
|
||||
"soap:Envelope/soap:Body",
|
||||
NULL});
|
||||
|
||||
eo_unref(xml_model);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST(property_set_stream)
|
||||
{
|
||||
Efl_Model_Base *xml_model = _create_flat_xml_model();
|
||||
|
||||
_check_efl_model_load(xml_model);
|
||||
|
||||
// root level
|
||||
_check_string_property_set(xml_model, "/", SAMPLE_XML);
|
||||
_check_sample_xml_properties_names(xml_model);
|
||||
_check_sample_xml_properties_values(xml_model);
|
||||
|
||||
_check_string_property_set(xml_model, "soap:Envelope/soap:Body/",
|
||||
" <m:OtherMethod xmlns:m=\"http://my.namespece/body\">\n"
|
||||
" <m:OtherItem>\n"
|
||||
" OtherValue\n"
|
||||
" </m:OtherItem>\n"
|
||||
" </m:OtherMethod>\n"
|
||||
);
|
||||
|
||||
_check_efl_model_properties(xml_model, (const char*[]){
|
||||
"?xml",
|
||||
"soap:Envelope@xmlns:soap",
|
||||
"soap:Envelope@soap:encodingStyle",
|
||||
"soap:Envelope/soap:Header/m:Trans@xmlns:m",
|
||||
"soap:Envelope/soap:Header/m:Trans@soap:mustUnderstand",
|
||||
"soap:Envelope/soap:Header/m:Trans",
|
||||
"soap:Envelope/soap:Body/m:OtherMethod@xmlns:m",
|
||||
"soap:Envelope/soap:Body/m:OtherMethod/m:OtherItem",
|
||||
NULL});
|
||||
|
||||
|
||||
_check_xml_string(xml_model,
|
||||
"<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"
|
||||
"<soap:Envelope xmlns:soap=\"http://www.w3.org/2001/12/soap-envelope\" soap:encodingStyle=\"http://www.w3.org/2001/12/soap-encoding\">\n"
|
||||
" <soap:Header>\n"
|
||||
" <m:Trans xmlns:m=\"http://my.namespace/header\" soap:mustUnderstand=\"1\">\n"
|
||||
" 1234\n"
|
||||
" </m:Trans>\n"
|
||||
" </soap:Header>\n"
|
||||
" <soap:Body>\n"
|
||||
" <m:OtherMethod xmlns:m=\"http://my.namespece/body\">\n"
|
||||
" <m:OtherItem>\n"
|
||||
" OtherValue\n"
|
||||
" </m:OtherItem>\n"
|
||||
" </m:OtherMethod>\n"
|
||||
" </soap:Body>\n"
|
||||
"</soap:Envelope>\n"
|
||||
);
|
||||
|
||||
eo_unref(xml_model);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST(property_get_stream)
|
||||
{
|
||||
Efl_Model_Base *xml_model = _create_flat_xml_model();
|
||||
|
||||
_check_efl_model_load(xml_model);
|
||||
|
||||
_check_property_set(xml_model);
|
||||
|
||||
// sublevel
|
||||
_check_efl_model_property_str_eq(xml_model, "soap:Envelope/",
|
||||
"<soap:Header>\n"
|
||||
" <m:Trans xmlns:m=\"http://my.namespace/header\" soap:mustUnderstand=\"1\">\n"
|
||||
" 1234\n"
|
||||
" </m:Trans>\n"
|
||||
"</soap:Header>\n"
|
||||
"<soap:Body>\n"
|
||||
" <m:MethodName xmlns:m=\"http://my.namespece/body\">\n"
|
||||
" <m:Item>\n"
|
||||
" Value\n"
|
||||
" </m:Item>\n"
|
||||
" </m:MethodName>\n"
|
||||
"</soap:Body>\n"
|
||||
);
|
||||
|
||||
// sublevel
|
||||
_check_efl_model_property_str_eq(xml_model, "soap:Envelope/soap:Header/",
|
||||
"<m:Trans xmlns:m=\"http://my.namespace/header\" soap:mustUnderstand=\"1\">\n"
|
||||
" 1234\n"
|
||||
"</m:Trans>\n"
|
||||
);
|
||||
|
||||
// sublevel data
|
||||
_check_efl_model_property_str_eq(xml_model, "soap:Envelope/soap:Header/m:Trans/",
|
||||
"1234\n"
|
||||
);
|
||||
|
||||
eo_unref(xml_model);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST(load_status_get)
|
||||
{
|
||||
Efl_Model_Base *xml_model = _create_flat_xml_model();
|
||||
|
||||
Efl_Model_Load_Status status;
|
||||
eo_do(xml_model, status = efl_model_load_status_get());
|
||||
ck_assert_int_eq(EFL_MODEL_LOAD_STATUS_UNLOADED, status);
|
||||
|
||||
_check_efl_model_load(xml_model);
|
||||
|
||||
eo_do(xml_model, status = efl_model_load_status_get());
|
||||
ck_assert_int_eq(EFL_MODEL_LOAD_STATUS_LOADED, status);
|
||||
|
||||
eo_unref(xml_model);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST(unload)
|
||||
{
|
||||
Efl_Model_Base *xml_model = _create_flat_xml_model();
|
||||
|
||||
_check_efl_model_load(xml_model);
|
||||
_check_property_set(xml_model);
|
||||
|
||||
eo_do(xml_model, efl_model_unload());
|
||||
|
||||
// status must be unloaded now
|
||||
Efl_Model_Load_Status status;
|
||||
eo_do(xml_model, status = efl_model_load_status_get());
|
||||
ck_assert_int_eq(EFL_MODEL_LOAD_STATUS_UNLOADED, status);
|
||||
|
||||
// reload and manipulate content
|
||||
_check_efl_model_load(xml_model);
|
||||
_check_property_set(xml_model);
|
||||
|
||||
eo_unref(xml_model);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST(xml_load)
|
||||
{
|
||||
Efl_Model_Base *xml_model = eo_add(EFLAT_XML_MODEL_CLASS,
|
||||
NULL,
|
||||
eflat_xml_model_constructor(SAMPLE_XML));
|
||||
ck_assert_ptr_ne(NULL, xml_model);
|
||||
|
||||
_check_efl_model_load(xml_model);
|
||||
_check_sample_xml_properties_names(xml_model);
|
||||
_check_sample_xml_properties_values(xml_model);
|
||||
|
||||
eo_unref(xml_model);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
void
|
||||
eflat_xml_test_eflat_xml_model(TCase *tc)
|
||||
{
|
||||
tcase_add_checked_fixture(tc, _setup, _teardown);
|
||||
tcase_add_test(tc, smoke);
|
||||
tcase_add_test(tc, property_set_basic);
|
||||
tcase_add_test(tc, property_set_existing);
|
||||
tcase_add_test(tc, property_set_stream);
|
||||
tcase_add_test(tc, property_get_stream);
|
||||
tcase_add_test(tc, load_status_get);
|
||||
tcase_add_test(tc, unload);
|
||||
tcase_add_test(tc, xml_load);
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
#ifndef _EFLAT_XML_MODEL_TEST_EFLAT_XML_MODEL_H
|
||||
#define _EFLAT_XML_MODEL_TEST_EFLAT_XML_MODEL_H
|
||||
|
||||
#include <Eflat_Xml_Model.h>
|
||||
|
||||
#endif
|
|
@ -0,0 +1,119 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "esoap_model_suite.h"
|
||||
|
||||
#include <Eina.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int _test_esoap_model_log_dom = -1;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char *test_case;
|
||||
void (*build)(TCase *tc);
|
||||
} Esoap_Model_Test_Case;
|
||||
|
||||
static const Esoap_Model_Test_Case etc[] = {
|
||||
{ "Esoap_Model", esoap_model_test_esoap_model },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
static void
|
||||
_list_tests(void)
|
||||
{
|
||||
const Esoap_Model_Test_Case *it = etc;
|
||||
fputs("Available Test Cases:\n", stderr);
|
||||
for (; it->test_case; it++)
|
||||
fprintf(stderr, "\t%s\n", it->test_case);
|
||||
}
|
||||
|
||||
static bool
|
||||
_use_test(int argc, const char **argv, const char *test_case)
|
||||
{
|
||||
if (argc < 1)
|
||||
return true;
|
||||
|
||||
for (; argc > 0; argc--, argv++)
|
||||
if (strcmp(test_case, *argv) == 0)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
static Suite *
|
||||
_esoap_suite_build(int argc, const char **argv)
|
||||
{
|
||||
Suite *s = suite_create("Esoap");
|
||||
|
||||
for (int i = 0; etc[i].test_case; ++i)
|
||||
{
|
||||
if (!_use_test(argc, argv, etc[i].test_case)) continue;
|
||||
TCase *tc = tcase_create(etc[i].test_case);
|
||||
|
||||
etc[i].build(tc);
|
||||
|
||||
suite_add_tcase(s, tc);
|
||||
//tcase_set_timeout(tc, 0);
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
static void
|
||||
_init_logging(void)
|
||||
{
|
||||
_test_esoap_model_log_dom = eina_log_domain_register("test_esoap_model", EINA_COLOR_LIGHTBLUE);
|
||||
if (_test_esoap_model_log_dom < 0)
|
||||
ck_abort_msg("Could not register log domain: test_esoap_model");
|
||||
|
||||
//eina_log_domain_level_set("esskyuehl", EINA_LOG_LEVEL_DBG);
|
||||
//eina_log_domain_level_set("esoap_model", EINA_LOG_LEVEL_DBG);
|
||||
eina_log_domain_level_set("test_esoap_model", EINA_LOG_LEVEL_DBG);
|
||||
}
|
||||
|
||||
static void
|
||||
_shutdown_logging(void)
|
||||
{
|
||||
eina_log_domain_unregister(_test_esoap_model_log_dom);
|
||||
_test_esoap_model_log_dom = -1;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
for (int i = 1; i < argc; ++i)
|
||||
{
|
||||
if ((strcmp(argv[i], "-h") == 0) ||
|
||||
(strcmp(argv[i], "--help") == 0))
|
||||
{
|
||||
fprintf(stderr, "Usage:\n\t%s [test_case1 .. [test_caseN]]\n", argv[0]);
|
||||
_list_tests();
|
||||
return 0;
|
||||
}
|
||||
else if ((strcmp(argv[i], "-l") == 0) ||
|
||||
(strcmp(argv[i], "--list") == 0))
|
||||
{
|
||||
_list_tests();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
_init_logging();
|
||||
|
||||
Suite *s = _esoap_suite_build(argc - 1, (const char **)argv + 1);
|
||||
SRunner *sr = srunner_create(s);
|
||||
|
||||
srunner_set_xml(sr, TESTS_BUILD_DIR "/check-results.xml");
|
||||
|
||||
srunner_run_all(sr, CK_ENV);
|
||||
int failed_count = srunner_ntests_failed(sr);
|
||||
srunner_free(sr);
|
||||
|
||||
_shutdown_logging();
|
||||
|
||||
return (failed_count == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
#ifndef _ESOAP_MODEL_SUITE_H
|
||||
#define _ESOAP_MODEL_SUITE_H
|
||||
|
||||
#include <check.h>
|
||||
|
||||
extern int _test_esoap_model_log_dom;
|
||||
|
||||
#define CRI(...) EINA_LOG_DOM_CRIT(_test_esoap_model_log_dom, __VA_ARGS__)
|
||||
#define ERR(...) EINA_LOG_DOM_ERR(_test_esoap_model_log_dom, __VA_ARGS__)
|
||||
#define WRN(...) EINA_LOG_DOM_WARN(_test_esoap_model_log_dom, __VA_ARGS__)
|
||||
#define INF(...) EINA_LOG_DOM_INFO(_test_esoap_model_log_dom, __VA_ARGS__)
|
||||
#define DBG(...) EINA_LOG_DOM_DBG(_test_esoap_model_log_dom, __VA_ARGS__)
|
||||
|
||||
void esoap_model_test_esoap_model(TCase *tc);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,238 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "esoap_model_test_esoap_model.h"
|
||||
#include "esoap_model_suite.h"
|
||||
|
||||
#include <Ecore.h>
|
||||
#include <Eina.h>
|
||||
#include <Esoap_Model.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
static void
|
||||
_setup(void)
|
||||
{
|
||||
int ret = esoap_model_init();
|
||||
ck_assert_int_ge(ret, 1);
|
||||
}
|
||||
|
||||
static void
|
||||
_teardown(void)
|
||||
{
|
||||
int ret = esoap_model_shutdown();
|
||||
ck_assert_int_eq(ret, 0);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_eo_event_load_status_cb(void *data,
|
||||
Eo *obj EINA_UNUSED,
|
||||
const Eo_Event_Description *desc EINA_UNUSED,
|
||||
void *event_info EINA_UNUSED)
|
||||
{
|
||||
Efl_Model_Load_Status expected_status = *((Efl_Model_Load_Status*)data);
|
||||
Efl_Model_Load load = *((Efl_Model_Load*)event_info);
|
||||
if ((load.status & expected_status) != expected_status)
|
||||
return EINA_TRUE;
|
||||
|
||||
ecore_main_loop_quit();
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
_wait_until_load_status(Efl_Model_Base *model, Efl_Model_Load_Status expected_status)
|
||||
{
|
||||
Efl_Model_Load_Status actual_status;
|
||||
eo_do(model, actual_status = efl_model_load_status_get());
|
||||
if ((expected_status & actual_status) == expected_status) return;
|
||||
|
||||
eo_do(model, eo_event_callback_add(EFL_MODEL_BASE_EVENT_LOAD_STATUS, _eo_event_load_status_cb, &expected_status));
|
||||
ecore_main_loop_begin();
|
||||
eo_do(model, eo_event_callback_del(EFL_MODEL_BASE_EVENT_LOAD_STATUS, _eo_event_load_status_cb, &expected_status));
|
||||
}
|
||||
|
||||
static void
|
||||
_check_value_type_cannot_have_children(Efl_Model_Base *model)
|
||||
{
|
||||
Efl_Model_Base *child = eo_do_ret(model, child, efl_model_child_add());
|
||||
ck_assert_ptr_eq(NULL, child);
|
||||
}
|
||||
|
||||
static void
|
||||
_check_model_children_count_eq(Efl_Model_Base *model, unsigned int expected_children_count)
|
||||
{
|
||||
unsigned int actual_children_count = 0;
|
||||
eo_do(model, efl_model_children_count_get(&actual_children_count));
|
||||
ck_assert_int_eq(expected_children_count, actual_children_count);
|
||||
}
|
||||
|
||||
static void
|
||||
_check_model_property_int_eq(Efl_Model_Base *model, const char *property, int64_t expected_value)
|
||||
{
|
||||
const Eina_Value *value;
|
||||
Efl_Model_Load_Status status;
|
||||
eo_do(model, status = efl_model_property_get(property, &value));
|
||||
ck_assert_int_eq(EFL_MODEL_LOAD_STATUS_LOADED, status);
|
||||
ck_assert_ptr_ne(NULL, value);
|
||||
|
||||
const Eina_Value_Type *property_type = eina_value_type_get(value);
|
||||
ck_assert_ptr_eq(EINA_VALUE_TYPE_INT64, property_type);
|
||||
|
||||
int64_t actual_value = 0;
|
||||
eina_value_get(value, &actual_value);
|
||||
ck_assert_int_eq(expected_value, actual_value);
|
||||
}
|
||||
|
||||
static void
|
||||
_check_model_property_str_eq(Efl_Model_Base *model, const char *property, const char *expected_value)
|
||||
{
|
||||
const Eina_Value *value;
|
||||
Efl_Model_Load_Status status;
|
||||
eo_do(model, status = efl_model_property_get(property, &value));
|
||||
ck_assert_int_eq(EFL_MODEL_LOAD_STATUS_LOADED, status);
|
||||
ck_assert_ptr_ne(NULL, value);
|
||||
|
||||
const Eina_Value_Type *property_type = eina_value_type_get(value);
|
||||
fail_if(EINA_VALUE_TYPE_STRING != property_type && EINA_VALUE_TYPE_STRINGSHARE != property_type);
|
||||
|
||||
const char *actual_value = NULL;
|
||||
eina_value_get(value, &actual_value);
|
||||
ck_assert_str_eq(expected_value, actual_value);
|
||||
}
|
||||
|
||||
static Efl_Model_Base *
|
||||
_efl_model_nth_child_get(Efl_Model_Base *model, unsigned int n)
|
||||
{
|
||||
Eina_Accessor *accessor;
|
||||
Efl_Model_Load_Status status;
|
||||
eo_do(model, status = efl_model_children_slice_get(n, 1, &accessor));
|
||||
ck_assert_int_eq(EFL_MODEL_LOAD_STATUS_LOADED, status);
|
||||
ck_assert_ptr_ne(NULL, accessor);
|
||||
Efl_Model_Base *child = NULL;
|
||||
Eina_Bool ret = eina_accessor_data_get(accessor, 0, (void**)&child);
|
||||
eina_accessor_free(accessor);
|
||||
ck_assert(ret);
|
||||
ck_assert_ptr_ne(NULL, child);
|
||||
return child;
|
||||
}
|
||||
|
||||
static void
|
||||
_check_model_load(Efl_Model_Base *model)
|
||||
{
|
||||
eo_do(model, efl_model_load());
|
||||
_wait_until_load_status(model, EFL_MODEL_LOAD_STATUS_LOADED);
|
||||
}
|
||||
|
||||
static void
|
||||
_check_model_properties(Efl_Model_Base *model, const char *expected_properties[])
|
||||
{
|
||||
Eina_Array *properties = NULL;
|
||||
Efl_Model_Load_Status status;
|
||||
eo_do(model, status = efl_model_properties_get(&properties));
|
||||
ck_assert_int_eq(EFL_MODEL_LOAD_STATUS_LOADED, status);
|
||||
ck_assert_ptr_ne(NULL, properties);
|
||||
|
||||
unsigned int actual_properties_count = eina_array_count(properties);
|
||||
|
||||
unsigned int expected_properties_count = 0;
|
||||
const char *expected_property = NULL;
|
||||
while ((expected_property = *expected_properties++))
|
||||
{
|
||||
const char *actual_property = eina_array_data_get(properties,
|
||||
expected_properties_count);
|
||||
ck_assert_str_eq(expected_property, actual_property);
|
||||
++expected_properties_count;
|
||||
ck_assert_int_le(expected_properties_count, actual_properties_count);
|
||||
}
|
||||
|
||||
ck_assert_int_eq(expected_properties_count, actual_properties_count);
|
||||
}
|
||||
|
||||
static void
|
||||
_check_properties_count_eq(Efl_Model_Base *model, unsigned int expected_properties_count)
|
||||
{
|
||||
Eina_Array *properties = NULL;
|
||||
Efl_Model_Load_Status status;
|
||||
eo_do(model, status = efl_model_properties_get(&properties));
|
||||
ck_assert_int_ne(EFL_MODEL_LOAD_STATUS_ERROR, status);
|
||||
if (!expected_properties_count && !properties)
|
||||
return;
|
||||
|
||||
ck_assert_ptr_ne(NULL, properties);
|
||||
|
||||
unsigned int actual_properties_count = eina_array_count(properties);
|
||||
ck_assert_int_eq(expected_properties_count, actual_properties_count);
|
||||
}
|
||||
|
||||
static Esoap_Model *
|
||||
_create_esoap_model()
|
||||
{
|
||||
Efl_Model_Base *esoap = eo_add(ESOAP_MODEL_CLASS, NULL,
|
||||
esoap_model_constructor("http://127.0.0.1:9090/axis2/services/echo",
|
||||
"http://ws.apache.org/axis2/c/samples/echoString"));
|
||||
ck_assert_ptr_ne(NULL, esoap);
|
||||
return esoap;
|
||||
}
|
||||
|
||||
START_TEST(smoke)
|
||||
{
|
||||
Efl_Model_Base *esoap = _create_esoap_model();
|
||||
eo_unref(esoap);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
static void
|
||||
_check_string_property_set(Efl_Model_Base *model, const char *property, const char *v)
|
||||
{
|
||||
Eina_Value value;
|
||||
eina_value_setup(&value, EINA_VALUE_TYPE_STRING);
|
||||
eina_value_set(&value, v);
|
||||
Efl_Model_Load_Status status;
|
||||
eo_do(model, status = efl_model_property_set(property, &value));
|
||||
eina_value_flush(&value);
|
||||
ck_assert(EFL_MODEL_LOAD_STATUS_LOADED_PROPERTIES & status);
|
||||
}
|
||||
|
||||
START_TEST(load_children)
|
||||
{
|
||||
Efl_Model_Base *esoap = _create_esoap_model();
|
||||
|
||||
eo_do(esoap, efl_model_properties_load());
|
||||
_wait_until_load_status(esoap, EFL_MODEL_LOAD_STATUS_LOADED_PROPERTIES);
|
||||
|
||||
_check_string_property_set(esoap, "esoap:Envelope@xmlns:esoap", "http://www.w3.org/2003/05/esoap-envelope");
|
||||
_check_string_property_set(esoap, "esoap:Envelope@esoap:encodingStyle", "http://www.w3.org/2001/12/esoap-encoding");
|
||||
_check_string_property_set(esoap, "esoap:Envelope/esoap:Body/ns1:echoString@xmlns:ns1", "http://ws.apache.org/axis2/services/echo");
|
||||
_check_string_property_set(esoap, "esoap:Envelope/esoap:Body/ns1:echoString/ns1:text", "Hello World!");
|
||||
|
||||
// make the call loading the children
|
||||
eo_do(esoap, efl_model_children_load());
|
||||
_wait_until_load_status(esoap, EFL_MODEL_LOAD_STATUS_LOADED_CHILDREN);
|
||||
|
||||
_check_model_children_count_eq(esoap, 1);
|
||||
|
||||
Efl_Model_Base *child = _efl_model_nth_child_get(esoap, 1);
|
||||
_check_model_load(child);
|
||||
|
||||
_check_model_properties(child, (const char*[]){
|
||||
"esoapenv:Envelope@xmlns:esoapenv",
|
||||
"esoapenv:Envelope/esoapenv:Body/ns1:echoString@xmlns:ns1",
|
||||
"esoapenv:Envelope/esoapenv:Body/ns1:echoString/text",
|
||||
NULL});
|
||||
|
||||
_check_model_property_str_eq(child, "esoapenv:Envelope@xmlns:esoapenv", "http://www.w3.org/2003/05/esoap-envelope");
|
||||
_check_model_property_str_eq(child, "esoapenv:Envelope/esoapenv:Body/ns1:echoString@xmlns:ns1", "http://ws.apache.org/axis2/c/samples");
|
||||
_check_model_property_str_eq(child, "esoapenv:Envelope/esoapenv:Body/ns1:echoString/text", "Hello World!");
|
||||
|
||||
eo_unref(esoap);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
void
|
||||
esoap_model_test_esoap_model(TCase *tc)
|
||||
{
|
||||
tcase_add_checked_fixture(tc, _setup, _teardown);
|
||||
tcase_add_test(tc, smoke);
|
||||
tcase_add_test(tc, load_children);
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
#ifndef _ESOAP_MODEL_TEST_ESOAP_MODEL_H
|
||||
#define _ESOAP_MODEL_TEST_ESOAP_MODEL_H
|
||||
|
||||
#include <Esoap_Model.h>
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue