From 9b87953a3079afb59b930bbe96e0e3aefda02595 Mon Sep 17 00:00:00 2001 From: Andreas Monzner Date: Sun, 22 Jul 2007 22:24:46 +0000 Subject: [PATCH] add possibility to get all component descriptors for a event from python --- lib/service/event.cpp | 17 +++++++++++++++++ lib/service/event.h | 1 + 2 files changed, 18 insertions(+) diff --git a/lib/service/event.cpp b/lib/service/event.cpp index 07eafbc..e78ddc4 100644 --- a/lib/service/event.cpp +++ b/lib/service/event.cpp @@ -240,6 +240,23 @@ RESULT eServiceEvent::getComponentData(ePtr &dest, int tagnum) c return -1; } +PyObject *eServiceEvent::getComponentData() const +{ + ePyObject ret = PyList_New(m_component_data.size()); + int cnt=0; + for (std::list::const_iterator it(m_component_data.begin()); it != m_component_data.end(); ++it) + { + ePyObject tuple = PyTuple_New(5); + PyTuple_SET_ITEM(tuple, 0, PyInt_FromLong(it->m_componentTag)); + PyTuple_SET_ITEM(tuple, 1, PyInt_FromLong(it->m_componentType)); + PyTuple_SET_ITEM(tuple, 2, PyInt_FromLong(it->m_streamContent)); + PyTuple_SET_ITEM(tuple, 3, PyString_FromString(it->m_iso639LanguageCode.c_str())); + PyTuple_SET_ITEM(tuple, 4, PyString_FromString(it->m_text.c_str())); + PyList_SET_ITEM(ret, cnt++, tuple); + } + return ret; +} + RESULT eServiceEvent::getLinkageService(eServiceReference &service, eServiceReference &parent, int num) const { std::list::const_iterator it = diff --git a/lib/service/event.h b/lib/service/event.h index f315aca..f1a307e 100644 --- a/lib/service/event.h +++ b/lib/service/event.h @@ -59,6 +59,7 @@ public: std::string getExtendedDescription() const { return m_extended_description; } std::string getBeginTimeString() const; SWIG_VOID(RESULT) getComponentData(ePtr &SWIG_OUTPUT, int tagnum) const; + PyObject *getComponentData() const; int getNumOfLinkageServices() const { return m_linkage_services.size(); } SWIG_VOID(RESULT) getLinkageService(eServiceReference &SWIG_OUTPUT, eServiceReference &parent, int num) const; }; -- 2.7.4