00001 #ifndef __epoc_ao_gerror_hpp__ 00002 #define __epoc_ao_gerror_hpp__ 00003 00004 #include "application_config.h" 00005 00006 #include "common/error_list.h" 00007 00008 #include <e32base.h> 00009 00010 #include <glib.h> 00011 00012 #if __IS_APPLICATION__ 00013 #include <coemain.h> 00014 #endif 00015 00016 #define KGError (-5555) 00017 00018 // Otherwise like CActive, but provides a RunError implementation such 00019 // that the error is logged, and then the application is exited. 00020 NONSHARABLE_CLASS(CActiveLogErr) : public CActive 00021 { 00022 protected: 00023 CActiveLogErr(TInt aPriority) : CActive(aPriority) {} 00024 00025 protected: // CActive 00026 virtual TInt RunError(TInt aError); 00027 00028 protected: 00029 virtual const char* Description() = 0; 00030 }; 00031 00032 // Otherwise like CActiveLogErr, but provides the RunL implementer 00033 // with the option of erroring out with a GError value rather than a 00034 // leave code. 00035 NONSHARABLE_CLASS(CActiveLogErrG) : public CActiveLogErr 00036 { 00037 protected: 00038 CActiveLogErrG(TInt aPriority) : CActiveLogErr(aPriority) {} 00039 00040 virtual ~CActiveLogErrG(); 00041 00042 protected: // CActive 00043 /** As in CActiveLogErr, but supports the logging of a GError value. */ 00044 virtual TInt RunError(TInt aError); 00045 00046 protected: 00047 void Leave(GError* aError); 00048 00049 void LeaveWithError() { User::Leave(KGError); } 00050 00051 protected: 00052 GError* iError; 00053 }; 00054 00055 // This subclass of CActive supports a GLib style RunL implementation, 00056 // one that may either set a GError, or leave. 00057 NONSHARABLE_CLASS(CActiveRunG) : public CActiveLogErrG 00058 { 00059 protected: 00060 CActiveRunG(TInt aPriority) : CActiveLogErrG(aPriority) {} 00061 00062 protected: 00063 /** This function may either leave or return a GError. */ 00064 virtual gboolean RunGL(GError** error) = 0; 00065 00066 private: 00067 /** 00068 Implements RunL based on RunGL. 00069 */ 00070 virtual void RunL(); 00071 }; 00072 00073 #endif /* __epoc_ao_gerror_hpp__ */ 00074 00075 /** 00076 00077 epoc-ao-gerror.hpp 00078 00079 Copyright 2009 Helsinki Institute for Information Technology (HIIT) 00080 and the authors. All rights reserved. 00081 00082 Authors: Tero Hasu <tero.hasu@hut.fi> 00083 00084 Permission is hereby granted, free of charge, to any person 00085 obtaining a copy of this software and associated documentation files 00086 (the "Software"), to deal in the Software without restriction, 00087 including without limitation the rights to use, copy, modify, merge, 00088 publish, distribute, sublicense, and/or sell copies of the Software, 00089 and to permit persons to whom the Software is furnished to do so, 00090 subject to the following conditions: 00091 00092 The above copyright notice and this permission notice shall be 00093 included in all copies or substantial portions of the Software. 00094 00095 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00096 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00097 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 00098 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 00099 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 00100 ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 00101 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 00102 SOFTWARE. 00103 00104 **/
ContextLogger2—ContextLogger2 Logger Daemon Internals—Generated on Mon May 2 13:49:52 2011 by Doxygen 1.6.1