| 581 | } |
| 582 | |
| 583 | std::wstring BookmarkMgr::getSafeWstringValue(DataNode* node, const std::string& childNodeName) { |
| 584 | |
| 585 | std::wstring decodedWString; |
| 586 | |
| 587 | if (node != nullptr) { |
| 588 | |
| 589 | DataNode* childNode = node->getNext(childNodeName.c_str()); |
| 590 | |
| 591 | //1) decode as encoded wstring: |
| 592 | try { |
| 593 | childNode->element()->get(decodedWString); |
| 594 | |
| 595 | } catch (const DataTypeMismatchException &) { |
| 596 | //2) wstring decode fail, try simple std::string |
| 597 | std::string decodedStdString; |
| 598 | try { |
| 599 | |
| 600 | childNode->element()->get(decodedStdString); |
| 601 | |
| 602 | //use wxString for a clean conversion to a wstring: |
| 603 | decodedWString = wxString(decodedStdString).ToStdWstring(); |
| 604 | |
| 605 | } catch (const DataTypeMismatchException &) { |
| 606 | //nothing works, return an empty string. |
| 607 | decodedWString = L""; |
| 608 | } |
| 609 | } |
| 610 | } |
| 611 | |
| 612 | return decodedWString; |
| 613 | } |
| 614 | |
| 615 | BookmarkEntryPtr BookmarkMgr::nodeToBookmark(DataNode *node) { |
| 616 | if (!node->hasAnother("frequency") || !node->hasAnother("type") || !node->hasAnother("bandwidth")) { |