summaryrefslogtreecommitdiff
path: root/include/vcl
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-03-16 16:35:00 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-03-19 07:36:12 +0100
commite9c74a075c3c0809b993c017c11d1505bd244dc8 (patch)
tree88cf68873c9b60941ced2ae0fda040496cbe0e2d /include/vcl
parent9d75bfcfaef97b247b3b6cd346eb27e02ae7b010 (diff)
drop ErrCode::GetRest
it was always a broken API because it includes the code, the class, and only part of the subsystemarea. Change-Id: I6f88b54aed2feab02a6aeaa783d7c642054b8075 Reviewed-on: https://gerrit.libreoffice.org/51430 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include/vcl')
-rw-r--r--include/vcl/errcode.hxx24
1 files changed, 17 insertions, 7 deletions
diff --git a/include/vcl/errcode.hxx b/include/vcl/errcode.hxx
index 8f1ba5ffc912..174c424f2871 100644
--- a/include/vcl/errcode.hxx
+++ b/include/vcl/errcode.hxx
@@ -64,11 +64,17 @@ enum class WarningFlag { Yes };
class SAL_WARN_UNUSED ErrCode final
{
public:
- explicit constexpr ErrCode(WarningFlag, ErrCodeArea nArea, ErrCodeClass nClass, sal_uInt16 nCode)
- : m_value(ERRCODE_WARNING_MASK | (sal_uInt32(nArea) << ERRCODE_AREA_SHIFT) | (sal_uInt32(nClass) << ERRCODE_CLASS_SHIFT) | nCode) {}
- explicit constexpr ErrCode(ErrCodeArea nArea, ErrCodeClass nClass, sal_uInt16 nCode)
- : m_value((sal_uInt32(nArea) << ERRCODE_AREA_SHIFT) | (sal_uInt32(nClass) << ERRCODE_CLASS_SHIFT) | nCode) {}
- explicit constexpr ErrCode(ErrCodeArea nArea, sal_uInt32 nClassAndCode)
+ explicit ErrCode(WarningFlag, ErrCodeArea nArea, ErrCodeClass nClass, sal_uInt16 nCode)
+ : m_value(ERRCODE_WARNING_MASK | (sal_uInt32(nArea) << ERRCODE_AREA_SHIFT) | (sal_uInt32(nClass) << ERRCODE_CLASS_SHIFT) | nCode)
+ {
+ assert(nCode <= 0xff && "code out of range");
+ }
+ explicit ErrCode(ErrCodeArea nArea, ErrCodeClass nClass, sal_uInt16 nCode)
+ : m_value((sal_uInt32(nArea) << ERRCODE_AREA_SHIFT) | (sal_uInt32(nClass) << ERRCODE_CLASS_SHIFT) | nCode)
+ {
+ assert(nCode <= 0xff && "code out of range");
+ }
+ explicit constexpr ErrCode(ErrCodeArea nArea, sal_uInt16 nClassAndCode)
: m_value((sal_uInt32(nArea) << ERRCODE_AREA_SHIFT) | nClassAndCode) {}
explicit constexpr ErrCode(sal_uInt32 nValue)
: m_value(nValue) {}
@@ -116,6 +122,10 @@ public:
return ErrCode(m_value & ~ERRCODE_DYNAMIC_MASK);
}
+ constexpr ErrCode StripWarningAndDynamic() const {
+ return ErrCode(m_value & ~(ERRCODE_DYNAMIC_MASK | ERRCODE_WARNING_MASK));
+ }
+
constexpr ErrCodeArea GetArea() const {
return static_cast<ErrCodeArea>((m_value >> ERRCODE_AREA_SHIFT) & 0x01fff);
}
@@ -124,8 +134,8 @@ public:
return static_cast<ErrCodeClass>((m_value >> ERRCODE_CLASS_SHIFT) & 0x1f);
}
- constexpr sal_uInt16 GetRest() const {
- return m_value & 0x7fff;
+ constexpr sal_uInt8 GetCode() const {
+ return static_cast<sal_uInt8>(m_value & 0xff);
}
OUString toHexString() const {