本文整理汇总了C++中CDatum::GetKey方法的典型用法代码示例。如果您正苦于以下问题:C++ CDatum::GetKey方法的具体用法?C++ CDatum::GetKey怎么用?C++ CDatum::GetKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDatum
的用法示例。
在下文中一共展示了CDatum::GetKey方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateSecondaryData
void CAeonView::CreateSecondaryData (const CTableDimensions &PrimaryDims, const CRowKey &PrimaryKey, CDatum dFullData, SEQUENCENUMBER RowID, CDatum *retdData)
// CreateSecondaryData
//
// Creates the data for a secondary view row.
{
int i, j;
CComplexStruct *pData = new CComplexStruct;
// If the list of columns is empty then we just add the primary key
if (m_Columns.GetCount() == 0)
pData->SetElement(FIELD_PRIMARY_KEY, PrimaryKey.AsDatum(PrimaryDims));
// Otherwise we add all the fields listed in the columns array
else
{
for (i = 0; i < m_Columns.GetCount(); i++)
{
// The special string "primaryKey" means that we insert the
// primary key as a special field.
if (strEquals(m_Columns[i], FIELD_PRIMARY_KEY))
pData->SetElement(FIELD_PRIMARY_KEY, PrimaryKey.AsDatum(PrimaryDims));
// The special string "*" means that we insert all existing
// fields.
else if (strEquals(m_Columns[i], STR_ALL_COLUMNS))
{
for (j = 0; j < dFullData.GetCount(); j++)
{
CDatum dKey = dFullData.GetKey(j);
CDatum dValue = dFullData.GetElement(j);
if (!dValue.IsNil())
pData->SetElement(dKey, dValue);
}
}
// Add the field by name.
else
{
CDatum dColData = dFullData.GetElement(m_Columns[i]);
if (!dColData.IsNil())
pData->SetElement(m_Columns[i], dColData);
}
}
}
// Done
*retdData = CDatum(pData);
}
示例2: DeserializeAEONScript
bool IComplexDatum::DeserializeAEONScript (CDatum::ESerializationFormats iFormat, const CString &sTypename, CCharStream *pStream)
// DeserializeAEONScript
//
// Deserialize AEONScript
{
int i;
DWORD dwFlags = OnGetSerializeFlags();
// If we have an open brace then we've stored everything as a structure.
if (pStream->GetChar() == '{')
{
// Object must support this
if (!(dwFlags & FLAG_SERIALIZE_AS_STRUCT))
return false;
// Parse the structure
CAEONScriptParser Parser(pStream);
CDatum dData;
CAEONScriptParser::ETokens iToken = Parser.ParseToken(&dData);
if (iToken != CAEONScriptParser::tkDatum)
return false;
// Take all the fields in the structure and apply them to our object
// (our descendants will do the right thing).
for (i = 0; i < dData.GetCount(); i++)
SetElement(dData.GetKey(i), dData.GetElement(i));
}
// Otherwise we expect base64 encoded data
else
{
// Backup one character because we want the OnDeserialize call to read it.
pStream->UnreadChar();
// Deserialize
CBase64Decoder Decoder(pStream->GetByteStream());
if (!OnDeserialize(iFormat, sTypename, Decoder))
return false;
// Read the next character into the stream
pStream->RefreshStream();
pStream->ReadChar();
}
return true;
}
示例3:
CComplexStruct::CComplexStruct (CDatum dSrc)
// CComplexStruct constructor
{
// Clone from another complex structure
for (int i = 0; i < dSrc.GetCount(); i++)
{
CString sKey = dSrc.GetKey(i);
if (!sKey.IsEmpty())
SetElement(sKey, dSrc.GetElement(i));
}
}
示例4: CreateSanitizedUserRecord
CDatum CUserInfoSession::CreateSanitizedUserRecord (CDatum dRecord)
// CreateSanitizedUserRecord
//
// Creates a user record suitable for returning to clients. In partincular,
// we remove the authentication information.
{
int i;
// Create a destination
CComplexStruct *pDest = new CComplexStruct;
// Copy all appropriate fields
for (i = 0; i < dRecord.GetCount(); i++)
{
// If this is an auth field, then skip it
if (strEquals(dRecord.GetKey(i), FIELD_AUTH_DESC))
;
else if (strEndsWith(dRecord.GetKey(i), FIELD_AUTH_DESC_SUFFIX))
;
// Otherwise, copy it
else
pDest->SetElement(dRecord.GetKey(i), dRecord.GetElement(i));
}
// Done
return CDatum(pDest);
}
示例5: AppendStruct
void CComplexStruct::AppendStruct (CDatum dDatum)
// AppendStruct
//
// Appends the element of the given structure
{
int i;
if (dDatum.GetBasicType() == CDatum::typeStruct)
{
for (i = 0; i < dDatum.GetCount(); i++)
SetElement(dDatum.GetKey(i), dDatum.GetElement(i));
}
}
示例6: DefaultCompare
int CDatum::DefaultCompare (void *pCtx, const CDatum &dKey1, const CDatum &dKey2)
// DefaultCompare
//
// Default comparison routine used for sorting. Returns:
//
// -1: If dKey1 < dKey2
// 0: If dKey1 == dKey2
// 1: If dKey1 > dKey2
//
// NOTES:
//
// Nil == ""
// Nil == {}
// Nil == ()
// "abc" != "ABC"
{
int i;
// If both are the same datatype, then compare
CDatum::Types iType1 = dKey1.GetBasicType();
CDatum::Types iType2 = dKey2.GetBasicType();
// If both types are equal, then compare
if (iType1 == iType2)
{
switch (iType1)
{
case CDatum::typeNil:
case CDatum::typeTrue:
return 0;
case CDatum::typeInteger32:
if ((int)dKey1 > (int)dKey2)
return 1;
else if ((int)dKey1 < (int)dKey2)
return -1;
else
return 0;
case CDatum::typeInteger64:
if ((DWORDLONG)dKey1 > (DWORDLONG)dKey2)
return 1;
else if ((DWORDLONG)dKey1 < (DWORDLONG)dKey2)
return -1;
else
return 0;
case CDatum::typeDouble:
if ((double)dKey1 > (double)dKey2)
return 1;
else if ((double)dKey1 < (double)dKey2)
return -1;
else
return 0;
case CDatum::typeIntegerIP:
return KeyCompare((const CIPInteger &)dKey1, (const CIPInteger &)dKey2);
case CDatum::typeString:
return KeyCompare((const CString &)dKey1, (const CString &)dKey2);
case CDatum::typeDateTime:
return ((const CDateTime &)dKey1).Compare((const CDateTime &)dKey2);
case CDatum::typeArray:
if (dKey1.GetCount() > dKey2.GetCount())
return 1;
else if (dKey1.GetCount() < dKey2.GetCount())
return -1;
else
{
for (i = 0; i < dKey1.GetCount(); i++)
{
CDatum dItem1 = dKey1.GetElement(i);
CDatum dItem2 = dKey2.GetElement(i);
int iItemCompare = CDatum::DefaultCompare(pCtx, dItem1, dItem2);
if (iItemCompare != 0)
return iItemCompare;
}
return 0;
}
case CDatum::typeStruct:
if (dKey1.GetCount() > dKey2.GetCount())
return 1;
else if (dKey1.GetCount() < dKey2.GetCount())
return -1;
else
{
for (i = 0; i < dKey1.GetCount(); i++)
{
CString sItemKey1 = dKey1.GetKey(i);
CString sItemKey2 = dKey2.GetKey(i);
int iKeyCompare = KeyCompare(sItemKey1, sItemKey2);
if (iKeyCompare != 0)
//.........这里部分代码省略.........