宏定义:
#define TEST_FAIL(C,R) if (!C) { R = false; }
宏使用:
bool saveAllOk = true;
// option "use_encoding_1" have need for compatible with old-vnc files
TEST_FAIL(sm->setBoolean(_T("use_encoding_1"), m_allowedCopyRect), saveAllOk);
TEST_FAIL(sm->setBoolean(_T("copyrect"), m_allowedCopyRect), saveAllOk);
TEST_FAIL(sm->setBoolean(_T("viewonly"), m_viewOnly), saveAllOk);
TEST_FAIL(sm->setBoolean(_T("fullscreen"), m_useFullscreen), saveAllOk);
TEST_FAIL(sm->setBoolean(_T("8bit"), m_use8BitColor), saveAllOk);
TEST_FAIL(sm->setBoolean(_T("shared"), m_requestSharedSession), saveAllOk);
TEST_FAIL(sm->setBoolean(_T("belldeiconify"), m_deiconifyOnRemoteBell), saveAllOk);
TEST_FAIL(sm->setBoolean(_T("disableclipboard"), !m_isClipboardEnabled), saveAllOk);
TEST_FAIL(sm->setBoolean(_T("swapmouse"), m_swapMouse), saveAllOk);
TEST_FAIL(sm->setBoolean(_T("fitwindow"), m_fitWindow), saveAllOk);
TEST_FAIL(sm->setBoolean(_T("cursorshape"), m_requestShapeUpdates), saveAllOk);
TEST_FAIL(sm->setBoolean(_T("noremotecursor"), m_ignoreShapeUpdates), saveAllOk);
TEST_FAIL(sm->setByte(_T("preferred_encoding"), m_preferredEncoding), saveAllOk);
TEST_FAIL(sm->setInt(_T("compresslevel"), m_customCompressionLevel), saveAllOk);
TEST_FAIL(sm->setInt(_T("quality"), m_jpegCompressionLevel), saveAllOk);
TEST_FAIL(sm->setInt(_T("localcursor"), m_localCursor), saveAllOk);
TEST_FAIL(sm->setInt(_T("scale_den"), m_scaleDenominator), saveAllOk);
TEST_FAIL(sm->setInt(_T("scale_num"), m_scaleNumerator), saveAllOk);
TEST_FAIL(sm->setInt(_T("local_cursor_shape"), m_localCursor), saveAllOk);