michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: /* michael@0: ** RCBase.h - Mixin class for NSPR C++ wrappers michael@0: */ michael@0: michael@0: #if defined(_RCRUNTIME_H) michael@0: #else michael@0: #define _RCRUNTIME_H michael@0: michael@0: #include michael@0: michael@0: /* michael@0: ** Class: RCBase (mixin) michael@0: ** michael@0: ** Generally mixed into every base class. The functions in this class are all michael@0: ** static. Therefore this entire class is just syntatic sugar. It gives the michael@0: ** illusion that errors (in particular) are retrieved via the same object michael@0: ** that just reported a failure. It also (unfortunately) might lead one to michael@0: ** believe that the errors are persistent in that object. They're not. michael@0: */ michael@0: michael@0: class PR_IMPLEMENT(RCBase) michael@0: { michael@0: public: michael@0: virtual ~RCBase(); michael@0: michael@0: static void AbortSelf(); michael@0: michael@0: static PRErrorCode GetError(); michael@0: static PRInt32 GetOSError(); michael@0: michael@0: static PRSize GetErrorTextLength(); michael@0: static PRSize CopyErrorText(char *text); michael@0: michael@0: static void SetError(PRErrorCode error, PRInt32 oserror); michael@0: static void SetErrorText(PRSize textLength, const char *text); michael@0: michael@0: protected: michael@0: RCBase() { } michael@0: }; /* RCObject */ michael@0: michael@0: inline PRErrorCode RCBase::GetError() { return PR_GetError(); } michael@0: inline PRInt32 RCBase::GetOSError() { return PR_GetOSError(); } michael@0: michael@0: #endif /* defined(_RCRUNTIME_H) */ michael@0: michael@0: /* rcbase.h */