Kaydet (Commit) 9044260c authored tarafından Noel Grandin's avatar Noel Grandin Kaydeden (comit) Noel Grandin

add some asserts to validate KeyCode values

Change-Id: I1b4b8d44f11086ed994a093fef0029982fac2c63
Reviewed-on: https://gerrit.libreoffice.org/12161Tested-by: 's avatarLibreOffice gerrit bot <gerrit@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noelgrandin@gmail.com>
üst 513956cf
......@@ -38,12 +38,11 @@ private:
KeyFuncType eFunc;
public:
KeyCode() { nKeyCodeAndModifiers = 0; eFunc = KeyFuncType::DONTKNOW; }
KeyCode( const ResId& rResId );
KeyCode( sal_uInt16 nKey, sal_uInt16 nModifier = 0 )
{ nKeyCodeAndModifiers = nKey | nModifier; eFunc = KeyFuncType::DONTKNOW; }
KeyCode( sal_uInt16 nKey, bool bShift, bool bMod1, bool bMod2, bool bMod3 );
KeyCode( KeyFuncType eFunction );
KeyCode() { nKeyCodeAndModifiers = 0; eFunc = KeyFuncType::DONTKNOW; }
KeyCode( const ResId& rResId );
KeyCode( sal_uInt16 nKey, sal_uInt16 nModifier = 0 );
KeyCode( sal_uInt16 nKey, bool bShift, bool bMod1, bool bMod2, bool bMod3 );
KeyCode( KeyFuncType eFunction );
sal_uInt16 GetFullCode() const { return nKeyCodeAndModifiers; }
KeyFuncType GetFullFunction() const { return eFunc; }
......@@ -78,8 +77,17 @@ public:
} // namespace vcl
inline vcl::KeyCode::KeyCode( sal_uInt16 nKey, sal_uInt16 nModifier )
{
assert(nKey <= KEY_CODE);
assert(nModifier >= KEY_MODTYPE);
nKeyCodeAndModifiers = nKey | nModifier;
eFunc = KeyFuncType::DONTKNOW;
}
inline vcl::KeyCode::KeyCode( sal_uInt16 nKey, bool bShift, bool bMod1, bool bMod2, bool bMod3 )
{
assert(nKey <= KEY_CODE);
nKeyCodeAndModifiers = nKey;
if( bShift )
nKeyCodeAndModifiers |= KEY_SHIFT;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment