Wed, 31 Dec 2014 06:55:46 +0100
Added tag TORBROWSER_REPLICA for changeset 6474c204b198
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 /*
7 ** RCBase.h - Mixin class for NSPR C++ wrappers
8 */
10 #if defined(_RCRUNTIME_H)
11 #else
12 #define _RCRUNTIME_H
14 #include <prerror.h>
16 /*
17 ** Class: RCBase (mixin)
18 **
19 ** Generally mixed into every base class. The functions in this class are all
20 ** static. Therefore this entire class is just syntatic sugar. It gives the
21 ** illusion that errors (in particular) are retrieved via the same object
22 ** that just reported a failure. It also (unfortunately) might lead one to
23 ** believe that the errors are persistent in that object. They're not.
24 */
26 class PR_IMPLEMENT(RCBase)
27 {
28 public:
29 virtual ~RCBase();
31 static void AbortSelf();
33 static PRErrorCode GetError();
34 static PRInt32 GetOSError();
36 static PRSize GetErrorTextLength();
37 static PRSize CopyErrorText(char *text);
39 static void SetError(PRErrorCode error, PRInt32 oserror);
40 static void SetErrorText(PRSize textLength, const char *text);
42 protected:
43 RCBase() { }
44 }; /* RCObject */
46 inline PRErrorCode RCBase::GetError() { return PR_GetError(); }
47 inline PRInt32 RCBase::GetOSError() { return PR_GetOSError(); }
49 #endif /* defined(_RCRUNTIME_H) */
51 /* rcbase.h */