/* Copyright: Copyright (C) 2003-2018 SIL International. Authors: mcdurdin */ #include "processor.hpp" #include "kmx_processevent.h" #include using namespace km::kbp; using namespace kmx; int KMX_Options::_GetIndex(std::u16string const &key) const { auto i = 0U; ; for (auto sp = _kp->Keyboard->dpStoreArray; i != _kp->Keyboard->cxStoreArray; ++i, ++sp) { if (sp->dpName && sp->dpName == key) return i; } return -1; } void KMX_Options::AddOptionsStoresFromXString(PKMX_WCHAR s) { auto idx = 0U; for (; s && *s; s = incxstr(s)) { if (*s == UC_SENTINEL) { switch (*(s + 1)) { case CODE_IFOPT: case CODE_SETOPT: case CODE_SAVEOPT: case CODE_RESETOPT: idx = *(s + 2) - 1; if (idx < _kp->Keyboard->cxStoreArray && _kp->Keyboard->dpStoreArray[idx].dpName != NULL) { _kp->KeyboardOptions[idx].OriginalStore = _kp->Keyboard->dpStoreArray[idx].dpString; } break; } } } } void KMX_Options::Load(abstract_processor & ap, std::u16string const &key) { LPSTORE sp; auto i = 0U; assert(!key.empty()); if (key.empty()) return; for (i = 0, sp = _kp->Keyboard->dpStoreArray; i < _kp->Keyboard->cxStoreArray; i++, sp++) { if (_kp->KeyboardOptions[i].OriginalStore != NULL && sp->dpName != NULL && u16icmp(sp->dpName, key.c_str()) == 0) { Reset(ap, i); return; } } // No entry was found. assert(false); } void KMX_Options::Init(std::vector