当前位置: 首页>>代码示例>>C++>>正文


C++ OptionsList::size方法代码示例

本文整理汇总了C++中OptionsList::size方法的典型用法代码示例。如果您正苦于以下问题:C++ OptionsList::size方法的具体用法?C++ OptionsList::size怎么用?C++ OptionsList::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OptionsList的用法示例。


在下文中一共展示了OptionsList::size方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: getDateFormat

DateFormatPtr DatePatternConverter::getDateFormat(const OptionsList& options) {
  DateFormatPtr df;
  int maximumCacheValidity = 1000000;
  if (options.size() == 0) {
      df = new ISO8601DateFormat();
  } else {
     LogString dateFormatStr(options[0]);

     if(dateFormatStr.empty() ||
          StringHelper::equalsIgnoreCase(dateFormatStr,
          LOG4CXX_STR("ISO8601"), LOG4CXX_STR("iso8601"))) {
          df = new ISO8601DateFormat();
     } else if(StringHelper::equalsIgnoreCase(dateFormatStr,
          LOG4CXX_STR("ABSOLUTE"), LOG4CXX_STR("absolute"))) {
          df = new AbsoluteTimeDateFormat();
     } else if(StringHelper::equalsIgnoreCase(dateFormatStr,
          LOG4CXX_STR("DATE"), LOG4CXX_STR("date"))) {
          df = new DateTimeDateFormat();
     } else {
       if (dateFormatStr.find(0x25 /*'%'*/) == std::string::npos) {
          try {
             df = new SimpleDateFormat(dateFormatStr);
             maximumCacheValidity =
                CachedDateFormat::getMaximumCacheValidity(dateFormatStr);
          } catch(IllegalArgumentException& e) {
             df = new ISO8601DateFormat();
             LogLog::warn(((LogString)
                LOG4CXX_STR("Could not instantiate SimpleDateFormat with pattern "))
                   + dateFormatStr, e);
          }
       } else {
          df = new StrftimeDateFormat(dateFormatStr);
       }
     }
     if (options.size() >= 2) {
       TimeZonePtr tz(TimeZone::getTimeZone(options[1]));
       if (tz != NULL) {
          df->setTimeZone(tz);
       }
     }
  }
  if (maximumCacheValidity > 0) {
      df = new CachedDateFormat(df, maximumCacheValidity);
  }
  return df;
}
开发者ID:herryRiver,项目名称:sdl_core_v3.6_wince,代码行数:46,代码来源:datepatternconverter.cpp

示例2: if

void
ServerProxy::setOptions()
{
	// parse
	OptionsList options;
	ProtocolUtil::readf(m_stream, kMsgDSetOptions + 4, &options);
	LOG((CLOG_DEBUG1 "recv set options size=%d", options.size()));

	// forward
	m_client->setOptions(options);

	// update modifier table
	for (UInt32 i = 0, n = (UInt32)options.size(); i < n; i += 2) {
		KeyModifierID id = kKeyModifierIDNull;
		if (options[i] == kOptionModifierMapForShift) {
			id = kKeyModifierIDShift;
		}
		else if (options[i] == kOptionModifierMapForControl) {
			id = kKeyModifierIDControl;
		}
		else if (options[i] == kOptionModifierMapForAlt) {
			id = kKeyModifierIDAlt;
		}
		else if (options[i] == kOptionModifierMapForAltGr) {
			id = kKeyModifierIDAltGr;
		}
		else if (options[i] == kOptionModifierMapForMeta) {
			id = kKeyModifierIDMeta;
		}
		else if (options[i] == kOptionModifierMapForSuper) {
			id = kKeyModifierIDSuper;
		}
		else if (options[i] == kOptionHeartbeat) {
			// update keep alive
			setKeepAliveRate(1.0e-3 * static_cast<double>(options[i + 1]));
		}

		if (id != kKeyModifierIDNull) {
			m_modifierTranslationTable[id] =
				static_cast<KeyModifierID>(options[i + 1]);
			LOG((CLOG_DEBUG1 "modifier %d mapped to %d", id, m_modifierTranslationTable[id]));
		}
	}
}
开发者ID:TotoxLAncien,项目名称:synergy,代码行数:44,代码来源:ServerProxy.cpp

示例3: getName

void
ClientProxy1_0::setOptions(const OptionsList& options)
{
	LOG((CLOG_DEBUG1 "send set options to \"%s\" size=%d", getName().c_str(), options.size()));
	ProtocolUtil::writef(getStream(), kMsgDSetOptions, &options);

	// check options
	for (UInt32 i = 0, n = (UInt32)options.size(); i < n; i += 2) {
		if (options[i] == kOptionHeartbeat) {
			double rate = 1.0e-3 * static_cast<double>(options[i + 1]);
			if (rate <= 0.0) {
				rate = -1.0;
			}
			setHeartbeatRate(rate, rate * kHeartBeatsUntilDeath);
			removeHeartbeatTimer();
			addHeartbeatTimer();
		}
	}
}
开发者ID:donggeol,项目名称:OSjumper,代码行数:19,代码来源:ClientProxy1_0.cpp

示例4: if

void
Screen::setOptions(const OptionsList& options)
{
	// update options
	bool oldScreenSaverSync = m_screenSaverSync;
	for (UInt32 i = 0, n = (UInt32)options.size(); i < n; i += 2) {
		if (options[i] == kOptionScreenSaverSync) {
			m_screenSaverSync = (options[i + 1] != 0);
			LOG((CLOG_DEBUG1 "screen saver synchronization %s", m_screenSaverSync ? "on" : "off"));
		}
		else if (options[i] == kOptionHalfDuplexCapsLock) {
			if (options[i + 1] != 0) {
				m_halfDuplex |=  KeyModifierCapsLock;
			}
			else {
				m_halfDuplex &= ~KeyModifierCapsLock;
			}
			LOG((CLOG_DEBUG1 "half-duplex caps-lock %s", ((m_halfDuplex & KeyModifierCapsLock) != 0) ? "on" : "off"));
		}
		else if (options[i] == kOptionHalfDuplexNumLock) {
			if (options[i + 1] != 0) {
				m_halfDuplex |=  KeyModifierNumLock;
			}
			else {
				m_halfDuplex &= ~KeyModifierNumLock;
			}
			LOG((CLOG_DEBUG1 "half-duplex num-lock %s", ((m_halfDuplex & KeyModifierNumLock) != 0) ? "on" : "off"));
		}
		else if (options[i] == kOptionHalfDuplexScrollLock) {
			if (options[i + 1] != 0) {
				m_halfDuplex |=  KeyModifierScrollLock;
			}
			else {
				m_halfDuplex &= ~KeyModifierScrollLock;
			}
			LOG((CLOG_DEBUG1 "half-duplex scroll-lock %s", ((m_halfDuplex & KeyModifierScrollLock) != 0) ? "on" : "off"));
		}
	}

	// update half-duplex options
	m_screen->setHalfDuplexMask(m_halfDuplex);

	// update screen saver synchronization
	if (!m_isPrimary && oldScreenSaverSync != m_screenSaverSync) {
		if (m_screenSaverSync) {
			m_screen->openScreensaver(false);
		}
		else {
			m_screen->closeScreensaver();
		}
	}

	// let screen handle its own options
	m_screen->setOptions(options);
}
开发者ID:TotoxLAncien,项目名称:synergy,代码行数:55,代码来源:Screen.cpp


注:本文中的OptionsList::size方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。