Beamlib  3.0.1
This is the Beam C++ class library.
BError.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * BError.h BError Class
3  * T.Barnaby, BEAM Ltd, 21/3/00
4  * Copyright (c) 2022 All Right Reserved, Beam Ltd, https://www.beam.ltd.uk
5  * For license see LICENSE.txt at the root of the beamlib source tree.
6  *******************************************************************************
7  */
17 #ifndef BERROR_H
18 #define BERROR_H 1
19 
20 #include <BString.h>
21 
22 enum BErrorNum {
30 
31 class BError {
32 public:
33  BError(int errNo = ErrorOk, BString errStr = "");
34  BError(BString errStr);
35 
36  BError copy();
37 
38  BError& set(int errNo, BString errStr = "");
39  BError& clear();
40  BError& setError(BString errStr = "");
41 
42 
43  BString getString() const;
44  int getNumber() const;
45 
46  int num() const;
47  const char* str() const;
48 
49  // Old functions
50  int getErrorNo() const;
51 
52  operator int() const;
53 private:
54  int oerrNo;
55  BString oerrStr;
56 
57 };
58 
59 inline BError::operator int () const {
60  return oerrNo;
61 }
62 
63 #endif
BErrorNum
Definition: BError.h:22
@ ErrorOverrun
Definition: BError.h:24
@ ErrorConfig
Definition: BError.h:25
@ ErrorDataTruncated
Definition: BError.h:27
@ ErrorComms
Definition: BError.h:26
@ ErrorParam
Definition: BError.h:23
@ ErrorEndOfFile
Definition: BError.h:26
@ ErrorMisc
Definition: BError.h:23
@ ErrorAppBase
Definition: BError.h:29
@ ErrorOk
Definition: BError.h:23
@ ErrorFormat
Definition: BError.h:26
@ ErrorNoData
Definition: BError.h:27
@ ErrorDataPresent
Definition: BError.h:27
@ ErrorUnderrun
Definition: BError.h:24
@ ErrorFile
Definition: BError.h:26
@ ErrorNotAvailable
Definition: BError.h:24
@ ErrorWarning
Definition: BError.h:23
@ ErrorResourceLimit
Definition: BError.h:25
@ ErrorData
Definition: BError.h:24
@ ErrorNotImplemented
Definition: BError.h:25
@ ErrorUserBase
Definition: BError.h:29
@ ErrorApiVersion
Definition: BError.h:28
@ ErrorInit
Definition: BError.h:25
@ ErrorChecksum
Definition: BError.h:24
@ ErrorEndOfData
Definition: BError.h:27
@ ErrorTimeout
Definition: BError.h:23
@ ErrorAccessDenied
Definition: BError.h:26
Error return class. This class is used to return the error status from a function....
Definition: BError.h:31
int getErrorNo() const
Get The error number.
Definition: BError.cpp:56
int num() const
Get The error number.
Definition: BError.cpp:48
BString getString() const
Get error message.
Definition: BError.cpp:40
BError copy()
Return an independant copy.
Definition: BError.cpp:20
const char * str() const
Return a char* string.
Definition: BError.cpp:52
BError & set(int errNo, BString errStr="")
Set error number and message.
Definition: BError.cpp:24
BError & clear()
Clear the error.
Definition: BError.cpp:30
BError & setError(BString errStr="")
Set error type ERROR with optional message.
Definition: BError.cpp:35
BError(int errNo=ErrorOk, BString errStr="")
Create object.
Definition: BError.cpp:10
int getNumber() const
Get The error number.
Definition: BError.cpp:44
This class stores and manipulates ASCII strings.
Definition: BString.h:20