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


C++ Nullable::isNull方法代码示例

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


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

示例1: testNullableString

void MySQLTest::testNullableString()
{
	if (!_pSession) fail ("Test not available.");

	recreateNullableStringTable();

	Int32 id = 0;
	Nullable<std::string> address("Address");
	Nullable<Int32> age = 10;
	*_pSession << "INSERT INTO NullableStringTest VALUES(?, ?, ?)", use(id), use(address), use(age), now;
	id++;
	address = null;
	age = null;
	*_pSession << "INSERT INTO NullableStringTest VALUES(?, ?, ?)", use(id), use(address), use(age), now;

	Nullable<std::string> resAddress;
	Nullable<Int32> resAge;
	*_pSession << "SELECT Address, Age FROM NullableStringTest WHERE Id = ?", into(resAddress), into(resAge), use(id), now;
	assert(resAddress == address);
	assert(resAge == age);
	assert(resAddress.isNull());
	assert(null == resAddress);
	assert(resAddress == null);

	resAddress = std::string("Test");
	assert(!resAddress.isNull());
	assert(resAddress == std::string("Test"));
	assert(std::string("Test") == resAddress);
	assert(null != resAddress);
	assert(resAddress != null);
}
开发者ID:cshnick,项目名称:CommunicationModel,代码行数:31,代码来源:MySQLTest.cpp

示例2: Dictionary

TEST_F(AnimationAnimationV8Test, SpecifiedDurationGetter)
{
    Vector<Dictionary, 0> jsKeyframes;

    v8::Handle<v8::Object> timingInputWithDuration = v8::Object::New(m_isolate);
    setV8ObjectPropertyAsNumber(timingInputWithDuration, "duration", 2.5);
    Dictionary timingInputDictionaryWithDuration = Dictionary(v8::Handle<v8::Value>::Cast(timingInputWithDuration), m_isolate);

    RefPtrWillBeRawPtr<Animation> animationWithDuration = createAnimation(element.get(), jsKeyframes, timingInputDictionaryWithDuration, exceptionState);

    RefPtrWillBeRawPtr<AnimationNodeTiming> specifiedWithDuration = animationWithDuration->timing();
    Nullable<double> numberDuration;
    String stringDuration;
    specifiedWithDuration->getDuration("duration", numberDuration, stringDuration);
    EXPECT_FALSE(numberDuration.isNull());
    EXPECT_EQ(2.5, numberDuration.get());
    EXPECT_TRUE(stringDuration.isNull());


    v8::Handle<v8::Object> timingInputNoDuration = v8::Object::New(m_isolate);
    Dictionary timingInputDictionaryNoDuration = Dictionary(v8::Handle<v8::Value>::Cast(timingInputNoDuration), m_isolate);

    RefPtrWillBeRawPtr<Animation> animationNoDuration = createAnimation(element.get(), jsKeyframes, timingInputDictionaryNoDuration, exceptionState);

    RefPtrWillBeRawPtr<AnimationNodeTiming> specifiedNoDuration = animationNoDuration->timing();
    Nullable<double> numberDuration2;
    String stringDuration2;
    specifiedNoDuration->getDuration("duration", numberDuration2, stringDuration2);
    EXPECT_TRUE(numberDuration2.isNull());
    EXPECT_FALSE(stringDuration2.isNull());
    EXPECT_EQ("auto", stringDuration2);
}
开发者ID:dalecurtis,项目名称:mojo,代码行数:32,代码来源:AnimationTest.cpp

示例3: get_idf_cpp

// [[Rcpp::export]]
List get_idf_cpp(List x,Nullable<CharacterVector> stop_) {

  IDFmap m;
  for(ListOf<CharacterVector>::iterator it = x.begin();it != x.end();it++){
    unsigned int dis = distance( x.begin(), it );
    auto tmp = as<CharacterVector>(*it);
    inner_find(tmp,m,dis);
  }
  RCPP_UNORDERED_MAP< string,unsigned int > res;
  
  
  unordered_set<string> st;
  
  if(!stop_.isNull()){
    CharacterVector stop_value = stop_.get();
    const char *const stop_path = stop_value[0];
    _loadStopWordDict(stop_path,st);
    for(auto its= m.begin();its!=m.end();its++){
      if(st.find((*its).first) ==st.end()) res[(*its).first] = (*its).second.second;
    }
    return wrap(res);
  }
  
  for(auto its= m.begin();its!=m.end();its++){
    res[(*its).first] = (*its).second.second;
  }
  return wrap(res);
}
开发者ID:luojiahuli,项目名称:jiebaR,代码行数:29,代码来源:get_idf.cpp

示例4: executeSql

void SQLTransaction::executeSql(ScriptState* scriptState, const String& sqlStatement, const Nullable<Vector<ScriptValue>>& arguments, SQLStatementCallback* callback, SQLStatementErrorCallback* callbackError, ExceptionState& exceptionState)
{
    Vector<SQLValue> sqlValues;
    if (!arguments.isNull())
        sqlValues = toImplArray<Vector<SQLValue>>(arguments.get(), scriptState->isolate(), exceptionState);
    executeSQL(sqlStatement, sqlValues, callback, callbackError, exceptionState);
}
开发者ID:howardroark2018,项目名称:chromium,代码行数:7,代码来源:SQLTransaction.cpp

示例5: tagger

 tagger(CharacterVector dict, CharacterVector model, CharacterVector user,Nullable<CharacterVector> stop) :
   dict_path(dict[0]), model_path(model[0]), user_path(user[0]), stopWords(unordered_set<string>()), taggerseg(dict_path, model_path, user_path)
 {
 	  	  if(!stop.isNull()){
 	    CharacterVector stop_value = stop.get();
 	 	  const char *const stop_path = stop_value[0];
 	 	  _loadStopWordDict(stop_path,stopWords);
 	 }
 }
开发者ID:hoyoung2015,项目名称:jiebaR,代码行数:9,代码来源:segtype.hpp

示例6: get_idf_cpp

// [[Rcpp::export]]
List get_idf_cpp(List x,Nullable<CharacterVector> stop_) {

  IDFmap m;
  for(ListOf<CharacterVector>::iterator it = x.begin();it != x.end();it++){
    unsigned int dis = distance( x.begin(), it );
    auto tmp = as<CharacterVector>(*it);
    inner_find(tmp,m,dis);
  }


  
  vector<string> sts;
  vector<double> stn;
  sts.reserve(m.size());
  stn.reserve(m.size());
  
  unordered_set<string> st;

  double xsize = x.size();
  
  if(!stop_.isNull()){
    CharacterVector stop_value = stop_.get();
    const char *const stop_path = stop_value[0];
    _loadStopWordDict(stop_path,st);
    for(auto its= m.begin();its!=m.end();its++){
      if(st.find((*its).first) ==st.end()){
        sts.push_back((*its).first);
        stn.push_back( log(xsize / (*its).second.second) );
      }
    }

  }else{
    for(auto its= m.begin();its!=m.end();its++){
      sts.push_back((*its).first);
      stn.push_back((*its).second.second);
    }
  }
  
  vector<string> row_names;
  row_names.reserve(sts.size());
  for (unsigned int i = 0; i < sts.size(); ++i) {
    row_names.emplace_back(int64tos(i));
  }
  
  List res = List::create(_["name"] = wrap(sts),_["count"] = wrap(stn));
  res.attr("row.names") = row_names;
  res.attr("names") = CharacterVector::create("name","count");
  res.attr("class") = "data.frame";
  return res;
}
开发者ID:Benknightdark,项目名称:jiebaR,代码行数:51,代码来源:get_idf.cpp

示例7: glutHandler

 static void glutHandler(int val)
 {
    GlutTimer& inst = instance();
    TimerInfo next = inst._callbacks.poll();
    double now = getTimeSinceLaunched();
    double elapsed = now - next.timestamp;
    if (elapsed >= 0.0)
    {
       Nullable<double> newMillis = 
             next.cb->onTimeElapsed(elapsed);
       if (!newMillis.isNull())
          inst.registerCallback(next.cb, next.ms);
    }
    else
       /* Theoretically, this should never happen. */
       inst.registerCallback(next.cb, -elapsed);
 }
开发者ID:apoloval,项目名称:Karen,代码行数:17,代码来源:glut.cpp

示例8: switch

void
StdOutUnitTestReporter::endUnitTest(
      TestResultStatus status,
      const Nullable<String>& info)
{
   switch (status)
   {
      case TEST_RESULT_PASSED: 
         std::cerr << "success"; break;
      case TEST_RESULT_ASSERTION_FAILED:
         std::cerr << "ASSERTION FAILED"; break;
      case TEST_RESULT_FAILED:
         std::cerr << "FAILED"; break;
   }
   if (!info.isNull())
      std::cerr << String::format(": %s", (const char*) (const String&) info);
   std::cerr << std::endl;
}
开发者ID:apoloval,项目名称:Karen,代码行数:18,代码来源:test.cpp

示例9: testNullable

void CoreTest::testNullable()
{
	Nullable<int> i;
	Nullable<double> f;
	Nullable<std::string> s;

	assert (i.isNull());
	assert (f.isNull());
	assert (s.isNull());

	i = 1;
	f = 1.5;
	s = "abc";

	assert (!i.isNull());
	assert (!f.isNull());
	assert (!s.isNull());

	assert (i == 1);
	assert (f == 1.5);
	assert (s == "abc");

	i.clear();
	f.clear();
	s.clear();

	assert (i.isNull());
	assert (f.isNull());
	assert (s.isNull());

	Nullable<int> n1;
	assert (n1.isNull());
	
	assert (n1.value(42) == 42);
	assert (n1.isNull());
	assert (!(0 == n1));
	assert (0 != n1);
	assert (!(n1 == 0));
	assert (n1 != 0);
	
	try
	{
		int tmp = n1.value();
		fail("null value, must throw");
	}
	catch (Poco::NullValueException&)
	{
	}
	
	n1 = 1;
	assert (!n1.isNull());
	assert (n1.value() == 1);
	
	Nullable<int> n2(42);
	assert (!n2.isNull());
	assert (n2.value() == 42);
	assert (n2.value(99) == 42);
	
	assert (!(0 == n2));
	assert (0 != n2);
	assert (!(n2 == 0));
	assert (n2 != 0);
	
	n1 = n2;
	assert (!n1.isNull());
	assert (n1.value() == 42);
	
	std::ostringstream str;
	str << n1;
	assert (str.str() == "42");

	n1.clear();
	assert (n1.isNull());

	str.str(""); str << n1;
	assert (str.str().empty());

	n2.clear();
	assert (n1 == n2);
	n1 = 1; n2 = 1;
	assert (n1 == n2);
	n1.clear();
	assert (n1 < n2);
	assert (n2 > n1);
	n2 = -1; n1 = 0;
	assert (n2 < n1);
	assert (n2 != n1);
	assert (n1 > n2);

	NullType nd;
	assert (n1 != nd);
	assert (nd != n1);
	n1.clear();
	assert (n1 == nd);
	assert (nd == n1);
}
开发者ID:austinsc,项目名称:Poco,代码行数:96,代码来源:CoreTest.cpp


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