本文整理汇总了C++中CVariant::GetString方法的典型用法代码示例。如果您正苦于以下问题:C++ CVariant::GetString方法的具体用法?C++ CVariant::GetString怎么用?C++ CVariant::GetString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CVariant
的用法示例。
在下文中一共展示了CVariant::GetString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
bool operator==(const CVariant& v1, const CVariant& v2)
{
bool less = false;
if( v1.IsNull() || v2.IsNull() ) {
less = v1.IsNull() && !v2.IsNull();
}
else {
if( v1.GetType() != v2.GetType() ) {
NCBI_THROW(CVariantException, eVariant, "Cannot compare different types");
}
switch( v1.GetType() ) {
case eDB_Char:
case eDB_VarChar:
case eDB_LongChar:
case eDB_Binary:
case eDB_VarBinary:
less = v1.GetString() == v2.GetString();
break;
case eDB_Bit:
less = v1.GetBit() == v2.GetBit();
break;
case eDB_TinyInt:
less = v1.GetByte() == v2.GetByte();
break;
case eDB_SmallInt:
less = v1.GetInt2() == v2.GetInt2();
break;
case eDB_Int:
less = v1.GetInt4() == v2.GetInt4();
break;
case eDB_BigInt:
less = v1.GetInt8() == v2.GetInt8();
break;
case eDB_Float:
less = v1.GetFloat() == v2.GetFloat();
break;
case eDB_Double:
less = v1.GetDouble() == v2.GetDouble();
break;
case eDB_DateTime:
case eDB_SmallDateTime:
less = v1.GetCTime() == v2.GetCTime();
break;
default:
NCBI_THROW(CVariantException, eVariant, "Type not supported");
}
}
return less;
}
示例2: TestString
void CTestSuiteVariant::TestString()
{
CVariant String;
String.SetString("hello");
CPPUNIT_ASSERT_EQUAL( 0,strcmp("hello",String.GetString()) );
String.SetString("olleh");
CPPUNIT_ASSERT_EQUAL( 0,strcmp("olleh",String.GetString()) );
CVariant String2;
String2.SetString("olleh");
CPPUNIT_ASSERT_EQUAL( 0,strcmp("olleh",String2.GetString()) );
CVariant String3;
String3.SetNumber<int32>(1);
String3.SetString("olleh");
CPPUNIT_ASSERT_EQUAL( 0,strcmp("olleh",String3.GetString()) );
}
示例3: TestDoubleException
void CTestSuiteVariant::TestDoubleException()
{
CVariant Double;
Double.SetNumber<double>(1.0);
Double.GetString();
}
示例4: TestFloatException
void CTestSuiteVariant::TestFloatException()
{
CVariant Float;
Float.SetNumber<float>(1.0f);
Float.GetString();
}