summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/fsdk_annothandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/src/fsdk_annothandler.cpp')
-rw-r--r--fpdfsdk/src/fsdk_annothandler.cpp18
1 files changed, 6 insertions, 12 deletions
diff --git a/fpdfsdk/src/fsdk_annothandler.cpp b/fpdfsdk/src/fsdk_annothandler.cpp
index 40938c7592..bb999e1f08 100644
--- a/fpdfsdk/src/fsdk_annothandler.cpp
+++ b/fpdfsdk/src/fsdk_annothandler.cpp
@@ -23,25 +23,20 @@ CPDFSDK_AnnotHandlerMgr::~CPDFSDK_AnnotHandlerMgr() {
delete pHandler;
}
m_Handlers.RemoveAll();
- m_mapType2Handler.RemoveAll();
+ m_mapType2Handler.clear();
}
void CPDFSDK_AnnotHandlerMgr::RegisterAnnotHandler(
IPDFSDK_AnnotHandler* pAnnotHandler) {
- ASSERT(pAnnotHandler != NULL);
-
- ASSERT(GetAnnotHandler(pAnnotHandler->GetType()) == NULL);
+ ASSERT(!GetAnnotHandler(pAnnotHandler->GetType()));
m_Handlers.Add(pAnnotHandler);
- m_mapType2Handler.SetAt(pAnnotHandler->GetType(), (void*)pAnnotHandler);
+ m_mapType2Handler[pAnnotHandler->GetType()] = pAnnotHandler;
}
void CPDFSDK_AnnotHandlerMgr::UnRegisterAnnotHandler(
IPDFSDK_AnnotHandler* pAnnotHandler) {
- ASSERT(pAnnotHandler != NULL);
-
- m_mapType2Handler.RemoveKey(pAnnotHandler->GetType());
-
+ m_mapType2Handler.erase(pAnnotHandler->GetType());
for (int i = 0, sz = m_Handlers.GetSize(); i < sz; i++) {
if (m_Handlers.GetAt(i) == pAnnotHandler) {
m_Handlers.RemoveAt(i);
@@ -110,9 +105,8 @@ IPDFSDK_AnnotHandler* CPDFSDK_AnnotHandlerMgr::GetAnnotHandler(
IPDFSDK_AnnotHandler* CPDFSDK_AnnotHandlerMgr::GetAnnotHandler(
const CFX_ByteString& sType) const {
- void* pRet = NULL;
- m_mapType2Handler.Lookup(sType, pRet);
- return (IPDFSDK_AnnotHandler*)pRet;
+ auto it = m_mapType2Handler.find(sType);
+ return it != m_mapType2Handler.end() ? it->second : nullptr;
}
void CPDFSDK_AnnotHandlerMgr::Annot_OnDraw(CPDFSDK_PageView* pPageView,