diff options
author | Lei Zhang <thestig@chromium.org> | 2017-11-20 19:58:13 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-11-20 19:58:13 +0000 |
commit | fae5e26d983848089e35e2b53e9da24036661b08 (patch) | |
tree | eb5901d51975f27a82891cf135d127d2b7c2e8d3 /fxjs/cjs_eventhandler.cpp | |
parent | 9d0d7c8f35b8f3063d33a41186ea677d01748e45 (diff) | |
download | pdfium-fae5e26d983848089e35e2b53e9da24036661b08.tar.xz |
Make some CJS_EventHandler methods const.
Change-Id: Ie95b6a4c2613b5e110d2dd1244dd4a87375f624f
Reviewed-on: https://pdfium-review.googlesource.com/18750
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'fxjs/cjs_eventhandler.cpp')
-rw-r--r-- | fxjs/cjs_eventhandler.cpp | 51 |
1 files changed, 26 insertions, 25 deletions
diff --git a/fxjs/cjs_eventhandler.cpp b/fxjs/cjs_eventhandler.cpp index c052f9ed58..eb150b247b 100644 --- a/fxjs/cjs_eventhandler.cpp +++ b/fxjs/cjs_eventhandler.cpp @@ -404,7 +404,7 @@ void CJS_EventHandler::Destroy() { m_bValid = false; } -bool CJS_EventHandler::IsValid() { +bool CJS_EventHandler::IsValid() const { return m_bValid; } @@ -415,27 +415,27 @@ WideString& CJS_EventHandler::Change() { return m_WideStrChangeDu; } -WideString CJS_EventHandler::ChangeEx() { +const WideString& CJS_EventHandler::ChangeEx() { return m_WideStrChangeEx; } -int CJS_EventHandler::CommitKey() { +int CJS_EventHandler::CommitKey() const { return m_nCommitKey; } -bool CJS_EventHandler::FieldFull() { +bool CJS_EventHandler::FieldFull() const { return m_bFieldFull; } -bool CJS_EventHandler::KeyDown() { +bool CJS_EventHandler::KeyDown() const { return m_bKeyDown; } -bool CJS_EventHandler::Modifier() { +bool CJS_EventHandler::Modifier() const { return m_bModifier; } -const wchar_t* CJS_EventHandler::Name() { +const wchar_t* CJS_EventHandler::Name() const { switch (m_eEventType) { case JET_APP_INIT: return L"Init"; @@ -506,7 +506,7 @@ const wchar_t* CJS_EventHandler::Name() { } } -const wchar_t* CJS_EventHandler::Type() { +const wchar_t* CJS_EventHandler::Type() const { switch (m_eEventType) { case JET_APP_INIT: return L"App"; @@ -562,27 +562,28 @@ const wchar_t* CJS_EventHandler::Type() { } bool& CJS_EventHandler::Rc() { - if (m_pbRc) { - return *m_pbRc; - } - return m_bRcDu; + return m_pbRc ? *m_pbRc : m_bRcDu; } -int& CJS_EventHandler::SelEnd() { - if (m_pISelEnd) { - return *m_pISelEnd; - } - return m_nSelEndDu; +int CJS_EventHandler::SelEnd() const { + return m_pISelEnd ? *m_pISelEnd : m_nSelEndDu; } -int& CJS_EventHandler::SelStart() { - if (m_pISelStart) { - return *m_pISelStart; - } - return m_nSelStartDu; +int CJS_EventHandler::SelStart() const { + return m_pISelStart ? *m_pISelStart : m_nSelStartDu; +} + +void CJS_EventHandler::SetSelEnd(int value) { + int& target = m_pISelEnd ? *m_pISelEnd : m_nSelEndDu; + target = value; +} + +void CJS_EventHandler::SetSelStart(int value) { + int& target = m_pISelStart ? *m_pISelStart : m_nSelStartDu; + target = value; } -bool CJS_EventHandler::Shift() { +bool CJS_EventHandler::Shift() const { return m_bShift; } @@ -644,10 +645,10 @@ WideString& CJS_EventHandler::Value() { return *m_pValue; } -bool CJS_EventHandler::WillCommit() { +bool CJS_EventHandler::WillCommit() const { return m_bWillCommit; } -WideString CJS_EventHandler::TargetName() { +const WideString& CJS_EventHandler::TargetName() const { return m_strTargetName; } |