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


C++ SbTime::format方法代码示例

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


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

示例1: PUBLIC

//
// checks current time to see if we should start or stop playing
//
void
SoVRMLAudioClipP::timerCB(SoSensor *)
{
  SbTime now = SbTime::getTimeOfDay();
  SbTime start = PUBLIC(this)->startTime.getValue();
  SbTime stop = PUBLIC(this)->stopTime.getValue();

#if COIN_DEBUG && DEBUG_AUDIO
  SbString start_str = start.format("%D %h %m %s");
  SbString stop_str = stop.format("%D %h %m %s");
  SbString now_str = now.format("%D %h %m %s");
#endif // debug

#if COIN_DEBUG && DEBUG_AUDIO
  SoDebugError::postInfo("SoVRMLAudioClipP::timerCB", "(timerCB)");
#endif // debug

  if (((now>=stop) && (stop>start)) ||
      (! SoAudioDevice::instance()->haveSound()) ||
      (! SoAudioDevice::instance()->isEnabled()))
  {
    // we shouldn't be playing now
    if  (PUBLIC(this)->isActive.getValue())
      this->stopPlaying();
    return;
  }

  // if we got this far, ( (now<stop) || (stop<=start) )
  if (this->soundHasFinishedPlaying) {
    if  (PUBLIC(this)->isActive.getValue()) {
      // FIXME: perhaps add some additional slack, the size of one buffer? 20021008 thammer.
#if COIN_DEBUG && DEBUG_AUDIO
      SoDebugError::postInfo("SoVRMLAudioClipP::timerCB", "soundHasFinishedPlaying");
#endif // debug
      this->stopPlaying();
    }
    return;
  }

  if (now>=start) {
    if (!PUBLIC(this)->isActive.getValue())
      this->startPlaying();
  }
}
开发者ID:Alexpux,项目名称:Coin3D,代码行数:47,代码来源:AudioClip.cpp

示例2: switch


//.........这里部分代码省略.........
      CASE(MFString,SO__CONCAT(MF,type)):				    \
	for (i = 0; i < ((SoMField *)input)->getNum(); i++) {		    \
	    ((SoMField *)input)->get1(i, string);			    \
	    ((SoMField *)outField)->set1(i, string.getString());	    \
	}								    \
	break
	
// All types except string:
	CONVSTR(BitMask);
	CONVSTR(Bool);
	CONVSTR(Color);
	CONVSTR(Enum);
	CONVSTR(Float);
	CONVSTR(Int32);
	CONVSTR(Matrix);
	CONVSTR(Name);
	CONVSTR(Node);
	CONVSTR(Path);
	CONVSTR(Plane);
	CONVSTR(Rotation);
	CONVSTR(Short);
	CONVSTR(UInt32);
	CONVSTR(UShort);
	CONVSTR(Vec2f);
	CONVSTR(Vec3f);
	CONVSTR(Vec4f);
#undef CONVSTR

// Special case for time to string; if the time is great enough,
// format as a date:
      CASE(SFTime,SFString):
      {
	  SbTime t = ((SoSFTime *)input)->getValue();
	  if (t.getValue() > 3.15e7) string = t.formatDate();
	  else string = t.format();
	  ((SoSFString *)outField)->setValue(string);
      }
      break;
      CASE(SFTime,MFString):
      {
	  SbTime t = ((SoSFTime *)input)->getValue();
	  if (t.getValue() > 3.15e7) string = t.formatDate();
	  else string = t.format();
	  ((SoMFString *)outField)->set1Value(0, string);
      }
      break;
      CASE(MFTime,SFString):
      {
	  SbTime t = (*((SoMFTime *)input))[0];
	  if (t.getValue() > 3.15e7) string = t.formatDate();
	  else string = t.format();
	  ((SoSFString *)outField)->setValue(string);
      }
      break;
      CASE(MFTime,MFString):
      {
	  for (i = 0; i < ((SoMField *)input)->getNum(); i++) {
	      SbTime t = (*((SoMFTime *)input))[i];
	      if (t.getValue() > 3.15e7) string = t.formatDate();
	      else string = t.format();
	      ((SoMFString *)outField)->set1Value(i, string);
	  }
      }
      break;
      CASE(SFString,SFTime):
      CASE(MFString,SFTime):
开发者ID:OpenXIP,项目名称:xip-libraries,代码行数:67,代码来源:SoFieldConverters.cpp


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