diff options
| author | Felix Domke <tmbinc@elitedvb.net> | 2004-10-01 13:21:35 +0000 |
|---|---|---|
| committer | Felix Domke <tmbinc@elitedvb.net> | 2004-10-01 13:21:35 +0000 |
| commit | ddc3964ed95d01e72229dc9af968a327cd84e56c (patch) | |
| tree | 93e6694c639db3d188f5b2868f6b2b2951d21d60 /lib/base | |
| parent | 1aeefd997cc362c3b37c1587c5f08891b35c3a75 (diff) | |
| download | enigma2-ddc3964ed95d01e72229dc9af968a327cd84e56c.tar.gz enigma2-ddc3964ed95d01e72229dc9af968a327cd84e56c.zip | |
- add python, missing gui
- remove console (needs to be rewritten anyway)
- eString -> std::string
Diffstat (limited to 'lib/base')
| -rw-r--r-- | lib/base/Makefile.am | 6 | ||||
| -rw-r--r-- | lib/base/console.cpp | 248 | ||||
| -rw-r--r-- | lib/base/console.h | 0 | ||||
| -rw-r--r-- | lib/base/econfig.cpp | 43 | ||||
| -rw-r--r-- | lib/base/econfig.h | 27 | ||||
| -rw-r--r-- | lib/base/eerror.cpp | 8 | ||||
| -rw-r--r-- | lib/base/eerror.h | 8 | ||||
| -rw-r--r-- | lib/base/estring.cpp | 123 | ||||
| -rw-r--r-- | lib/base/estring.h | 106 | ||||
| -rw-r--r-- | lib/base/smartptr.h | 69 |
10 files changed, 80 insertions, 558 deletions
diff --git a/lib/base/Makefile.am b/lib/base/Makefile.am index 3e695a39..955d9e4a 100644 --- a/lib/base/Makefile.am +++ b/lib/base/Makefile.am @@ -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 index 2609582f..00000000 --- a/lib/base/console.cpp +++ /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 index e69de29b..00000000 --- a/lib/base/console.h +++ /dev/null diff --git a/lib/base/econfig.cpp b/lib/base/econfig.cpp index 3d51255b..e69de29b 100644 --- a/lib/base/econfig.cpp +++ b/lib/base/econfig.cpp @@ -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"); diff --git a/lib/base/econfig.h b/lib/base/econfig.h index d9f3becd..e69de29b 100644 --- a/lib/base/econfig.h +++ b/lib/base/econfig.h @@ -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 diff --git a/lib/base/eerror.cpp b/lib/base/eerror.cpp index 68541d41..11bb9943 100644 --- a/lib/base/eerror.cpp +++ b/lib/base/eerror.cpp @@ -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); } diff --git a/lib/base/eerror.h b/lib/base/eerror.h index bf913959..476029c7 100644 --- a/lib/base/eerror.h +++ b/lib/base/eerror.h @@ -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, ...) { diff --git a/lib/base/estring.cpp b/lib/base/estring.cpp index bf30d5f9..f0107b6a 100644 --- a/lib/base/estring.cpp +++ b/lib/base/estring.cpp @@ -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(); diff --git a/lib/base/estring.h b/lib/base/estring.h index 36f6636a..9cc3180f 100644 --- a/lib/base/estring.h +++ b/lib/base/estring.h @@ -8,106 +8,10 @@ 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__ diff --git a/lib/base/smartptr.h b/lib/base/smartptr.h index aafecf0e..906bba69 100644 --- a/lib/base/smartptr.h +++ b/lib/base/smartptr.h @@ -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 |
