- add python, missing gui
authorFelix Domke <tmbinc@elitedvb.net>
Fri, 1 Oct 2004 13:21:35 +0000 (13:21 +0000)
committerFelix Domke <tmbinc@elitedvb.net>
Fri, 1 Oct 2004 13:21:35 +0000 (13:21 +0000)
 - remove console (needs to be rewritten anyway)
 - eString -> std::string

68 files changed:
configure.ac
lib/Makefile.am
lib/base/Makefile.am
lib/base/console.cpp [deleted file]
lib/base/console.h [deleted file]
lib/base/econfig.cpp
lib/base/econfig.h
lib/base/eerror.cpp
lib/base/eerror.h
lib/base/estring.cpp
lib/base/estring.h
lib/base/smartptr.h
lib/driver/rc.cpp
lib/driver/rc.h
lib/driver/rcinput.cpp
lib/dvb/db.cpp
lib/dvb/db.h
lib/dvb/decoder.cpp
lib/dvb/pmt.cpp
lib/dvb/stT1RVV7
lib/gdi/font.cpp
lib/gdi/font.cpp-new
lib/gdi/font.h
lib/gdi/gpixmap.h
lib/gdi/grc.h
lib/gui/ebutton.cpp [new file with mode: 0644]
lib/gui/ebutton.h [new file with mode: 0644]
lib/gui/elabel.cpp [new file with mode: 0644]
lib/gui/elabel.h [new file with mode: 0644]
lib/gui/ewidget.cpp [new file with mode: 0644]
lib/gui/ewidget.h [new file with mode: 0644]
lib/gui/ewidgetdesktop.cpp [new file with mode: 0644]
lib/gui/ewidgetdesktop.h [new file with mode: 0644]
lib/gui/ewindow.cpp [new file with mode: 0644]
lib/gui/ewindow.h [new file with mode: 0644]
lib/gui/ewindowstyle.cpp [new file with mode: 0644]
lib/gui/ewindowstyle.h [new file with mode: 0644]
lib/nav/core.cpp
lib/network/Makefile.am
lib/network/http_dyn.cpp
lib/network/http_dyn.h
lib/network/http_file.cpp
lib/network/http_file.h
lib/network/httpd.cpp
lib/network/httpd.h
lib/network/serversocket.lo
lib/network/socket.cpp
lib/network/socket.h
lib/network/socket.lo
lib/network/xmlrpc.cpp
lib/network/xmlrpc.h
lib/python/Makefile.am [new file with mode: 0644]
lib/python/enigma_python.i [new file with mode: 0644]
lib/python/python.cpp [new file with mode: 0644]
lib/python/python.h [new file with mode: 0644]
lib/service/iservice.h
lib/service/service.cpp
lib/service/service.h
lib/service/servicedvb.cpp
lib/service/servicedvb.h
lib/service/servicefs.cpp
lib/service/servicefs.h
lib/service/servicemp3.cpp
lib/service/servicemp3.h
main/Makefile.am
main/enigma-playlist.cpp
main/enigma.cpp
mytest.py [new file with mode: 0644]

index 19dee31..7768a97 100644 (file)
@@ -15,14 +15,13 @@ TUXBOX_APPS_LIB_CONFIG(FREETYPE,freetype-config)
 #TUXBOX_APPS_LIB_PKGCONFIG(FRIBIDI,fribidi)
 TUXBOX_APPS_LIB_PKGCONFIG(ID3TAG,id3tag)
 TUXBOX_APPS_LIB_PKGCONFIG(MAD,mad)
-TUXBOX_APPS_LIB_PKGCONFIG(MD5SUM,tuxbox-md5sum)
 #TUXBOX_APPS_LIB_PKGCONFIG(PLUGINS,tuxbox-plugins)
 TUXBOX_APPS_LIB_PKGCONFIG(PNG,libpng)
 TUXBOX_APPS_LIB_PKGCONFIG(SIGC,sigc++-1.2)
 TUXBOX_APPS_LIB_PKGCONFIG(XMLTREE,tuxbox-xmltree)
 
-CPPFLAGS="$CPPFLAGS $FREETYPE_CFLAGS $FRIBIDI_CFLAGS $ID3TAG_CFLAGS $MAD_CFLAGS $MD5SUM_CFLAGS $PLUGINS_CFLAGS $PNG_CFLAGS $SIGC_CFLAGS $XMLTREE_CFLAGS"
-CXXFLAGS="$CXXFLAGS -fno-rtti -fno-exceptions"
+CPPFLAGS="$CPPFLAGS $FREETYPE_CFLAGS $FRIBIDI_CFLAGS $ID3TAG_CFLAGS $MAD_CFLAGS $PLUGINS_CFLAGS $PNG_CFLAGS $SIGC_CFLAGS $XMLTREE_CFLAGS"
+CXXFLAGS="$CXXFLAGS -fno-rtti -fno-exceptions -Wall"
 
 TUXBOX_APPS_GETTEXT
 
@@ -30,6 +29,7 @@ AC_OUTPUT([
 Makefile
 lib/Makefile
 lib/base/Makefile
+lib/content/Makefile
 lib/driver/Makefile
 lib/dvb/Makefile
 lib/dvb_si/Makefile
@@ -37,6 +37,7 @@ lib/gdi/Makefile
 lib/gui/Makefile
 lib/nav/Makefile
 lib/network/Makefile
+lib/python/Makefile
 lib/service/Makefile
 main/Makefile
 ])
index 2ff9992..f33133b 100644 (file)
@@ -1 +1 @@
-SUBDIRS = base  dvb dvb_si gdi network service driver nav content gui
+SUBDIRS = base  dvb dvb_si gdi network service driver nav content gui python
index 3e695a3..955d9e4 100644 (file)
@@ -4,6 +4,6 @@ INCLUDES = \
 noinst_LIBRARIES = libenigma_base.a
 
 libenigma_base_a_SOURCES = \
-       buffer.cpp console.cpp ebase.cpp econfig.cpp eerror.cpp elock.cpp \
-       estring.cpp init.cpp message.cpp nconfig.cpp nxml.cpp thread.cpp \
-       smartptr.cpp
+       buffer.cpp ebase.cpp econfig.cpp eerror.cpp elock.cpp \
+       init.cpp message.cpp thread.cpp \
+       smartptr.cpp estring.cpp
diff --git a/lib/base/console.cpp b/lib/base/console.cpp
deleted file mode 100644 (file)
index 2609582..0000000
+++ /dev/null
@@ -1,248 +0,0 @@
-/*
- * console.cpp
- *
- * Copyright (C) 2002 Felix Domke <tmbinc@tuxbox.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * $Id: console.cpp,v 1.1 2003-10-17 15:35:47 tmbinc Exp $
- */
-
-#include <lib/base/console.h>
-
-#include <lib/base/estring.h>
-#include <sys/vfs.h> // for statfs
-#include <unistd.h>
-#include <signal.h>
-#include <errno.h>
-
-int bidirpipe(int pfd[], char *cmd , char *argv[])
-{
-       int pfdin[2];  /* from child to parent */
-       int pfdout[2]; /* from parent to child */
-       int pfderr[2]; /* stderr from child to parent */
-       int pid;       /* child's pid */
-
-       if ( pipe(pfdin) == -1 || pipe(pfdout) == -1 || pipe(pfderr) == -1)
-               return(-1);
-
-       if ( ( pid = fork() ) == -1 )
-               return(-1);
-       else if (pid == 0) /* child process */
-       {
-               if ( close(0) == -1 || close(1) == -1 || close(2) == -1 )
-                       _exit(0);
-
-               if (dup(pfdout[0]) != 0 || dup(pfdin[1]) != 1 || dup(pfderr[1]) != 2 )
-                       _exit(0);
-
-               if (close(pfdout[0]) == -1 || close(pfdout[1]) == -1 ||
-                               close(pfdin[0]) == -1 || close(pfdin[1]) == -1 ||
-                               close(pfderr[0]) == -1 || close(pfderr[1]) == -1 )
-                       _exit(0);
-
-               execv(cmd,argv);
-               _exit(0);
-       }
-       if (close(pfdout[0]) == -1 || close(pfdin[1]) == -1 || close(pfderr[1]) == -1)
-                       return(-1);
-
-       pfd[0] = pfdin[0];
-       pfd[1] = pfdout[1];
-       pfd[2] = pfderr[0];
-
-       return(pid);
-}
-
-eConsoleAppContainer::eConsoleAppContainer( const eString &cmd )
-:pid(-1), killstate(0), outbuf(0)
-{
-//     eDebug("cmd = %s", cmd.c_str() );
-       memset(fd, 0, sizeof(fd) );
-       int cnt=2; // path to app + terminated 0
-       eString str(cmd?cmd:"");
-
-       while( str.length() && str[0] == ' ' )  // kill spaces at beginning
-               str = str.mid(1);
-
-       while( str.length() && str[str.length()-1] == ' ' )  // kill spaces at the end
-               str = str.left( str.length() - 1 );
-
-       if (!str.length())
-               return;
-
-       unsigned int idx=0;
-       eString path = str.left( (idx = str.find(' ')) != eString::npos ? idx : str.length() );
-//     eDebug("path = %s", path.c_str() );
-
-       eString cmds = str.mid( path.length()+1 );
-//     eDebug("cmds = %s", cmds.c_str() );
-
-       idx = 0;
-       while ( (idx = cmds.find(' ',idx) ) != eString::npos )  // count args
-       {
-               cnt++;
-               idx++;
-       }
-
-//     eDebug("idx = %d, %d counted spaces", idx, cnt-2);
-
-       if ( cmds.length() )
-       {
-               cnt++;
-//             eDebug("increase cnt");
-       }
-
-//     eDebug("%d args", cnt-2);
-       char **argv = new char*[cnt];  // min two args... path and terminating 0
-       argv[0] = new char[ path.length() ];
-       strcpy( argv[0], path.c_str() );
-       argv[cnt-1] = 0;               // set terminating null
-
-       if ( cnt > 2 )  // more then default args?
-       {
-               cnt=1;  // do not overwrite path in argv[0]
-
-               while ( (idx = cmds.find(' ')) != eString::npos )  // parse all args..
-               {
-                       argv[cnt] = new char[ idx ];
-//                     eDebug("idx=%d, arg = %s", idx, cmds.left(idx).c_str() );
-                       strcpy( argv[cnt++], cmds.left( idx ).c_str() );
-                       cmds = cmds.mid(idx+1);
-//                     eDebug("str = %s", cmds.c_str() );
-               }
-               // store the last arg
-               argv[cnt] = new char[ cmds.length() ];
-               strcpy( argv[cnt], cmds.c_str() );
-       }
-
-  // get one read ,one write and the err pipe to the prog..
-  
-       if ( (pid = bidirpipe(fd, argv[0], argv)) == -1 )
-       {
-               while ( cnt-- > 0 )
-                       delete [] argv[cnt];
-               delete [] argv;
-               return;
-       }
-
-       while ( cnt-- > 0 )  // release heap memory
-               delete [] argv[cnt];
-       delete [] argv;
-
-       eDebug("pipe in = %d, out = %d, err = %d", fd[0], fd[1], fd[2]);
-
-       in = new eSocketNotifier(eApp, fd[0], 19 );  // 19 = POLLIN, POLLPRI, POLLHUP
-       out = new eSocketNotifier(eApp, fd[1], eSocketNotifier::Write);  // POLLOUT
-       err = new eSocketNotifier(eApp, fd[2], 19 );  // 19 = POLLIN, POLLPRI, POLLHUP
-       CONNECT(in->activated, eConsoleAppContainer::readyRead);
-       CONNECT(out->activated, eConsoleAppContainer::readyWrite);
-       CONNECT(err->activated, eConsoleAppContainer::readyErrRead);
-       signal(SIGCHLD, SIG_IGN);   // no zombie when child killed
-}
-
-eConsoleAppContainer::~eConsoleAppContainer()
-{
-       if ( running() )
-       {
-               killstate=-1;
-               kill();
-       }
-       if ( outbuf )
-               delete [] outbuf;
-}
-
-void eConsoleAppContainer::kill()
-{
-       killstate=-1;
-       system( eString().sprintf("kill %d", pid).c_str() );
-       eDebug("user kill console App");
-}
-
-void eConsoleAppContainer::closePipes()
-{
-       in->stop();
-       out->stop();
-       err->stop();
-       ::close(fd[0]);
-       fd[0]=0;
-       ::close(fd[1]);
-       fd[1]=0;
-       ::close(fd[2]);
-       fd[2]=0;
-       eDebug("pipes closed");
-}
-
-void eConsoleAppContainer::readyRead(int what)
-{
-       if (what & POLLPRI|POLLIN)
-       {
-               eDebug("what = %d");
-               char buf[2048];
-               int readed = read(fd[0], buf, 2048);
-               eDebug("%d bytes read", readed);
-               if ( readed != -1 && readed )
-                       /*emit*/ dataAvail( eString( buf ) );
-               else if (readed == -1)
-                       eDebug("readerror %d", errno);
-       }
-       if (what & eSocketNotifier::Hungup)
-       {
-               eDebug("child has terminated");
-               closePipes();
-               /*emit*/ appClosed(killstate);
-       }
-}
-
-void eConsoleAppContainer::readyErrRead(int what)
-{
-       if (what & POLLPRI|POLLIN)
-       {
-               eDebug("what = %d");
-               char buf[2048];
-               int readed = read(fd[2], buf, 2048);
-               eDebug("%d bytes read", readed);
-               if ( readed != -1 && readed )
-                       /*emit*/ dataAvail( eString( buf ) );
-               else if (readed == -1)
-                       eDebug("readerror %d", errno);
-       }
-}
-
-void eConsoleAppContainer::write( const eString & str )
-{
-       outbuf = new char[ str.length()];
-       strcpy( outbuf, str.c_str() );
-}
-
-void eConsoleAppContainer::readyWrite(int what)
-{
-       if (what == 4 && outbuf)
-       {
-               if ( ::write( fd[1], outbuf, strlen(outbuf) ) != (int) strlen(outbuf) )
-               {
-                       /* emit */ dataSent(-1);
-                       eDebug("writeError");
-               }
-               else
-               {
-                       /* emit */ dataSent(0);
-                       eDebug("write ok");
-               }
-
-               delete outbuf;
-               outbuf=0;
-       }
-}
diff --git a/lib/base/console.h b/lib/base/console.h
deleted file mode 100644 (file)
index e69de29..0000000
index 3d51255..e69de29 100644 (file)
@@ -1,43 +0,0 @@
-#include <lib/base/eerror.h>
-#include <lib/base/econfig.h>
-#include <lib/base/init.h>
-#include <lib/base/init_num.h>
-#include <sys/stat.h>
-
-eConfig *eConfig::instance;
-
-eConfig::eConfig()
-{
-       if (!instance)
-               instance=this;
-
-       setName(CONFIGDIR "/enigma/registry");
-       int e=open();
-       if (e == NC_ERR_CORRUPT)
-       {
-               eWarning("CORRUTPED REGISTRY!");
-               ::remove(CONFIGDIR "/enigma/registry");
-       }
-       if (e)
-       {
-               if (createNew())
-               {
-                       mkdir(CONFIGDIR "/enigma", 0777);
-                       if (createNew())
-                               eFatal("error while opening/creating registry - create " CONFIGDIR "/enigma");
-               }
-               if (open())
-                       eFatal("still can't open configfile");
-       }
-       locked=1;
-       ppin=0;
-       getKey("/elitedvb/pins/parentallock", ppin );
-}
-
-eConfig::~eConfig()
-{
-       if (instance==this)
-               instance=0;
-}
-
-eAutoInitP0<eConfig> init_eRCConfig(eAutoInitNumbers::configuration, "Configuration");
index d9f3bec..e69de29 100644 (file)
@@ -1,27 +0,0 @@
-#ifndef __econfig_h
-#define __econfig_h
-
-#include <lib/base/nconfig.h>
-
-class eConfig: public NConfig
-{
-       static eConfig *instance;
-       int ppin;
-public:
-       int locked;
-       static eConfig *getInstance() { return instance; }
-       void setParentalPin( int pin )
-       {
-                ppin = pin;
-                setKey("/elitedvb/pins/parentallock", ppin );
-       }
-       int getParentalPin() { return ppin; }
-       bool pLockActive()
-       {
-               return ppin && locked;
-       }
-       eConfig();
-       ~eConfig();
-};
-
-#endif
index 68541d4..11bb994 100644 (file)
@@ -4,13 +4,13 @@
 #include <stdlib.h>
 #include <unistd.h>
 
-#include <lib/base/estring.h>
+#include <string>
 
 // #include <lib/gui/emessage.h>
 
 int infatal=0;
 
-Signal2<void, int, const eString&> logOutput;
+Signal2<void, int, const std::string&> logOutput;
 int logOutputConsole=1;
 
 void eFatal(const char* fmt, ...)
@@ -43,7 +43,7 @@ void eDebug(const char* fmt, ...)
        va_start(ap, fmt);
        vsnprintf(buf, 1024, fmt, ap);
        va_end(ap);
-       logOutput(lvlDebug, eString(buf) + "\n");
+       logOutput(lvlDebug, std::string(buf) + "\n");
        if (logOutputConsole)
                fprintf(stderr, "%s\n", buf);
 }
@@ -67,7 +67,7 @@ void eWarning(const char* fmt, ...)
        va_start(ap, fmt);
        vsnprintf(buf, 1024, fmt, ap);
        va_end(ap);
-       logOutput(lvlWarning, eString(buf) + "\n");
+       logOutput(lvlWarning, std::string(buf) + "\n");
        if (logOutputConsole)
                fprintf(stderr, "%s\n", buf);
 }
index bf91395..476029c 100644 (file)
@@ -9,12 +9,12 @@
 
 void eFatal(const char* fmt, ...);
 
-class eString;
-
 enum { lvlDebug=1, lvlWarning=2, lvlFatal=4 };
 
-extern Signal2<void, int, const eString&> logOutput;
+#ifndef SWIG
+extern Signal2<void, int, const std::string&> logOutput;
 extern int logOutputConsole;
+#endif
 
 #ifdef ASSERT
 #undef ASSERT
@@ -24,7 +24,9 @@ extern int logOutputConsole;
     void eDebug(const char* fmt, ...);
     void eDebugNoNewLine(const char* fmt, ...);
     void eWarning(const char* fmt, ...);
+#ifndef SWIG
     #define ASSERT(x) { if (!(x)) eFatal("%s:%d ASSERTION %s FAILED!", __FILE__, __LINE__, #x); }
+#endif
 #else
     inline void eDebug(const char* fmt, ...)
     {
index bf30d5f..f0107b6 100644 (file)
@@ -1,27 +1,12 @@
-#include <lib/base/estring.h>
+#include <string>
 #include <ctype.h>
 #include <limits.h>
 #include <lib/base/elock.h>
+#include <lib/base/eerror.h>
 
 static pthread_mutex_t lock=PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP;
 
-///////////////////////////////////////// eString sprintf /////////////////////////////////////////////////
-eString& eString::sprintf(char *fmt, ...)
-{
-       singleLock s(lock);
-// Implements the normal sprintf method, to use format strings with eString
-// The max length of the result string is 1024 char.
-       static char buf[1024];
-       va_list ap;
-       va_start(ap, fmt);
-       std::vsnprintf(buf, 1024, fmt, ap);
-       va_end(ap);
-       assign(buf);
-       return *this;
-}
-
-///////////////////////////////////////// eString setNum(uint, uint) ///////////////////////////////////////
-eString& eString::setNum(int val, int sys)
+std::string getNum(int val, int sys)
 {
 //     Returns a string that contain the value val as string
 //     if sys == 16 than hexadezimal if sys == 10 than decimal
@@ -32,91 +17,9 @@ eString& eString::setNum(int val, int sys)
        else if (sys == 16)
                std::snprintf(buf, 12, "%X", val);              
        
-       assign(buf);
-       return *this;
-}
-
-///////////////////////////////////////// eString replaceChars(char, char) /////////////////////////////
-eString& eString::removeChars(char fchar)
-{
-//     Remove all chars that equal to fchar, and returns a reference to itself
-       unsigned int index=0;
-
-       while ( ( index = find(fchar, index) ) != npos )
-               erase(index, 1);
-
-       return *this;
-}
-
-/////////////////////////////////////// eString upper() ////////////////////////////////////////////////
-eString& eString::upper()
-{
-//     convert all lowercase characters to uppercase, and returns a reference to itself
-       for (iterator it = begin(); it != end(); it++)
-               switch(*it)
-               {
-                       case 'a' ... 'z' :
-                               *it -= 32;
-                       break;
-
-                       case 'ä' :
-                               *it = 'Ä';
-                       break;
-                       
-                       case 'ü' :
-                               *it = 'Ãœ';
-                       break;
-                       
-                       case 'ö' :
-                               *it = 'Ö';
-                       break;
-               }
-
-       return *this;
-}
-
-eString& eString::strReplace(const char* fstr, const eString& rstr)
-{
-//     replace all occurrence of fstr with rstr and, and returns a reference to itself
-       unsigned int index=0;
-       unsigned int fstrlen = strlen(fstr);
-       int rstrlen=rstr.size();
-
-       while ( ( index = find(fstr, index) ) != npos )
-       {
-               replace(index, fstrlen, rstr);
-               index+=rstrlen;
-       }
-       
-       return *this;
-}
-
-int strnicmp(const char *s1, const char *s2, int len)
-{
-//     makes a case insensitive string compare with len Chars
-       while ( *s1 && *s2 && len-- )
-               if ( tolower(*s1) != tolower(*s2) )
-                       return tolower(*s1) < tolower(*s2) ? -1 : 1;
-               else
-                       s1++, s2++;
-
-       return 0;
-}
-
-/////////////////////////////////////// eString icompare(const eString&) ////////////////////////////////////////////////
-int eString::icompare(const eString& s)
-{
-//     makes a case insensitive string compare
-       std::string::const_iterator p = begin(),
-                                                                                                                       p2 = s.begin();
-
-       while ( p != end() && p2 != s.end() )
-               if ( tolower(*p) != tolower(*p2) )
-                       return tolower(*p) < tolower(*p2) ? -1 : 1;
-               else
-                       p++, p2++;
-
-       return length() == s.length() ? 0 : length() < s.length() ? -1 : 1;
+       std::string res;
+       res.assign(buf);
+       return res;
 }
 
                // 8859-x to dvb coding tables. taken from www.unicode.org/Public/MAPPINGS/ISO8859/
@@ -278,7 +181,7 @@ static inline unsigned int recode(unsigned char d, int cp)
        }
 }
 
-eString convertDVBUTF8(unsigned char *data, int len, int table)
+std::string convertDVBUTF8(unsigned char *data, int len, int table)
 {
        int i;
        if (!len)
@@ -349,12 +252,12 @@ eString convertDVBUTF8(unsigned char *data, int len, int table)
        }
        if ( t != bytesneeded)
                eFatal("t: %d, bytesneeded: %d", t, bytesneeded);
-       return eString().assign((char*)res, t);
+       return std::string().assign((char*)res, t);
 }
 
-eString convertUTF8DVB(const eString &string)
+std::string convertUTF8DVB(const std::string &string)
 {
-       eString ss=eString();
+       std::string ss=std::string();
        
        int len=string.length();
        for(int i=0;i<len;i++){
@@ -383,7 +286,7 @@ eString convertUTF8DVB(const eString &string)
        return ss;
 }
 
-eString convertLatin1UTF8(const eString &string)
+std::string convertLatin1UTF8(const std::string &string)
 {
        unsigned int bytesneeded=0, t=0, i;
        
@@ -432,10 +335,10 @@ eString convertLatin1UTF8(const eString &string)
        }
        if ( t != bytesneeded)
                eFatal("t: %d, bytesneeded: %d", t, bytesneeded);
-       return eString().assign((char*)res, t);
+       return std::string().assign((char*)res, t);
 }
 
-int isUTF8(const eString &string)
+int isUTF8(const std::string &string)
 {
        unsigned int len=string.size();
        
index 36f6636..9cc3180 100644 (file)
 
 int strnicmp(const char*, const char*, int);
 
-class eString : public std::string
-{
-public:
-// constructors
-       inline eString()        {}      
-       inline eString(const char* p);
-       inline eString(const char* p, int cnt);
-       inline eString(const std::string &s);
-// methods
-       inline eString left(unsigned int len) const;
-       inline eString mid(unsigned int index, unsigned int len=(unsigned)-1) const;
-       inline eString right(unsigned int len) const;
-       bool isNull() const;
-// operators
-       inline operator bool() const;
-       inline bool operator!() const;
-// methods with implementation in estring.cpp
-       eString& sprintf(char *fmt, ...);
-       eString& setNum(int val, int sys=10);
-       eString& removeChars(const char fchar);
-       eString& strReplace(const char* fstr, const eString& rstr);
-       eString& upper();
-       int icompare(const eString& s);
-};
-
-eString convertDVBUTF8(unsigned char *data, int len, int table=5);
-eString convertUTF8DVB(const eString &string);  // with default ISO8859-5
-eString convertLatin1UTF8(const eString &string);
-int isUTF8(const eString &string);
-
-/////////////////////////////////////////////// Copy Constructors ////////////////////////////////////////////////
-inline eString::eString(const std::string &s)
-       :std::string(s)
-{
-}
-
-inline eString::eString(const char* p)
-       :std::string(p?p:"")     // when the char* p is null, than use ""... otherwise crash...
-{
-}
-
-inline eString::eString(const char* p, int cnt)
-       :std::string(p, cnt)
-{
-}
-
-///////////////////////////////////////// eString operator bool /////////////////////////////////////////////////
-inline eString::operator bool() const
-{
-// Returns a bool that contains true if the string longer than 0 Character otherwise false;
-       return !empty();
-}
-
-///////////////////////////////////////// eString operator! ////////////////////////////////////////////////////
-inline bool eString::operator!() const
-{
-// Returns a bool that contains true if the string ist empty otherwise false;
-       return empty();
-}
-
-///////////////////////////////////////// eString left //////////////////////////////////////////////////////////
-inline eString eString::left(unsigned int len) const
-{
-//     Returns a substring that contains the len leftmost characters of the string.
-//     The whole string is returned if len exceeds the length of the string.
-       return len >= length() ? *this : substr(0, len);
-}
-
-//////////////////////////////////////// eString mid ////////////////////////////////////////////////////////////
-inline eString eString::mid(unsigned int index, unsigned int len) const
-{
-//     Returns a substring that contains the len characters of this string, starting at position index.
-//     Returns a null string if the string is empty or index is out of range. Returns the whole string from index if index+len exceeds the length of the string.
-       register unsigned int strlen = length();
-
-       if (index >= strlen)
-               return eString();
-
-       if (len == (unsigned)-1)
-               return substr(index);
-
-       if (strlen < index + len)
-               len = strlen-index;
-
-       return substr(index, len);
-}
-
-//////////////////////////////////////// eString right ////////////////////////////////////////////////////////////
-inline eString eString::right(unsigned int len) const
-{
-//     Returns a substring that contains the len rightmost characters of the string.
-//     The whole string is returned if len exceeds the length of the string.
-       register unsigned int strlen = length();
-       return len >= strlen ? *this : substr(strlen-len, len);
-}
-
-inline bool eString::isNull() const
-{
-//     Returns a bool, that contains true, when the internal char* is null (only when a string ist empty constructed)
-       return !c_str();
-}
+std::string getNum(int num, int base=10);
+std::string convertDVBUTF8(unsigned char *data, int len, int table=5);
+std::string convertUTF8DVB(const std::string &string);  // with default ISO8859-5
+std::string convertLatin1UTF8(const std::string &string);
+int isUTF8(const std::string &string);
 
 #endif // __E_STRING__
index aafecf0..906bba6 100644 (file)
@@ -7,22 +7,6 @@
 template<class T>
 class ePtr
 {
-               /* read doc/iObject about the ePtrHelper */
-       template<class T1>
-       class ePtrHelper
-       {
-               T1 *m_obj;
-       public:
-               inline ePtrHelper(T1 *obj): m_obj(obj)
-               {
-                       m_obj->AddRef();
-               }
-               inline ~ePtrHelper()
-               {
-                       m_obj->Release();
-               }
-               inline T1* operator->() { return m_obj; }
-       };
 protected:
        T *ptr;
 public:
@@ -69,15 +53,62 @@ public:
        
        T* grabRef() { if (!ptr) return 0; ptr->AddRef(); return ptr; }
        T* &ptrref() { assert(!ptr); return ptr; }
+       T* operator->() const { assert(ptr); return ptr; }
+       operator T*() const { return this->ptr; }
+};
+
+
+
+#ifndef SWIG
+template<class T>
+class eMutablePtr: public ePtr<T>
+{
+               /* read doc/iObject about the ePtrHelper */
+       template<class T1>
+       class ePtrHelper
+       {
+               T1 *m_obj;
+       public:
+               inline ePtrHelper(T1 *obj): m_obj(obj)
+               {
+                       m_obj->AddRef();
+               }
+               inline ~ePtrHelper()
+               {
+                       m_obj->Release();
+               }
+               inline T1* operator->() { return m_obj; }
+       };
+protected:
+       T *ptr;
+public:
+       eMutablePtr(): ePtr<T>(0)
+       {
+       }
+       
+       eMutablePtr(T *c): ePtr<T>(c)
+       {
+       }
+
+       eMutablePtr(const eMutablePtr &c): ePtr<T>(c)
+       {
+       }
+       
+       eMutablePtr &operator=(T *c)
+       {
+               ePtr<T>::operator=(c);
+               return *this;
+       }
+       
+       
        ePtrHelper<T> operator->() { assert(ptr); return ePtrHelper<T>(ptr); }
 
                        /* for const objects, we don't need the helper, as they can't */
                        /* be changed outside the program flow. at least this is */
                        /* what the compiler assumes, so in case you're using const */
-                       /* ePtrs note that they have to be const. */
+                       /* eMutablePtrs note that they have to be const. */
        const T* operator->() const { assert(ptr); return ptr; }
-       operator T*() const { return this->ptr; }
 };
-
+#endif
 
 #endif
index 790c5f6..3920651 100644 (file)
@@ -40,7 +40,7 @@ int eRCDevice::getKeyCompatibleCode(const eRCKey &) const
        return -1;
 }
 
-eRCDevice::eRCDevice(eString id, eRCDriver *driver): driver(driver), id(id)
+eRCDevice::eRCDevice(std::string id, eRCDriver *driver): driver(driver), id(id)
 {
        input=driver->getInput();
        driver->addCodeListener(this);
@@ -127,7 +127,7 @@ eRCInputEventDriver::eRCInputEventDriver(const char *filename): eRCDriver(eRCInp
        }
 }
 
-eString eRCInputEventDriver::getDeviceName()
+std::string eRCInputEventDriver::getDeviceName()
 {
        char name[128]="";
        if (handle >= 0)
@@ -214,30 +214,30 @@ void eRCInput::setFile(int newh)
        handle=newh;
 }
 
-void eRCInput::addDevice(const eString &id, eRCDevice *dev)
+void eRCInput::addDevice(const std::string &id, eRCDevice *dev)
 {
-       devices.insert(std::pair<eString,eRCDevice*>(id, dev));
+       devices.insert(std::pair<std::string,eRCDevice*>(id, dev));
 }
 
-void eRCInput::removeDevice(const eString &id)
+void eRCInput::removeDevice(const std::string &id)
 {
        devices.erase(id);
 }
 
-eRCDevice *eRCInput::getDevice(const eString &id)
+eRCDevice *eRCInput::getDevice(const std::string &id)
 {
-       std::map<eString,eRCDevice*>::iterator i=devices.find(id);
+       std::map<std::string,eRCDevice*>::iterator i=devices.find(id);
        if (i == devices.end())
        {
                eDebug("failed, possible choices are:");
-               for (std::map<eString,eRCDevice*>::iterator i=devices.begin(); i != devices.end(); ++i) 
+               for (std::map<std::string,eRCDevice*>::iterator i=devices.begin(); i != devices.end(); ++i)     
                        eDebug("%s", i->first.c_str());
                return 0;
        }
        return i->second;
 }
 
-std::map<eString,eRCDevice*,eRCInput::lstr> &eRCInput::getDevices()
+std::map<std::string,eRCDevice*,eRCInput::lstr> &eRCInput::getDevices()
 {
        return devices;
 }
index 557be5e..8d932f8 100644 (file)
@@ -6,7 +6,7 @@
 
 #include <lib/base/ebase.h>
 #include <libsig_comp.h>
-#include <lib/base/estring.h>
+#include <string>
 
 class eRCInput;
 class eRCDriver;
@@ -22,7 +22,7 @@ class eRCDevice: public Object
 protected:
        eRCInput *input;
        eRCDriver *driver;
-       eString id;
+       std::string id;
 public:
        /**
         * \brief Constructs a new remote control.
@@ -30,7 +30,7 @@ public:
         * \param id The identifier of the RC, for use in settings.
         * \param input The \ref eRCDriver where this remote gets its codes from.
         */
-       eRCDevice(eString id, eRCDriver *input);
+       eRCDevice(std::string id, eRCDriver *input);
        ~eRCDevice();
        /**
         * \brief Handles a device specific code.
@@ -45,7 +45,7 @@ public:
         * \result The description.
         */
        virtual const char *getDescription() const=0;
-       const eString getIdentifier() const { return id; }
+       const std::string getIdentifier() const { return id; }
        /**
         * \brief Get a description for a specific key.
         * \param key The key to get the description for.
@@ -116,7 +116,7 @@ protected:
        eSocketNotifier *sn;
        void keyPressed(int);
 public:
-       eString getDeviceName();
+       std::string getDeviceName();
        eRCInputEventDriver(const char *filename);
        ~eRCInputEventDriver();
 };
@@ -179,13 +179,13 @@ class eRCInput: public Object
 public:
        struct lstr
        {
-               bool operator()(const eString &a, const eString &b) const
+               bool operator()(const std::string &a, const std::string &b) const
                {
                        return a<b;
                }
        };
 protected:
-       std::map<eString,eRCDevice*,lstr> devices;
+       std::map<std::string,eRCDevice*,lstr> devices;
 public:
        Signal1<void, const eRCKey&> keyEvent;
        enum
@@ -213,10 +213,10 @@ public:
                /*emit*/ keyEvent(key);
        }
        
-       void addDevice(const eString &id, eRCDevice *dev);
-       void removeDevice(const eString &id);
-       eRCDevice *getDevice(const eString &id);
-       std::map<eString,eRCDevice*,lstr> &getDevices();
+       void addDevice(const std::string &id, eRCDevice *dev);
+       void removeDevice(const std::string &id);
+       eRCDevice *getDevice(const std::string &id);
+       std::map<std::string,eRCDevice*,lstr> &getDevices();
        
        static eRCInput *getInstance() { return instance; }
        
index 041330a..94ce3eb 100644 (file)
@@ -1,5 +1,7 @@
 #include <lib/driver/rcinput.h>
 
+#include <lib/base/eerror.h>
+
 #include <sys/ioctl.h>
 #include <linux/input.h>
 #include <sys/stat.h>
index 5426fa4..1a2cd7d 100644 (file)
@@ -126,7 +126,7 @@ eDVBDB::eDVBDB()
                if (strlen(line))
                        line[strlen(line)-1]=0;
 
-               eString str=line;
+               std::string str=line;
 
                if (str[1]!=':')        // old ... (only service_provider)
                {
@@ -136,15 +136,15 @@ eDVBDB::eDVBDB()
                        {
                                unsigned int c=str.find(',');
                                char p=str[0];
-                               eString v;
-                               if (c == eString::npos)
+                               std::string v;
+                               if (c == std::string::npos)
                                {
-                                       v=str.mid(2);
+                                       v=str.substr(2);
                                        str="";
                                } else
                                {
-                                       v=str.mid(2, c-2);
-                                       str=str.mid(c+1);
+                                       v=str.substr(2, c-2);
+                                       str=str.substr(c+1);
                                }
 //                             eDebug("%c ... %s", p, v.c_str());
                                if (p == 'p')
index fe4833c..5a67870 100644 (file)
@@ -9,8 +9,8 @@ class eDVBService: public iObject
        DECLARE_REF;
 public:
        eDVBService();
-       eString m_service_name;
-       eString m_provider_name;
+       std::string m_service_name;
+       std::string m_provider_name;
        
        int m_flags;
        std::set<int> m_ca;
index 0b3619a..da52904 100644 (file)
@@ -1,3 +1,4 @@
+#include <lib/base/eerror.h>
 #include <lib/dvb/decoder.h>
 #include <linux/dvb/audio.h>
 #include <linux/dvb/video.h>
index 4ab551f..292012e 100644 (file)
@@ -1,3 +1,4 @@
+#include <lib/base/eerror.h>
 #include <lib/dvb/pmt.h>
 #include <lib/dvb/specs.h>
 #include <lib/dvb/dvb.h>
index a9d6d3d..e69de29 100644 (file)
Binary files a/lib/dvb/stT1RVV7 and b/lib/dvb/stT1RVV7 differ
index a8f0b12..ee22857 100644 (file)
@@ -101,7 +101,7 @@ FT_Error fontRenderClass::FTC_Face_Requester(FTC_FaceID     face_id, FT_Face* aface)
        return 0;
 }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
 
-FTC_FaceID fontRenderClass::getFaceID(const eString &face)
+FTC_FaceID fontRenderClass::getFaceID(const std::string &face)
 {
        for (fontListEntry *f=font; f; f=f->next)
        {
@@ -117,7 +117,7 @@ FT_Error fontRenderClass::getGlyphBitmap(FTC_Image_Desc *font, FT_ULong glyph_in
        return res;
 }
 
-eString fontRenderClass::AddFont(const eString &filename, const eString &name, int scale)
+std::string fontRenderClass::AddFont(const std::string &filename, const std::string &name, int scale)
 {
        eDebugNoNewLine("[FONT] adding font %s...", filename.c_str());
        fflush(stdout);
@@ -225,7 +225,7 @@ fontRenderClass::~fontRenderClass()
 //     FT_Done_FreeType(library);
 }
 
-int fontRenderClass::getFont(ePtr<Font> &font, const eString &face, int size, int tabwidth)
+int fontRenderClass::getFont(ePtr<Font> &font, const std::string &face, int size, int tabwidth)
 {
        FTC_FaceID id=getFaceID(face);
        if (!id)
@@ -400,7 +400,7 @@ void eTextPara::setFont(const gFont *font)
        setFont(fnt, replacement);
 }
 
-eString eTextPara::replacement_facename;
+std::string eTextPara::replacement_facename;
 
 void eTextPara::setFont(Font *fnt, Font *replacement)
 {
@@ -437,7 +437,7 @@ void eTextPara::setFont(Font *fnt, Font *replacement)
 void
 shape (std::vector<unsigned long> &string, const std::vector<unsigned long> &text);
 
-int eTextPara::renderString(const eString &string, int rflags)
+int eTextPara::renderString(const std::string &string, int rflags)
 {
        singleLock s(ftlock);
        
@@ -463,7 +463,7 @@ int eTextPara::renderString(const eString &string, int rflags)
        std::vector<unsigned long> uc_string, uc_visual;
        uc_string.reserve(string.length());
        
-       eString::const_iterator p(string.begin());
+       std::string::const_iterator p(string.begin());
 
        while(p != string.end())
        {
index e9aa543..143374b 100644 (file)
@@ -434,7 +434,7 @@ void eTextPara::setFont(Font *fnt)
        use_kerning=FT_HAS_KERNING(current_face);
 }
 
-int eTextPara::renderString(const eString &string, int rflags)
+int eTextPara::renderString(const std::string &string, int rflags)
 {
        eLocker lock(ftlock);
        
index 7b01a42..a17fee7 100644 (file)
@@ -13,7 +13,7 @@
 #include <lib/gdi/esize.h>
 #include <lib/gdi/epoint.h>
 #include <lib/gdi/erect.h>
-#include <lib/base/estring.h>
+#include <string>
 #include <lib/base/object.h> 
 
 class FontRenderClass;
@@ -29,7 +29,7 @@ class fontRenderClass
        fbClass *fb;
        struct fontListEntry
        {
-               eString filename, face;
+               std::string filename, face;
                int scale; // 100 is 1:1
                fontListEntry *next;
                ~fontListEntry();
@@ -40,16 +40,16 @@ class fontRenderClass
        FTC_Image_Cache imageCache;                                     /* the glyph image cache                                         */
        FTC_SBit_Cache   sbitsCache;                            /* the glyph small bitmaps cache         */
 
-       FTC_FaceID getFaceID(const eString &face);
+       FTC_FaceID getFaceID(const std::string &face);
        FT_Error getGlyphBitmap(FTC_Image_Desc *font, FT_ULong glyph_index, FTC_SBit *sbit);
        static fontRenderClass *instance;
 public:
        float getLineHeight(const gFont& font);
-       eString AddFont(const eString &filename, const eString &name, int scale);
+       std::string AddFont(const std::string &filename, const std::string &name, int scale);
        static fontRenderClass *getInstance();
        FT_Error FTC_Face_Requester(FTC_FaceID  face_id,
                                                                                                                        FT_Face*                aface);
-       int getFont(ePtr<Font> &font, const eString &face, int size, int tabwidth=-1);
+       int getFont(ePtr<Font> &font, const std::string &face, int size, int tabwidth=-1);
        fontRenderClass();
        ~fontRenderClass();
 };
@@ -85,7 +85,7 @@ private:
        FT_Face current_face, replacement_face;
        int use_kerning;
        int previous;
-       static eString replacement_facename;
+       static std::string replacement_facename;
 
        eRect area;
        ePoint cursor;
@@ -107,10 +107,10 @@ public:
        }
        virtual ~eTextPara();
        
-       static void setReplacementFont(eString font) { replacement_facename=font; }
+       static void setReplacementFont(std::string font) { replacement_facename=font; }
 
        void setFont(const gFont *font);
-       int renderString(const eString &string, int flags=0);
+       int renderString(const std::string &string, int flags=0);
 
        void clear();
 
index f091233..9dd170a 100644 (file)
@@ -2,7 +2,7 @@
 #define __gpixmap_h
 
 #include <pthread.h>
-#include <lib/base/estring.h>
+#include <string>
 #include <lib/base/object.h>
 #include <lib/base/elock.h>
 #include <lib/gdi/erect.h>
@@ -92,7 +92,7 @@ class gFont: public iObject
 DECLARE_REF;
 public:
 
-       eString family;
+       std::string family;
        int pointSize;
        
        /**
@@ -100,7 +100,7 @@ public:
         * \param family The name of the font, for example "NimbusSansL-Regular Sans L Regular".
         * \param pointSize the size of the font in PIXELS.
         */
-       gFont(const eString &family, int pointSize):
+       gFont(const std::string &family, int pointSize):
                        family(family), pointSize(pointSize)
        {
        }
index 0f66ef0..a02068a 100644 (file)
@@ -11,7 +11,7 @@
 #include <stack>
 #include <list>
 
-#include <lib/base/estring.h>
+#include <string>
 #include <lib/base/ringbuffer.h>
 #include <lib/base/elock.h>
 #include <lib/gdi/erect.h>
@@ -58,7 +58,7 @@ struct gOpcode
                struct prenderText
                {
                        eRect area;
-                       eString text;
+                       std::string text;
                        int flags;
                } *renderText;
 
diff --git a/lib/gui/ebutton.cpp b/lib/gui/ebutton.cpp
new file mode 100644 (file)
index 0000000..5c136ab
--- /dev/null
@@ -0,0 +1,20 @@
+#include <lib/gui/ebutton.h>
+
+eButton::eButton(eWidget *parent): eLabel(parent)
+{
+}
+
+void eButton::push()
+{
+       selected();
+}
+
+int eButton::event(int event, void *data, void *data2)
+{
+       switch (event)
+       {
+       default:
+               break;
+       }
+       return eLabel::event(event, data, data2);
+}
diff --git a/lib/gui/ebutton.h b/lib/gui/ebutton.h
new file mode 100644 (file)
index 0000000..31c9cb3
--- /dev/null
@@ -0,0 +1,17 @@
+#ifndef __lib_gui_ebutton_h
+#define __lib_gui_ebutton_h
+
+#include <lib/gui/elabel.h>
+
+class eButton: public eLabel
+{
+public:
+       eButton(eWidget *parent);
+       Signal0<void> selected;
+
+       void push();
+protected:
+       int event(int event, void *data=0, void *data2=0);
+};
+
+#endif
diff --git a/lib/gui/elabel.cpp b/lib/gui/elabel.cpp
new file mode 100644 (file)
index 0000000..f133b66
--- /dev/null
@@ -0,0 +1,39 @@
+#include <lib/gui/elabel.h>
+
+eLabel::eLabel(eWidget *parent): eWidget(parent)
+{
+       
+}
+
+int eLabel::event(int event, void *data, void *data2)
+{
+       switch (event)
+       {
+       case evtPaint:
+       {
+               gPainter &painter = *(gPainter*)data2;
+               ePtr<gFont> fnt = new gFont("Arial", 70);
+               painter.setFont(fnt);
+               painter.setBackgroundColor(gColor(0x10));
+               painter.setForegroundColor(gColor(0x1f));
+               painter.clear();
+               painter.setBackgroundColor(gColor(0x1f));
+               painter.setForegroundColor(gColor(0x10));
+               painter.renderText(eRect(0, 0, size().width(), size().height()), m_text);
+               return 0;
+       }
+       case evtChangedText:
+               invalidate();
+               return 0;
+       default:
+               return eWidget::event(event, data, data2);
+       }
+}
+
+void eLabel::setText(const std::string &string)
+{
+       if (m_text == string)
+               return;
+       m_text = string;
+       event(evtChangedText);
+}
diff --git a/lib/gui/elabel.h b/lib/gui/elabel.h
new file mode 100644 (file)
index 0000000..b1f7c2c
--- /dev/null
@@ -0,0 +1,21 @@
+#ifndef __lib_gui_elabel_h
+#define __lib_gui_elabel_h
+
+#include <lib/gui/ewidget.h>
+
+class eLabel: public eWidget
+{
+public:
+       eLabel(eWidget *parent);
+       void setText(const std::string &string);
+protected:
+       int event(int event, void *data=0, void *data2=0);
+private:
+       enum eLabelEvent
+       {
+               evtChangedText = evtUserWidget
+       };
+       std::string m_text;
+};
+
+#endif
diff --git a/lib/gui/ewidget.cpp b/lib/gui/ewidget.cpp
new file mode 100644 (file)
index 0000000..89fbfe9
--- /dev/null
@@ -0,0 +1,167 @@
+#include <lib/gui/ewidget.h>
+#include <lib/gui/ewidgetdesktop.h>
+
+extern void dumpRegion(const gRegion &region);
+
+eWidget::eWidget(eWidget *parent): m_parent(parent)
+{
+       m_vis = 0;
+       m_desktop = 0;
+       
+       if (parent)
+               m_vis = wVisShow;
+       
+       if (parent)
+               parent->m_childs.push_back(this);
+}
+
+void eWidget::move(ePoint pos)
+{
+       m_position = pos;
+       
+       event(evtChangedPosition);
+}
+
+void eWidget::resize(eSize size)
+{
+       event(evtWillChangeSize, &size);
+       event(evtChangedSize);
+}
+
+void eWidget::invalidate(const gRegion &region)
+{
+       gRegion res = /* region & */ m_visible_with_childs;
+       if (res.empty())
+               return;
+       
+       eWidget *root = this;
+       ePoint abspos = position();
+       while (root && !root->m_desktop)
+       {
+               root = root->m_parent;
+               assert(root);
+               abspos += root->position();
+       }
+       
+       res.moveBy(abspos);
+//     eDebug("region to invalidate:");
+//     dumpRegion(res);
+       root->m_desktop->invalidate(res);
+}
+
+void eWidget::show()
+{
+       if (m_vis & wVisShow)
+               return;
+       
+       m_vis |=  wVisShow;
+
+               /* TODO: optimize here to only recalc what's required. possibly merge with hide. */
+       eWidget *root = this;
+       ePoint abspos = position();
+       while (root && !root->m_desktop)
+       {
+               root = root->m_parent;
+               assert(root);
+               abspos += root->position();
+       }
+
+       root->m_desktop->recalcClipRegions();
+
+       gRegion abs = m_visible_with_childs;
+       abs.moveBy(abspos);
+       root->m_desktop->invalidate(abs);
+}
+
+void eWidget::hide()
+{
+       m_vis &= ~wVisShow;
+
+               /* TODO: optimize here to only recalc what's required. possibly merge with show. */
+       eWidget *root = this;
+       ePoint abspos = position();
+       while (root && !root->m_desktop)
+       {
+               root = root->m_parent;
+               abspos += root->position();
+       }
+       assert(root->m_desktop);
+
+       gRegion abs = m_visible_with_childs;
+       abs.moveBy(abspos);
+
+       root->m_desktop->recalcClipRegions();
+       root->m_desktop->invalidate(abs);
+}
+
+void eWidget::destruct()
+{
+       if (m_parent)
+               m_parent->m_childs.remove(this);
+       delete this;
+}
+
+eWidget::~eWidget()
+{
+               /* destroy all childs */
+       ePtrList<eWidget>::iterator i(m_childs.begin());
+       while (i != m_childs.end())
+       {
+               delete *i;
+               i = m_childs.erase(i);
+       }
+}
+
+void eWidget::doPaint(gPainter &painter, const gRegion &r)
+{
+       if (m_visible_with_childs.empty())
+               return;
+       
+       gRegion region = r;
+                       /* we were in parent's space, now we are in local space */
+       region.moveBy(-position());
+       
+       painter.moveOffset(position());
+               /* walk all childs */
+       for (ePtrList<eWidget>::iterator i(m_childs.begin()); i != m_childs.end(); ++i)
+               i->doPaint(painter, region);
+       
+               /* check if there's anything for us to paint */
+       region &= m_visible_region;
+       
+       painter.resetClip(region);
+       event(evtPaint, &region, &painter);
+       
+       painter.moveOffset(-position());
+}
+
+int eWidget::event(int event, void *data, void *data2)
+{
+       switch (event)
+       {
+       case evtPaint:
+       {
+               static int counter = 0x18;
+               gPainter &painter = *(gPainter*)data2;
+//             eDebug("eWidget::evtPaint %d", counter);
+//             dumpRegion(*(gRegion*)data);
+               painter.setBackgroundColor(gColor(++counter));
+               painter.clear();
+               break;
+       }
+       case evtKey:
+               break;
+       case evtWillChangeSize:
+               m_size = *static_cast<eSize*>(data);
+               break;
+       case evtChangedSize:
+       {
+               m_clip_region = gRegion(eRect(ePoint(0, 0),  m_size));
+               break;
+       }
+       default:
+               return -1;
+       }
+       return 0;
+}
+
diff --git a/lib/gui/ewidget.h b/lib/gui/ewidget.h
new file mode 100644 (file)
index 0000000..a551b8a
--- /dev/null
@@ -0,0 +1,66 @@
+#ifndef __lib_gui_ewidget_h
+#define __lib_gui_ewidget_h
+
+#include <lib/gdi/grc.h> /* for gRegion */
+#include <lib/base/eptrlist.h> /* for eSmartPtrList */
+
+class eWidget
+{
+       friend class eWidgetDesktop;
+public:
+       eWidget(eWidget *parent);
+       
+       void move(ePoint pos);
+       void resize(eSize size);
+       
+       ePoint position() const { return m_position; }
+       eSize size() const { return m_size; }
+
+       void invalidate(const gRegion &region = gRegion::invalidRegion());
+
+       void show();
+       void hide();
+       
+       void destruct();
+private:
+       eWidgetDesktop *m_desktop;
+
+       enum { 
+               wVisShow = 1,
+               wVisTransparent = 2,
+       };
+       
+       int m_vis;      
+
+       ePtrList<eWidget> m_childs;
+       eWidget *m_parent;
+       ePoint m_position;
+       eSize m_size;
+       
+       
+       void doPaint(gPainter &painter, const gRegion &region);
+protected:
+       virtual ~eWidget();
+public:
+
+               // all in local space!
+       gRegion m_clip_region, m_visible_region, m_visible_with_childs;
+       
+       enum eWidgetEvent
+       {
+               evtPaint,
+               evtKey,
+               evtChangedPosition,
+               evtChangedSize,
+               
+               evtWillShow,
+               evtWillHide,
+               evtWillChangePosition, /* new size is eRect *data */
+               evtWillChangeSize,
+               
+               evtUserWidget,
+       };
+       virtual int event(int event, void *data = 0, void *data2 = 0);
+};
+
+#endif
diff --git a/lib/gui/ewidgetdesktop.cpp b/lib/gui/ewidgetdesktop.cpp
new file mode 100644 (file)
index 0000000..10c92b7
--- /dev/null
@@ -0,0 +1,72 @@
+#include <lib/gui/ewidgetdesktop.h>
+#include <lib/gui/ewidget.h>
+
+void eWidgetDesktop::addRootWidget(eWidget *root, int top)
+{
+       assert(!root->m_desktop);
+       if (!top)
+               m_root.push_back(root);
+       else
+               m_root.push_front(root);
+       root->m_desktop = this;
+}
+
+void eWidgetDesktop::calcWidgetClipRegion(eWidget *widget, gRegion &parent_visible)
+{
+               /* start with our clip region, clipped with the parent's */
+       if (widget->m_vis & eWidget::wVisShow)
+       {
+               widget->m_visible_region = widget->m_clip_region;
+               widget->m_visible_region.moveBy(widget->position());
+               widget->m_visible_region &= parent_visible; // in parent space!
+                       /* TODO: check transparency here! */
+                       /* remove everything this widget will contain from parent's visible list */
+               parent_visible -= widget->m_visible_region; // will remove child regions too!
+
+                       /* now prepare for recursing to childs */
+               widget->m_visible_region.moveBy(-widget->position());            // now in local space
+       } else
+               widget->m_visible_region = gRegion();
+
+       widget->m_visible_with_childs = widget->m_visible_region;
+       
+       for (ePtrList<eWidget>::iterator i(widget->m_childs.begin()); i != widget->m_childs.end(); ++i)
+               calcWidgetClipRegion(*i, widget->m_visible_region);
+}
+
+void eWidgetDesktop::recalcClipRegions()
+{
+       gRegion screen = gRegion(eRect(ePoint(0, 0), m_screen_size));
+       
+       for (ePtrList<eWidget>::iterator i(m_root.begin()); i != m_root.end(); ++i)
+               calcWidgetClipRegion(*i, screen);
+//     dumpRegion(screen);
+}
+
+void eWidgetDesktop::invalidate(const gRegion &region)
+{
+       m_dirty_region |= region;
+}
+
+void eWidgetDesktop::paint()
+{
+       gPainter painter(m_dc);
+               /* walk all root windows. */
+       for (ePtrList<eWidget>::iterator i(m_root.begin()); i != m_root.end(); ++i)
+               i->doPaint(painter, m_dirty_region);
+       m_dirty_region = gRegion();
+}
+
+void eWidgetDesktop::setDC(gDC *dc)
+{
+       m_dc = dc;
+}
+
+eWidgetDesktop::eWidgetDesktop(eSize size): m_screen_size(size)
+{
+}
+
+eWidgetDesktop::~eWidgetDesktop()
+{
+}
+
diff --git a/lib/gui/ewidgetdesktop.h b/lib/gui/ewidgetdesktop.h
new file mode 100644 (file)
index 0000000..197693f
--- /dev/null
@@ -0,0 +1,29 @@
+#ifndef __lib_gui_ewidgetdesktop_h
+#define __lib_gui_ewidgetdesktop_h
+
+#include <lib/gdi/grc.h>
+#include <lib/base/eptrlist.h>
+
+class eWidget;
+
+class eWidgetDesktop
+{
+public: // weil debug
+       eSize m_screen_size;
+       gRegion m_dirty_region;
+       ePtr<gDC> m_dc;
+public:
+       eWidgetDesktop(eSize screen);
+       ~eWidgetDesktop();
+       void addRootWidget(eWidget *root, int top);
+       void recalcClipRegions();
+       
+       void invalidate(const gRegion &region);
+       void paint();
+       void setDC(gDC *dc);
+private:
+       ePtrList<eWidget> m_root;
+       void calcWidgetClipRegion(eWidget *widget, gRegion &parent_visible);
+};
+
+#endif
diff --git a/lib/gui/ewindow.cpp b/lib/gui/ewindow.cpp
new file mode 100644 (file)
index 0000000..1afee2e
--- /dev/null
@@ -0,0 +1,46 @@
+#include <lib/gui/ewindow.h>
+#include <lib/gui/ewidgetdesktop.h>
+
+#include <lib/gui/ewindowstyle.h>
+
+eWindow::eWindow(eWidgetDesktop *desktop): eWidget(0)
+{
+       m_child = new eWidget(this);
+       desktop->addRootWidget(this, 0);
+       
+       m_style = new eWindowStyleSimple();
+}
+
+void eWindow::setTitle(const std::string &string)
+{
+       if (m_title == string)  
+               return;
+       m_title = string;
+       event(evtTitleChanged);
+}
+
+int eWindow::event(int event, void *data, void *data2)
+{
+       switch (event)
+       {
+       case evtWillChangeSize:
+       {
+               const eSize &new_size = *static_cast<eSize*>(data);
+               eDebug("eWindow::evtWillChangeSize to %d %d", new_size.width(), new_size.height());
+               if (m_style)
+                       m_style->handleNewSize(this, new_size);
+               break;
+       }
+       case evtPaint:
+       {
+               gPainter &painter = *static_cast<gPainter*>(data2);
+               painter.setBackgroundColor(gColor(0x18));
+               painter.clear();
+               break;
+       }
+       default:
+               break;
+       }
+       return eWidget::event(event, data, data2);
+}
+
diff --git a/lib/gui/ewindow.h b/lib/gui/ewindow.h
new file mode 100644 (file)
index 0000000..671a007
--- /dev/null
@@ -0,0 +1,28 @@
+#ifndef __lib_gui_ewindow_h
+#define __lib_gui_ewindow_h
+
+#include <lib/gui/ewidget.h>
+#include <lib/gui/ewindowstyle.h>
+
+class eWidgetDesktop;
+
+class eWindow: public eWidget
+{
+       friend class eWindowStyle;
+public:
+       eWindow(eWidgetDesktop *desktop);
+       void setTitle(const std::string &string);
+       eWidget *child() { return m_child; }
+protected:
+       enum eWindowEvents
+       {
+               evtTitleChanged = evtUserWidget,
+       };
+       int event(int event, void *data=0, void *data2=0);
+private:
+       std::string m_title;
+       eWidget *m_child;
+       ePtr<eWindowStyle> m_style;
+};
+
+#endif
diff --git a/lib/gui/ewindowstyle.cpp b/lib/gui/ewindowstyle.cpp
new file mode 100644 (file)
index 0000000..932a310
--- /dev/null
@@ -0,0 +1,23 @@
+#include <lib/base/eerror.h>
+#include <lib/gdi/esize.h>
+#include <lib/gui/ewindow.h>
+#include <lib/gui/ewindowstyle.h>
+
+DEFINE_REF(eWindowStyleSimple);
+
+eWindowStyleSimple::eWindowStyleSimple()
+{
+       m_border_left = m_border_right = m_border_top = m_border_bottom = 10;
+}
+
+void eWindowStyleSimple::handleNewSize(eWindow *wnd, const eSize &size)
+{
+       eDebug("handle new size: %d x %d", size.width(), size.height());
+       
+       eWidget *child = wnd->child();
+       
+       wnd->m_clip_region = eRect(ePoint(0, 0), size);
+       
+       child->move(ePoint(m_border_left, m_border_top));
+       child->resize(eSize(size.width() - m_border_left - m_border_right, size.height() - m_border_top - m_border_bottom));
+}
diff --git a/lib/gui/ewindowstyle.h b/lib/gui/ewindowstyle.h
new file mode 100644 (file)
index 0000000..02f155a
--- /dev/null
@@ -0,0 +1,24 @@
+#ifndef __lib_gui_ewindowstyle_h
+#define __lib_gui_ewindowstyle_h
+
+class eWindow;
+class eSize;
+
+#include <lib/base/object.h>
+
+class eWindowStyle: public iObject
+{
+public:
+       virtual void handleNewSize(eWindow *wnd, const eSize &size) = 0;
+};
+
+class eWindowStyleSimple: public eWindowStyle
+{
+       DECLARE_REF;
+public:
+       eWindowStyleSimple();
+       void handleNewSize(eWindow *wnd, const eSize &size);
+       int m_border_top, m_border_left, m_border_right, m_border_bottom;
+};
+
+#endif
index 51a0236..72d3fc5 100644 (file)
@@ -1,4 +1,5 @@
 #include <lib/nav/core.h>
+#include <lib/base/eerror.h>
 
 void eNavigation::serviceEvent(iPlayableService* service, int event)
 {
index cfdc79b..f5efef9 100644 (file)
@@ -4,4 +4,6 @@ INCLUDES = \
 noinst_LIBRARIES = libenigma_network.a
 
 libenigma_network_a_SOURCES = \
-       http_dyn.cpp http_file.cpp httpd.cpp serversocket.cpp socket.cpp xmlrpc.cpp
+       http_dyn.cpp http_file.cpp httpd.cpp serversocket.cpp socket.cpp
+
+# xmlrpc.cpp
index d020133..eb94d46 100644 (file)
@@ -1,6 +1,6 @@
 #include <lib/network/http_dyn.h>
 
-eHTTPDyn::eHTTPDyn(eHTTPConnection *c, eString result): eHTTPDataSource(c), result(result)
+eHTTPDyn::eHTTPDyn(eHTTPConnection *c, std::string result): eHTTPDataSource(c), result(result)
 {
        wptr=0;
        char buffer[10];
@@ -34,18 +34,18 @@ eHTTPDynPathResolver::eHTTPDynPathResolver()
 #warning autodelete removed
 }
 
-void eHTTPDynPathResolver::addDyn(eString request, eString path, eString (*function)(eString, eString, eString, eHTTPConnection*))
+void eHTTPDynPathResolver::addDyn(std::string request, std::string path, std::string (*function)(std::string, std::string, std::string, eHTTPConnection*))
 {
        dyn.push_back(new eHTTPDynEntry(request, path, function));
 }
 
-eHTTPDataSource *eHTTPDynPathResolver::getDataSource(eString request, eString path, eHTTPConnection *conn)
+eHTTPDataSource *eHTTPDynPathResolver::getDataSource(std::string request, std::string path, eHTTPConnection *conn)
 {
-       eString p, opt;
-       if (path.find('?')!=eString::npos)
+       std::string p, opt;
+       if (path.find('?')!=std::string::npos)
        {
-               p=path.left(path.find('?'));
-               opt=path.mid(path.find('?')+1);
+               p=path.substr(0, path.find('?'));
+               opt=path.substr(path.find('?')+1);
        }       else
        {
                p=path;
@@ -55,9 +55,9 @@ eHTTPDataSource *eHTTPDynPathResolver::getDataSource(eString request, eString pa
                if ((i->path==p) && (i->request==request))
                {
                        conn->code=-1;
-                       eString s=i->function(request, path, opt, conn);
+                       std::string s=i->function(request, path, opt, conn);
 
-                       if (s)
+                       if (!s.empty())
                                return new eHTTPDyn(conn, s);
 
                        return new eHTTPError(conn, 500);
index 6fb8b9b..d714403 100644 (file)
@@ -5,10 +5,10 @@
 
 class eHTTPDyn: public eHTTPDataSource
 {
-       eString result;
+       std::string result;
        int wptr, size;
 public:
-       eHTTPDyn(eHTTPConnection *c, eString result);
+       eHTTPDyn(eHTTPConnection *c, std::string result);
        ~eHTTPDyn();
        int doWrite(int);
 };
@@ -17,18 +17,18 @@ class eHTTPDynPathResolver: public eHTTPPathResolver
 {
        struct eHTTPDynEntry
        {
-               eString request, path;
-               eString (*function)(eString request, eString path, eString opt, eHTTPConnection *content);
+               std::string request, path;
+               std::string (*function)(std::string request, std::string path, std::string opt, eHTTPConnection *content);
                
-               eHTTPDynEntry(eString request, eString path, eString (*function)(eString, eString, eString, eHTTPConnection *)): request(request), path(path), function(function)
+               eHTTPDynEntry(std::string request, std::string path, std::string (*function)(std::string, std::string, std::string, eHTTPConnection *)): request(request), path(path), function(function)
                {
                }
        };
        ePtrList<eHTTPDynEntry> dyn;
 public:
-       void addDyn(eString request, eString path, eString (*function)(eString, eString, eString, eHTTPConnection *conn));
+       void addDyn(std::string request, std::string path, std::string (*function)(std::string, std::string, std::string, eHTTPConnection *conn));
        eHTTPDynPathResolver();
-       eHTTPDataSource *getDataSource(eString request, eString path, eHTTPConnection *conn);
+       eHTTPDataSource *getDataSource(std::string request, std::string path, eHTTPConnection *conn);
 };
 
 #endif
index 19c8a15..2b47d63 100644 (file)
@@ -64,7 +64,7 @@ eHTTPFilePathResolver::eHTTPFilePathResolver()
 
 static char _base64[]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
 
-static int unbase64(eString &dst, const eString string)
+static int unbase64(std::string &dst, const std::string string)
 {
        dst="";
        char c[4];
@@ -124,21 +124,21 @@ int CheckUnixPassword(const char *user, const char *pass)
        return !!strcmp(cres, cpwd);
 }
 
-static int checkAuth(const eString cauth)
+static int checkAuth(const std::string cauth)
 {
-       eString auth;
-       if (cauth.left(6) != "Basic ")
+       std::string auth;
+       if (cauth.substr(0, 6) != "Basic ")
                return -1;
-       if (unbase64(auth, cauth.mid(6)))
+       if (unbase64(auth, cauth.substr(6)))
                return -1;
-       eString username=auth.left(auth.find(":"));
-       eString password=auth.mid(auth.find(":")+1);
+       std::string username=auth.substr(0, auth.find(":"));
+       std::string password=auth.substr(auth.find(":")+1);
        if (CheckUnixPassword(username.c_str(), password.c_str()))
                return -1;
        return 0;
 }
 
-eHTTPDataSource *eHTTPFilePathResolver::getDataSource(eString request, eString path, eHTTPConnection *conn)
+eHTTPDataSource *eHTTPFilePathResolver::getDataSource(std::string request, std::string path, eHTTPConnection *conn)
 {
        int method;
        eDebug("request = %s, path = %s", request.c_str(), path.c_str());
@@ -148,7 +148,7 @@ eHTTPDataSource *eHTTPFilePathResolver::getDataSource(eString request, eString p
                method=eHTTPFile::methodPUT;
        else
                return new eHTTPError(conn, 405); // method not allowed
-       if (path.find("../")!=eString::npos)            // evil hax0r
+       if (path.find("../")!=std::string::npos)                // evil hax0r
                return new eHTTPError(conn, 403);
        if (path[0] != '/')             // prepend '/'
                path.insert(0,"/");
@@ -158,11 +158,11 @@ eHTTPDataSource *eHTTPFilePathResolver::getDataSource(eString request, eString p
        eHTTPDataSource *data=0;
        for (ePtrList<eHTTPFilePath>::iterator i(translate); i != translate.end(); ++i)
        {
-               if (i->root==path.left(i->root.length()))
+               if (i->root==path.substr(0, i->root.length()))
                {
-                       eString newpath=i->path+path.mid(i->root.length());
+                       std::string newpath=i->path+path.substr(i->root.length());
                        if (newpath.find('?'))
-                               newpath=newpath.left(newpath.find('?'));
+                               newpath=newpath.substr(0, newpath.find('?'));
                        eDebug("translated %s to %s", path.c_str(), newpath.c_str());
 
                        if (i->authorized & ((method==eHTTPFile::methodGET)?1:2))
@@ -194,7 +194,7 @@ eHTTPDataSource *eHTTPFilePathResolver::getDataSource(eString request, eString p
                                break;
                        }
                        
-                       eString ext=path.mid(path.rfind('.'));
+                       std::string ext=path.substr(path.rfind('.'));
                        const char *mime="text/unknown";
                        if ((ext==".html") || (ext==".htm"))
                                mime="text/html";
@@ -218,7 +218,7 @@ eHTTPDataSource *eHTTPFilePathResolver::getDataSource(eString request, eString p
        return data;
 }
 
-void eHTTPFilePathResolver::addTranslation(eString path, eString root, int authorized)
+void eHTTPFilePathResolver::addTranslation(std::string path, std::string root, int authorized)
 {
        if (path[path.length()-1]!='/')
                path+='/';
index 88bffc6..109dc07 100644 (file)
@@ -20,18 +20,18 @@ class eHTTPFilePathResolver: public eHTTPPathResolver
 {
        struct eHTTPFilePath
        {
-               eString path;
-               eString root;
+               std::string path;
+               std::string root;
                int authorized; // must be authorized (1 means read, 2 write)
-               eHTTPFilePath(eString path, eString root, int authorized): path(path), root(root), authorized(authorized)
+               eHTTPFilePath(std::string path, std::string root, int authorized): path(path), root(root), authorized(authorized)
                {
                }
        };
        ePtrList<eHTTPFilePath> translate;
 public:
        eHTTPFilePathResolver();
-       eHTTPDataSource *getDataSource(eString request, eString path, eHTTPConnection *conn);
-       void addTranslation(eString path, eString root, int auth);
+       eHTTPDataSource *getDataSource(std::string request, std::string path, eHTTPConnection *conn);
+       void addTranslation(std::string path, std::string root, int auth);
 };
 
 #endif
index acd3ebe..f706ccf 100644 (file)
@@ -2,6 +2,7 @@
 #include <lib/network/httpd.h>
 
 #include <sys/socket.h>
+#include <lib/base/estring.h>
 #include <error.h>
 #include <errno.h>
 #include <time.h>
@@ -26,7 +27,7 @@ int eHTTPDataSource::doWrite(int)
 
 eHTTPError::eHTTPError(eHTTPConnection *c, int errcode): eHTTPDataSource(c), errcode(errcode)
 {
-       eString error="unknown error";
+       std::string error="unknown error";
        switch (errcode)
        {
        case 400: error="Bad Request"; break;
@@ -44,9 +45,9 @@ eHTTPError::eHTTPError(eHTTPConnection *c, int errcode): eHTTPDataSource(c), err
 
 int eHTTPError::doWrite(int w)
 {
-       eString html;
-       html+="<html><head><title>Error "+eString().setNum(connection->code)+"</title></head>"+
-               "<body><h1>Error "+eString().setNum(errcode)+": "+connection->code_descr+"</h1></body></html>\n";
+       std::string html;
+       html+="<html><head><title>Error " + getNum(connection->code) + "</title></head>"+
+               "<body><h1>Error " + getNum(errcode) + ": " + connection->code_descr + "</h1></body></html>\n";
        connection->writeBlock(html.c_str(), html.length());
        return -1;
 }
@@ -266,7 +267,7 @@ int eHTTPConnection::processLocalState()
 #ifdef DEBUG_HTTPD
                        eDebug("local request");
 #endif
-                       eString req=request+" "+requestpath+" "+httpversion+"\r\n";
+                       std::string req=request+" "+requestpath+" "+httpversion+"\r\n";
                        writeBlock(req.c_str(), req.length());
                        localstate=stateHeader;
                        remotestate=stateResponse;
@@ -277,7 +278,7 @@ int eHTTPConnection::processLocalState()
 #ifdef DEBUG_HTTPD
                        eDebug("local Response");
 #endif
-                       writeString( (httpversion + " " + eString().setNum(code)+" " + code_descr + "\r\n").c_str() );
+                       writeString( (httpversion + " " + getNum(code) + " " + code_descr + "\r\n").c_str() );
                        localstate=stateHeader;
                        local_header["Connection"]="close";
                        break;
@@ -323,7 +324,7 @@ int eHTTPConnection::processLocalState()
                        // move to stateClose
                        if (remote_header.find("Connection") != remote_header.end())
                        {
-                               eString &connection=remote_header["Connection"];
+                               std::string &connection=remote_header["Connection"];
                                if (connection == "keep-alive")
                                        localstate=stateWait;
                                else
@@ -387,7 +388,7 @@ int eHTTPConnection::processRemoteState()
 #ifdef DEBUG_HTTPD
                        eDebug("stateRequest");
 #endif
-                       eString line;
+                       std::string line;
                        if (!getLine(line))
                        {
                                done=1;
@@ -412,16 +413,16 @@ int eHTTPConnection::processRemoteState()
                                        return -1;
                                break;
                        }
-                       request=line.left(del[0]);
-                       requestpath=line.mid(del[0]+1, (del[1]==-1)?-1:(del[1]-del[0]-1));
+                       request=line.substr(0, del[0]);
+                       requestpath=line.substr(del[0]+1, (del[1]==-1)?-1:(del[1]-del[0]-1));
                        if (del[1]!=-1)
                        {
                                is09=0;
-                               httpversion=line.mid(del[1]+1);
+                               httpversion=line.substr(del[1]+1);
                        } else
                                is09=1;
 
-                       if (is09 || (httpversion.left(7) != "HTTP/1.") || httpversion.size()!=8)
+                       if (is09 || (httpversion.substr(0, 7) != "HTTP/1.") || httpversion.size()!=8)
                        {
                                remotestate=stateData;
                                done=0;
@@ -437,7 +438,7 @@ int eHTTPConnection::processRemoteState()
 #ifdef DEBUG_HTTPD
                        eDebug("state response..");
 #endif
-                       eString line;
+                       std::string line;
                        if (!getLine(line))
                        {
                                done=1;
@@ -454,10 +455,10 @@ int eHTTPConnection::processRemoteState()
                                code=-1;
                        else
                        {
-                               httpversion=line.left(del[0]);
-                               code=atoi(line.mid(del[0]+1, (del[1]==-1)?-1:(del[1]-del[0]-1)).c_str());
+                               httpversion=line.substr(0, del[0]);
+                               code=atoi(line.substr(del[0]+1, (del[1]==-1)?-1:(del[1]-del[0]-1)).c_str());
                                if (del[1] != -1)
-                                       code_descr=line.mid(del[1]+1);
+                                       code_descr=line.substr(del[1]+1);
                                else
                                        code_descr="";
                        }
@@ -470,7 +471,7 @@ int eHTTPConnection::processRemoteState()
 #ifdef DEBUG_HTTPD
                        eDebug("remote stateHeader");
 #endif
-                       eString line;
+                       std::string line;
                        if (!getLine(line))
                        {
                                done=1;
@@ -519,9 +520,9 @@ int eHTTPConnection::processRemoteState()
                        } else
                        {
                                int del=line.find(":");
-                               eString name=line.left(del), value=line.mid(del+1);
+                               std::string name=line.substr(0, del), value=line.substr(del+1);
                                if (value[0]==' ')
-                                       value=value.mid(1);
+                                       value=value.substr(1);
                                remote_header[std::string(name)]=std::string(value);
                        }
                        done=1;
@@ -583,7 +584,7 @@ void eHTTPConnection::writeString(const char *data)
        writeBlock(data, strlen(data));
 }
 
-int eHTTPConnection::getLine(eString &line)
+int eHTTPConnection::getLine(std::string &line)
 {
        if (!canReadLine())
                return 0;
index 791d49c..61fe2c7 100644 (file)
@@ -6,7 +6,7 @@
 
 #include <lib/base/eptrlist.h>
 #include <lib/base/ebase.h>
-#include <lib/base/estring.h>
+#include <string>
 #include <lib/base/eerror.h>
 #include <lib/network/socket.h>
 #include <lib/network/serversocket.h>
@@ -19,7 +19,7 @@ class eHTTPPathResolver
 {
 public:
        virtual ~eHTTPPathResolver() {}; 
-       virtual eHTTPDataSource *getDataSource(eString request, eString path, eHTTPConnection *conn)=0;
+       virtual eHTTPDataSource *getDataSource(std::string request, std::string path, eHTTPConnection *conn)=0;
 };
 
 class eHTTPDataSource
@@ -47,7 +47,7 @@ class eHTTPConnection: public eSocket
 {
        void doError(int error);
        
-       int getLine(eString &line);
+       int getLine(std::string &line);
        
        int processLocalState();
        int processRemoteState();
@@ -93,13 +93,13 @@ public:
        ~eHTTPConnection();
        
                // stateRequest
-       eString request, requestpath, httpversion;
+       std::string request, requestpath, httpversion;
        int is09;
        
                // stateResponse
        
        int code;
-       eString code_descr;
+       std::string code_descr;
        
        std::map<std::string,std::string> remote_header, local_header;
        
index 8039034..180ed5d 100644 (file)
Binary files a/lib/network/serversocket.lo and b/lib/network/serversocket.lo differ
index 9de0ca0..628a128 100644 (file)
@@ -43,16 +43,16 @@ void eSocket::inject(const char *data, int len)
                readyRead_();
 }
 
-eString eSocket::readLine()
+std::string eSocket::readLine()
 {
        int size=readbuffer.searchchr('\n');
        if (size == -1)
-               return eString();
+               return std::string();
        size++; // ich will auch das \n
        char buffer[size+1];
        buffer[size]=0;
        readbuffer.read(buffer, size);
-       return eString(buffer);
+       return std::string(buffer);
 }
 
 bool eSocket::canReadLine()
@@ -225,7 +225,7 @@ int eSocket::getDescriptor()
        return socketdesc;
 }
 
-int eSocket::connectToHost(eString hostname, int port)
+int eSocket::connectToHost(std::string hostname, int port)
 {
        struct hostent *server;
        int res;
index edf9b90..08a191f 100644 (file)
@@ -10,7 +10,7 @@
 
 #include <lib/base/ebase.h>
 #include <lib/base/eerror.h>
-#include <lib/base/estring.h>
+#include <string>
 #include <libsig_comp.h>
 #include <lib/base/buffer.h>
 
@@ -32,7 +32,7 @@ public:
        eSocket(eMainloop *ml);
        eSocket(int socket, int issocket, eMainloop *ml);
        ~eSocket();
-       int connectToHost(eString hostname, int port);
+       int connectToHost(std::string hostname, int port);
        int getDescriptor();
        int writeBlock(const char *data, unsigned int len);
        int setSocket(int socketfd, int issocket, eMainloop *ml);
@@ -40,7 +40,7 @@ public:
        int readBlock(char *data, unsigned int maxlen);
        int bytesAvailable();
        bool canReadLine();
-       eString readLine();
+       std::string readLine();
        void close();
                        // flow control: start/stop data delivery into read buffer.
        void enableRead();
index 1d80946..912fce9 100644 (file)
Binary files a/lib/network/socket.lo and b/lib/network/socket.lo differ
index 57b09e8..3d981d5 100644 (file)
@@ -1,9 +1,10 @@
 #ifndef DISABLE_NETWORK
 
 #include <lib/network/xmlrpc.h>
+#include <lib/base/estring.h>
 
 
-static std::map<eString, int (*)(std::vector<eXMLRPCVariant>&, ePtrList<eXMLRPCVariant>&)> rpcproc;
+static std::map<std::string, int (*)(std::vector<eXMLRPCVariant>&, ePtrList<eXMLRPCVariant>&)> rpcproc;
 
 void eXMLRPCVariant::zero()
 {
@@ -17,7 +18,7 @@ void eXMLRPCVariant::zero()
 //     _base64=0;
 }
 
-eXMLRPCVariant::eXMLRPCVariant(std::map<eString,eXMLRPCVariant*> *__struct)
+eXMLRPCVariant::eXMLRPCVariant(std::map<std::string,eXMLRPCVariant*> *__struct)
 {
        zero();
        _struct=__struct;
@@ -41,7 +42,7 @@ eXMLRPCVariant::eXMLRPCVariant(bool *__boolean)
        _boolean=__boolean;
 }
 
-eXMLRPCVariant::eXMLRPCVariant(eString *__string)
+eXMLRPCVariant::eXMLRPCVariant(std::string *__string)
 {
        zero();
        _string=__string;
@@ -73,15 +74,15 @@ eXMLRPCVariant::eXMLRPCVariant(const eXMLRPCVariant &c)
        if (c._boolean)
                _boolean=new bool(*c._boolean);
        if (c._string)
-               _string=new eString(*c._string);
+               _string=new std::string(*c._string);
        if (c._double)
                _double=new double(*c._double);
        // datetime, base64
        if (c._struct)
        {
-               _struct=new std::map<eString,eXMLRPCVariant*>;
-               for (std::map<eString,eXMLRPCVariant*>::iterator b(c._struct->begin()); b != c._struct->end(); ++b)
-                       _struct->insert(std::pair<eString,eXMLRPCVariant*>(b->first, new eXMLRPCVariant(*b->second)));
+               _struct=new std::map<std::string,eXMLRPCVariant*>;
+               for (std::map<std::string,eXMLRPCVariant*>::iterator b(c._struct->begin()); b != c._struct->end(); ++b)
+                       _struct->insert(std::pair<std::string,eXMLRPCVariant*>(b->first, new eXMLRPCVariant(*b->second)));
        }
        if (c._array)
                _array = new std::vector<eXMLRPCVariant>(*c._array);
@@ -91,7 +92,7 @@ eXMLRPCVariant::~eXMLRPCVariant()
 {
        if (_struct)
        {
-               for (std::map<eString,eXMLRPCVariant*>::iterator i(_struct->begin()); i != _struct->end(); ++i)
+               for (std::map<std::string,eXMLRPCVariant*>::iterator i(_struct->begin()); i != _struct->end(); ++i)
                        delete i->second;
 
                delete _struct;
@@ -112,7 +113,7 @@ eXMLRPCVariant::~eXMLRPCVariant()
                delete _base64;*/
 }
 
-std::map<eString,eXMLRPCVariant*> *eXMLRPCVariant::getStruct()
+std::map<std::string,eXMLRPCVariant*> *eXMLRPCVariant::getStruct()
 {
        return _struct;
 }
@@ -132,7 +133,7 @@ bool *eXMLRPCVariant::getBoolean()
        return _boolean;
 }
 
-eString *eXMLRPCVariant::getString()
+std::string *eXMLRPCVariant::getString()
 {
        return _string;
 }
@@ -152,61 +153,62 @@ double *eXMLRPCVariant::getDouble()
        return _base64;
 } */
 
-void eXMLRPCVariant::toXML(eString &result)
+void eXMLRPCVariant::toXML(std::string &result)
 {
        if (getArray())
        {
-               static eString s1("<value><array><data>");
+               static std::string s1("<value><array><data>");
                result+=s1;
                for (unsigned int i=0; i<getArray()->size(); i++)
                {
-                       static eString s("  ");
+                       static std::string s("  ");
                        result+=s;
                        (*getArray())[i].toXML(result);
-                       static eString s1("\n");
+                       static std::string s1("\n");
                        result+=s1;
                }
-               static eString s2("</data></array></value>\n");
+               static std::string s2("</data></array></value>\n");
                result+=s2;
        } else if (getStruct())
        {
-               static eString s1("<value><struct>");
+               static std::string s1("<value><struct>");
                result+=s1;
-               for (std::map<eString,eXMLRPCVariant*>::iterator i(_struct->begin()); i != _struct->end(); ++i)
+               for (std::map<std::string,eXMLRPCVariant*>::iterator i(_struct->begin()); i != _struct->end(); ++i)
                {
-                       static eString s1("  <member><name>");
+                       static std::string s1("  <member><name>");
                        result+=s1;
                        result+=i->first;
-                       static eString s2("</name>");
+                       static std::string s2("</name>");
                        result+=s2;
                        i->second->toXML(result);
-                       static eString s3("</member>\n");
+                       static std::string s3("</member>\n");
                        result+=s3;
                }
-               static eString s2("</struct></value>\n");
+               static std::string s2("</struct></value>\n");
                result+=s2;
        } else if (getI4())
        {
-               static eString s1("<value><i4>");
+               static std::string s1("<value><i4>");
                result+=s1;
-               result+=eString().setNum(*getI4());
-               static eString s2("</i4></value>");
+               result+=getNum(*getI4());
+               static std::string s2("</i4></value>");
                result+=s2;
        } else if (getBoolean())
        {
-               static eString s0("<value><boolean>0</boolean></value>");
-               static eString s1("<value><boolean>1</boolean></value>");
+               static std::string s0("<value><boolean>0</boolean></value>");
+               static std::string s1("<value><boolean>1</boolean></value>");
                result+=(*getBoolean())?s1:s0;
        } else if (getString())
        {
-               static eString s1("<value><string>");
-               static eString s2("</string></value>");
+               static std::string s1("<value><string>");
+               static std::string s2("</string></value>");
                result+=s1;
                result+=*getString();
                result+=s2;
        } else if (getDouble())
        {
-               result+=eString().sprintf("<value><double>%lf</double></value>", *getDouble());
+//             result+=std::string().sprintf("<value><double>%lf</double></value>", *getDouble());
+#warning double support removed
        }       else
                eFatal("couldn't append");
 }
@@ -224,11 +226,11 @@ static eXMLRPCVariant *fromXML(XMLTreeNode *n)
        else if (!strcmp(n->GetType(), "boolean"))
                return new eXMLRPCVariant(new bool(atoi(data)));
        else if (!strcmp(n->GetType(), "string"))
-               return new eXMLRPCVariant(new eString(data));
+               return new eXMLRPCVariant(new std::string(data));
        else if (!strcmp(n->GetType(), "double"))
                return new eXMLRPCVariant(new double(atof(data)));
        else if (!strcmp(n->GetType(), "struct")) {
-               std::map<eString,eXMLRPCVariant*> *s=new std::map<eString,eXMLRPCVariant*>;
+               std::map<std::string,eXMLRPCVariant*> *s=new std::map<std::string,eXMLRPCVariant*>;
                for (n=n->GetChild(); n; n=n->GetNext())
                {
                        if (strcmp(data, "member"))
@@ -236,12 +238,12 @@ static eXMLRPCVariant *fromXML(XMLTreeNode *n)
                                delete s;
                                return 0;
                        }
-                       eString name=0;
+                       std::string name=0;
                        eXMLRPCVariant *value;
                        for (XMLTreeNode *v=n->GetChild(); v; v=v->GetNext())
                        {
                                if (!strcmp(v->GetType(), "name"))
-                                       name=eString(v->GetData());
+                                       name=std::string(v->GetData());
                                else if (!strcmp(v->GetType(), "value"))
                                        value=fromXML(v);
                        }
@@ -292,7 +294,7 @@ int eXMLRPCResponse::doCall()
        eDebug("doing call");
        result="";
                // get method name
-       eString methodName=0;
+       std::string methodName=0;
        
        if (connection->remote_header["Content-Type"]!="text/xml")
        {
@@ -319,7 +321,7 @@ int eXMLRPCResponse::doCall()
        for (XMLTreeNode *c=methodCall->GetChild(); c; c=c->GetNext())
        {
                if (!strcmp(c->GetType(), "methodName"))
-                       methodName=eString(c->GetData());
+                       methodName=std::string(c->GetData());
                else if (!strcmp(c->GetType(), "params"))
                {
                        for (XMLTreeNode *p=c->GetChild(); p; p=p->GetNext())
@@ -441,24 +443,24 @@ void xmlrpc_initialize(eHTTPD *httpd)
        httpd->addResolver(new eHTTPXMLRPCResolver);
 }
 
-void xmlrpc_addMethod(eString methodName, int (*proc)(std::vector<eXMLRPCVariant>&, ePtrList<eXMLRPCVariant>&))
+void xmlrpc_addMethod(std::string methodName, int (*proc)(std::vector<eXMLRPCVariant>&, ePtrList<eXMLRPCVariant>&))
 {
        rpcproc[methodName]=proc;
 }
 
-void xmlrpc_fault(ePtrList<eXMLRPCVariant> &res, int faultCode, eString faultString)
+void xmlrpc_fault(ePtrList<eXMLRPCVariant> &res, int faultCode, std::string faultString)
 {
-       std::map<eString,eXMLRPCVariant*> *s=new std::map<eString,eXMLRPCVariant*>;
+       std::map<std::string,eXMLRPCVariant*> *s=new std::map<std::string,eXMLRPCVariant*>;
        s->INSERT("faultCode", new eXMLRPCVariant(new __s32(faultCode)));
-       s->INSERT("faultString", new eXMLRPCVariant(new eString(faultString)));
+       s->INSERT("faultString", new eXMLRPCVariant(new std::string(faultString)));
        res.push_back(new eXMLRPCVariant(s));
 }
 
-int xmlrpc_checkArgs(eString args, std::vector<eXMLRPCVariant> &parm, ePtrList<eXMLRPCVariant> &res)
+int xmlrpc_checkArgs(std::string args, std::vector<eXMLRPCVariant> &parm, ePtrList<eXMLRPCVariant> &res)
 {
        if (parm.size() != args.length())
        {
-               xmlrpc_fault(res, -500, eString().sprintf("parameter count mismatch (found %d, expected %d)", parm.size(), args.length()));
+               xmlrpc_fault(res, -500, std::string().sprintf("parameter count mismatch (found %d, expected %d)", parm.size(), args.length()));
                return 1;
        }
        
@@ -499,7 +501,7 @@ int xmlrpc_checkArgs(eString args, std::vector<eXMLRPCVariant> &parm, ePtrList<e
                                continue;
                        break;
                }
-               xmlrpc_fault(res, -501, eString().sprintf("parameter type mismatch, expected %c as #%d", args[i], i));
+               xmlrpc_fault(res, -501, std::string().sprintf("parameter type mismatch, expected %c as #%d", args[i], i));
                return 1;
        }
        return 0;
@@ -509,7 +511,7 @@ eHTTPXMLRPCResolver::eHTTPXMLRPCResolver()
 {
 }
 
-eHTTPDataSource *eHTTPXMLRPCResolver::getDataSource(eString request, eString path, eHTTPConnection *conn)
+eHTTPDataSource *eHTTPXMLRPCResolver::getDataSource(std::string request, std::string path, eHTTPConnection *conn)
 {
        if ((path=="/RPC2") && (request=="POST"))
                return new eXMLRPCResponse(conn);
index 727e1e0..5347dbf 100644 (file)
@@ -8,51 +8,51 @@
 #include <vector>
 #include <xmltree.h>
 
-#include <lib/base/estring.h>
+#include <string>
 #include <lib/base/eptrlist.h>
 #include <lib/network/httpd.h>
 
-#define INSERT(KEY,VALUE) insert(std::pair<eString, eXMLRPCVariant*>(KEY,VALUE))
+#define INSERT(KEY,VALUE) insert(std::pair<std::string, eXMLRPCVariant*>(KEY,VALUE))
 
 class eXMLRPCVariant
 {
-       std::map<eString,eXMLRPCVariant*> *_struct;
+       std::map<std::string,eXMLRPCVariant*> *_struct;
        std::vector<eXMLRPCVariant> *_array;
        __s32 *_i4;
        bool *_boolean;
-       eString *_string;
+       std::string *_string;
        double *_double;
 //     QDateTime *_datetime;
 //     QByteArray *_base64;
        void zero();
 public:
-       eXMLRPCVariant(std::map<eString,eXMLRPCVariant*> *_struct);
+       eXMLRPCVariant(std::map<std::string,eXMLRPCVariant*> *_struct);
        eXMLRPCVariant(std::vector<eXMLRPCVariant> *_array);
        eXMLRPCVariant(__s32 *_i4);
        eXMLRPCVariant(bool *_boolean);
-       eXMLRPCVariant(eString *_string);
+       eXMLRPCVariant(std::string *_string);
        eXMLRPCVariant(double *_double);
 //     eXMLRPCVariant(QDateTime *_datetime);
 //     eXMLRPCVariant(QByteArray *_base64);
        eXMLRPCVariant(const eXMLRPCVariant &c);
        ~eXMLRPCVariant();
        
-       std::map<eString,eXMLRPCVariant*> *getStruct();
+       std::map<std::string,eXMLRPCVariant*> *getStruct();
        std::vector<eXMLRPCVariant> *getArray();
        __s32 *getI4();
        bool *getBoolean();
-       eString *getString();
+       std::string *getString();
        double *getDouble();
 //     QDateTime *getDatetime();
 //     QByteArray *getBase64();
        
-       void toXML(eString &);
+       void toXML(std::string &);
 };
 
 class eXMLRPCResponse: public eHTTPDataSource
 {
        XMLTreeParser parser;
-       eString result;
+       std::string result;
        int size;
        int wptr;
        int doCall();
@@ -65,15 +65,15 @@ public:
 };
 
 void xmlrpc_initialize(eHTTPD *httpd);
-void xmlrpc_addMethod(eString methodName, int (*)(std::vector<eXMLRPCVariant>&, ePtrList<eXMLRPCVariant>&));
-void xmlrpc_fault(ePtrList<eXMLRPCVariant> &res, int faultCode, eString faultString);
-int xmlrpc_checkArgs(eString args, std::vector<eXMLRPCVariant>&, ePtrList<eXMLRPCVariant> &res);
+void xmlrpc_addMethod(std::string methodName, int (*)(std::vector<eXMLRPCVariant>&, ePtrList<eXMLRPCVariant>&));
+void xmlrpc_fault(ePtrList<eXMLRPCVariant> &res, int faultCode, std::string faultString);
+int xmlrpc_checkArgs(std::string args, std::vector<eXMLRPCVariant>&, ePtrList<eXMLRPCVariant> &res);
 
 class eHTTPXMLRPCResolver: public eHTTPPathResolver
 {
 public:
        eHTTPXMLRPCResolver();
-       eHTTPDataSource *getDataSource(eString request, eString path, eHTTPConnection *conn);
+       eHTTPDataSource *getDataSource(std::string request, std::string path, eHTTPConnection *conn);
 };
 
 #endif
diff --git a/lib/python/Makefile.am b/lib/python/Makefile.am
new file mode 100644 (file)
index 0000000..c3d98c0
--- /dev/null
@@ -0,0 +1,12 @@
+INCLUDES = \
+       -I$(top_srcdir)/include \
+       -I$(top_srcdir)/src \
+       -I/usr/include/python2.3
+
+noinst_LIBRARIES = libenigma_python.a
+
+libenigma_python_a_SOURCES = \
+       python.cpp enigma_python_wrap.cxx
+
+enigma_python_wrap.cxx: enigma_python.i
+       swig -I$(top_srcdir)/ -c++ -python enigma_python.i
diff --git a/lib/python/enigma_python.i b/lib/python/enigma_python.i
new file mode 100644 (file)
index 0000000..67244f1
--- /dev/null
@@ -0,0 +1,23 @@
+%module enigma
+%{
+#define SWIG_COMPILE
+#include <lib/base/smartptr.h>
+#include <lib/base/eerror.h>
+#include <lib/base/econfig.h>
+#include <lib/service/iservice.h>
+#include <lib/service/service.h>
+%}
+
+#define DEBUG
+%include "stl.i"
+%include <lib/base/object.h>
+%include <lib/base/eerror.h>
+%include <lib/base/econfig.h>
+%include <lib/base/smartptr.h>
+%include <lib/service/iservice.h>
+%include <lib/service/service.h>
+%template(eServiceCenterPtr) ePtr<eServiceCenter>;
+%template(iPlayableServicePtr) ePtr<iPlayableService>;
+%template(iPauseableServicePtr) ePtr<iPauseableService>;
+%template(iRecordableServicePtr) ePtr<iRecordableService>;
+%template(iListableServicePtr) ePtr<iListableService>;
diff --git a/lib/python/python.cpp b/lib/python/python.cpp
new file mode 100644 (file)
index 0000000..a9ad32f
--- /dev/null
@@ -0,0 +1,57 @@
+#include <lib/python/python.h>
+#include <Python.h>
+
+extern "C" void init_enigma();
+
+ePython::ePython()
+{
+       Py_Initialize();
+       
+       init_enigma();
+}
+
+ePython::~ePython()
+{
+       Py_Finalize();
+}
+
+int ePython::execute(const std::string &pythonfile, const std::string &funcname)
+{
+       PyObject *pName, *pModule, *pDict, *pFunc, *pArgs, *pValue;
+       
+       pName = PyString_FromString(pythonfile.c_str());
+       
+       pModule = PyImport_Import(pName);
+       Py_DECREF(pName);
+       
+       if (pModule != NULL)
+       {
+               pDict = PyModule_GetDict(pModule);
+               
+               pFunc = PyDict_GetItemString(pDict, funcname.c_str());
+               
+               if (pFunc && PyCallable_Check(pFunc))
+               {
+                       pArgs = PyTuple_New(0);
+                               // implement arguments..
+                       pValue = PyObject_CallObject(pFunc, pArgs);
+                       Py_DECREF(pArgs);
+                       if (pValue != NULL)
+                       {
+                               printf("Result of call: %ld\n", PyInt_AsLong(pValue));
+                               Py_DECREF(pValue);
+                       } else
+                       {
+                               Py_DECREF(pModule);
+                               PyErr_Print();
+                               return 1;
+                       }
+               }
+       } else
+       {
+               if (PyErr_Occurred())
+                       PyErr_Print();
+               return 1;
+       }
+       return 0;
+}
diff --git a/lib/python/python.h b/lib/python/python.h
new file mode 100644 (file)
index 0000000..bde1814
--- /dev/null
@@ -0,0 +1,16 @@
+#ifndef __lib_python_python_h
+#define __lib_python_python_h
+
+#include <string>
+
+class ePython
+{
+public:
+       ePython();
+       ~ePython();
+       int execute(const std::string &pythonfile, const std::string &funcname);
+private:
+       
+};
+
+#endif
index 253f8c3..a636957 100644 (file)
@@ -2,7 +2,7 @@
 #define __lib_dvb_iservice_h
 
 #include <lib/base/object.h>
-#include <lib/base/estring.h>
+#include <string>
 #include <connection.h>
 #include <list>
 
@@ -41,7 +41,7 @@ public:
        inline int getSortKey() const { return (flags & hasSortKey) ? data[3] : ((flags & sort1) ? 1 : 0); }
 
        int data[8];
-       eString path;
+       std::string path;
 
        eServiceReference()
                : type(idInvalid), flags(0)
@@ -93,13 +93,13 @@ public:
                data[3]=data3;
                data[4]=data4;
        }
-       eServiceReference(int type, int flags, const eString &path)
+       eServiceReference(int type, int flags, const std::string &path)
                : type(type), flags(flags), path(path)
        {
                memset(data, 0, sizeof(data));
        }
-       eServiceReference(const eString &string);
-       eString toString() const;
+       eServiceReference(const std::string &string);
+       std::string toString() const;
        bool operator==(const eServiceReference &c) const
        {
                if (type != c.type)
@@ -137,9 +137,11 @@ public:
 class iServiceInformation: public iObject
 {
 public:
-       virtual RESULT getName(eString &name)=0;
+       virtual RESULT getName(std::string &name)=0;
 };
 
+typedef ePtr<iServiceInformation> iServiceInformationPtr;
+
 class iPauseableService: public iObject
 {
 public:
@@ -147,6 +149,8 @@ public:
        virtual RESULT unpause()=0;
 };
 
+typedef ePtr<iPauseableService> iPauseableServicePtr;
+
 class iPlayableService: public iObject
 {
        friend class iServiceHandler;
@@ -163,6 +167,8 @@ public:
        virtual RESULT getIServiceInformation(ePtr<iServiceInformation> &ptr)=0;
 };
 
+typedef ePtr<iPlayableService> iPlayableServicePtr;
+
 class iRecordableService: public iObject
 {
 public:
@@ -170,12 +176,16 @@ public:
        virtual RESULT stop()=0;
 };
 
+typedef ePtr<iRecordableService> iRecordableServicePtr;
+
 class iListableService: public iObject
 {
 public:
        virtual RESULT getContent(std::list<eServiceReference> &list)=0;
 };
 
+typedef ePtr<iListableService> iListableServicePtr;
+
 class iServiceHandler: public iObject
 {
 public:
@@ -184,4 +194,6 @@ public:
        virtual RESULT list(const eServiceReference &, ePtr<iListableService> &ptr)=0;
 };
 
+typedef ePtr<iServiceHandler> iServiceHandlerPtr;
+
 #endif
index 8abf883..d18b8ee 100644 (file)
@@ -1,8 +1,10 @@
+#include <lib/base/eerror.h>
+#include <lib/base/estring.h>
 #include <lib/service/service.h>
 #include <lib/base/init_num.h>
 #include <lib/base/init.h>
 
-eServiceReference::eServiceReference(const eString &string)
+eServiceReference::eServiceReference(const std::string &string)
 {
        const char *c=string.c_str();
        int pathl=-1;
@@ -18,13 +20,16 @@ eServiceReference::eServiceReference(const eString &string)
                path=c+pathl;
 }
 
-eString eServiceReference::toString() const
+std::string eServiceReference::toString() const
 {
-       eString ret;
-       ret+=eString().sprintf("%d:", type);
-       ret+=eString().sprintf("%d", flags);
+       std::string ret;
+       ret += getNum(type);
+       ret += ":";
+       ret += getNum(flags);
        for (unsigned int i=0; i<sizeof(data)/sizeof(*data); ++i)
-               ret+=":"+eString().sprintf("%x", data[i]);
+       {
+               ret+=":"+ getNum(data[i], 0x10);
+       }
        ret+=":"+path;
        return ret;
 }
index bd40fb0..fbe3427 100644 (file)
@@ -5,23 +5,27 @@
 #include <lib/base/object.h>
 #include <lib/service/iservice.h>
 
+class eServiceCenter;
+
+typedef ePtr<eServiceCenter> eServiceCenterPtr;
+
 class eServiceCenter: public iServiceHandler
 {
 DECLARE_REF;
 private:
-       std::map<int,ePtr<iServiceHandler> > handler;
+       std::map<int,iServiceHandlerPtr> handler;
        static eServiceCenter *instance;
 public:
        eServiceCenter();
        virtual ~eServiceCenter();
 
                // iServiceHandler
-       RESULT play(const eServiceReference &, ePtr<iPlayableService> &ptr);
-       RESULT record(const eServiceReference &, ePtr<iRecordableService> &ptr);
-       RESULT list(const eServiceReference &, ePtr<iListableService> &ptr);
+       RESULT play(const eServiceReference &, iPlayableServicePtr &ptr);
+       RESULT record(const eServiceReference &, iRecordableServicePtr &ptr);
+       RESULT list(const eServiceReference &, iListableServicePtr &ptr);
        
                // eServiceCenter
-       static RESULT getInstance(ePtr<eServiceCenter> &ptr) { ptr = instance; return 0; }
+       static RESULT getInstance(eServiceCenterPtr &ptr) { ptr = instance; return 0; }
        RESULT addServiceFactory(int id, iServiceHandler *hnd);
        RESULT removeServiceFactory(int id);
 };
index cbf9a70..3b22ab7 100644 (file)
@@ -158,7 +158,7 @@ RESULT eDVBServicePlay::getIServiceInformation(ePtr<iServiceInformation> &ptr)
        return 0;
 }
 
-RESULT eDVBServicePlay::getName(eString &name)
+RESULT eDVBServicePlay::getName(std::string &name)
 {
        name = "DVB service";
        return 0;
index 6e90148..42ca30f 100644 (file)
@@ -45,7 +45,7 @@ public:
        RESULT getIServiceInformation(ePtr<iServiceInformation> &ptr);
        
                // iServiceInformation
-       RESULT getName(eString &name);
+       RESULT getName(std::string &name);
 };
 
 #endif
index 4bdc11a..f4a9b73 100644 (file)
@@ -74,7 +74,7 @@ RESULT eServiceFS::getContent(std::list<eServiceReference> &list)
                if (!(strcmp(e->d_name, ".") && strcmp(e->d_name, "..")))
                        continue;
                
-               eString filename;
+               std::string filename;
                
                filename = path;
                filename += e->d_name;
index f98cbc4..7e66ba2 100644 (file)
@@ -21,7 +21,7 @@ class eServiceFS: public iListableService
 {
 DECLARE_REF;
 private:
-       eString path;
+       std::string path;
        friend class eServiceFactoryFS;
        eServiceFS(const char *path);
 public:
index 105ffbf..d1c9001 100644 (file)
@@ -113,7 +113,7 @@ RESULT eServiceMP3::unpause() { printf("mp3 unpauses!\n"); return 0; }
 
 RESULT eServiceMP3::getIServiceInformation(ePtr<iServiceInformation>&i) { i = this; return 0; }
 
-RESULT eServiceMP3::getName(eString &name)
+RESULT eServiceMP3::getName(std::string &name)
 {
        name = "MP3 File: " + filename;
        return 0;
index 940e141..cfca424 100644 (file)
@@ -48,7 +48,7 @@ public:
        RESULT getIServiceInformation(ePtr<iServiceInformation>&);
        
                // iServiceInformation
-       RESULT getName(eString &name);
+       RESULT getName(std::string &name);
 };
 
 #endif
index ff99797..6b0fb41 100644 (file)
@@ -14,6 +14,7 @@ enigma2_LDADD_WHOLE = \
        $(top_builddir)/lib/dvb_si/libenigma_dvb_si.a \
        $(top_builddir)/lib/gdi/libenigma_gdi.a \
        $(top_builddir)/lib/gui/libenigma_gui.a \
+       $(top_builddir)/lib/python/libenigma_python.a \
        $(top_builddir)/lib/nav/libenigma_nav.a \
        $(top_builddir)/lib/network/libenigma_network.a \
        $(top_builddir)/lib/service/libenigma_service.a
@@ -25,7 +26,7 @@ enigma2_LDADD = \
        @MAD_LIBS@ \
        @PNG_LIBS@ \
        @SIGC_LIBS@ \
-       -ldl -lpthread -lcrypt -lresolv
+       -ldl -lpthread -lcrypt -lresolv -lpython2.3
 
 enigma2$(EXEEXT): $(enigma2_OBJECTS) $(enigma2_DEPENDENCIES) $(enigma2_LDADD_WHOLE)
        @rm -f enigma2$(EXEEXT)
index 43dcb1d..bafefe9 100644 (file)
@@ -112,7 +112,7 @@ public:
                                eDebug("failed to get iserviceinformation");
                                break;
                        }
-                       eString name;
+                       std::string name;
                        m_serviceInformation->getName(name);
                        eDebug("NEW running service: %s", name.c_str());
                        break;
index dd9084a..81391c3 100644 (file)
@@ -17,6 +17,8 @@
 
 #include <lib/gui/ewindow.h>
 
+#include <lib/python/python.h>
+
 #ifdef OBJECT_DEBUG
 int object_total_remaining;
 
@@ -50,10 +52,12 @@ int main()
 #ifdef OBJECT_DEBUG
        atexit(object_dump);
 #endif
-
        eInit init;
-
+       
        init.setRunlevel(eAutoInitNumbers::main);
+
+               // gui stuff
+#if 0
        ePtr<gFBDC> my_dc;
        gFBDC::getInstance(my_dc);
 #if 1
@@ -164,5 +168,13 @@ int main()
 //     dumpRegion(dsk.m_dirty_region);
        dsk.paint();
        
+
+#endif
+
+       ePython python;
+       
+       printf("about to execute TEST :)\n");
+       python.execute("mytest", "test");
+
        return 0;
 }
diff --git a/mytest.py b/mytest.py
new file mode 100644 (file)
index 0000000..5a9d4c8
--- /dev/null
+++ b/mytest.py
@@ -0,0 +1,26 @@
+from enigma import *
+
+def test():
+       ref = eServiceReference("4097:47:0:0:0:0:0:0:0:0:/sine_60s_100.mp3");
+       
+       sc = eServiceCenterPtr()
+       print sc
+       
+       if eServiceCenter.getInstance(sc):
+               print "no eServiceCenter instance!"
+       else:
+               print "now trying to play!"
+               i = iPlayableServicePtr();
+               if sc.play(ref, i):
+                       print "play failed! :("
+               else:
+                       print "play ruled!"
+                       
+                       p = iPauseableServicePtr()
+                       if (i.getIPausableService(p)):
+                               print "no pause available"
+                       else:
+                               p.pause()
+                               p.unpause()
+       
+       return 0