本文整理汇总了C++中ReadObject函数的典型用法代码示例。如果您正苦于以下问题:C++ ReadObject函数的具体用法?C++ ReadObject怎么用?C++ ReadObject使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ReadObject函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadShorts
void DiMotionSerializerImpl::ReadAttachNodes( DiDataStreamPtr& stream,DiAttachSet* attachset )
{
uint16 numAttaches;
ReadShorts(stream,&numAttaches,1);
for (size_t i = 0; i < numAttaches; ++i)
{
DiString name = ReadString(stream);
DiVec3 position;
ReadObject(stream,position);
DiQuat quat;
ReadObject(stream,quat);
bool hasscale;
ReadBools(stream,&hasscale,1);
DiVec3 scale = DiVec3::UNIT_SCALE;
if (hasscale)
{
ReadObject(stream,scale);
}
DiAttachNode * pkAttachNode = attachset->CreateAttachNode(name);
pkAttachNode->SetPosition(position);
pkAttachNode->SetOrientation(quat);
if (hasscale)
{
pkAttachNode->SetScale(scale);
}
}
}
示例2: ReadString
void DiMotionSerializerImpl::ReadAttachClips( DiDataStreamPtr& stream, DiAnimation* motion )
{
DiString strName = ReadString(stream);
DiNodeClip* nodeClip = motion->CreateAttachClip(strName);
uint16 keyFrameNum = 0;
ReadShorts(stream,&keyFrameNum,1);
for (uint16 i = 0; i < keyFrameNum; ++i)
{
float time = 0;
ReadFloats(stream,&time, 1);
DiVec3 pos;
ReadObject(stream,pos);
DiQuat quat;
ReadObject(stream,quat);
bool hasScale = false;
ReadBools(stream,&hasScale,1);
DiVec3 scale = DiVec3::UNIT_SCALE;
if (hasScale)
{
ReadObject(stream,scale);
}
DiTransformKeyFrame* key = nodeClip->CreateNodeKeyFrame(time);
key->SetTranslate(pos);
key->SetRotation(quat);
key->SetScale(scale);
}
}
示例3: ReadHeader
// Parses the entire contents of an XNB file.
void ContentReader::ReadXnb()
{
// Read the XNB header.
uint32_t endPosition = ReadHeader();
ReadTypeManifest();
uint32_t sharedResourceCount = Read7BitEncodedInt();
// Read the primary asset data.
Log.WriteLine("Asset:");
ReadObject();
// Read any shared resource instances.
for (uint32_t i = 0 ; i < sharedResourceCount; i++)
{
Log.WriteLine("Shared resource %d:", i);
ReadObject();
}
// Make sure we read the amount of data that the file header said we should.
if (FilePosition() != endPosition)
{
throw app_exception("End position does not match XNB header: unexpected amount of data was read.");
}
}
示例4: SecurityRange
shared_ptr<SecurityRange>
PersistentSecurityRange::ReadMatchingIP(const IPAddress &ipaddress)
{
shared_ptr<SecurityRange> empty;
IPAddressSQLHelper helper;
String sSQL;
if (ipaddress.GetType() == IPAddress::IPV4)
{
shared_ptr<SecurityRange> pSR = shared_ptr<SecurityRange>(new SecurityRange());
sSQL.Format(_T("select * from hm_securityranges where %s >= rangelowerip1 and %s <= rangeupperip1 and rangelowerip2 IS NULL and rangeupperip2 IS NULL order by rangepriorityid desc"),
String(helper.GetAddress1String(ipaddress)), String(helper.GetAddress1String(ipaddress)));
if (!ReadObject(pSR, SQLCommand(sSQL)))
return empty;
return pSR;
}
else
{
// Read all IPv6 items.
shared_ptr<SecurityRange> bestMatch;
SQLCommand command(_T("select * from hm_securityranges where rangelowerip2 is not null order by rangepriorityid desc"));
shared_ptr<DALRecordset> recordset = Application::Instance()->GetDBManager()->OpenRecordset(command);
if (!recordset)
return empty;
while (!recordset->IsEOF())
{
shared_ptr<SecurityRange> securityRange = shared_ptr<SecurityRange>(new SecurityRange());
if (ReadObject(securityRange, recordset) == false)
return empty;
if (ipaddress.WithinRange(securityRange->GetLowerIP(), securityRange->GetUpperIP()))
{
// This IP range matches the client. Does it have higher prio than the currently
// matching?
if (!bestMatch || securityRange->GetPriority() > bestMatch->GetPriority())
bestMatch = securityRange;
}
recordset->MoveNext();
}
return bestMatch;
}
}
示例5: ReadFile
/// <summary>Reads all objects in the file</summary>
/// <returns></returns>
/// <exception cref="Logic::FileFormatException">File contains a syntax error</exception>
/// <exception cref="Logic::IOException">An I/O error occurred</exception>
TFilePtr ReadFile(MainType t, GameVersion v)
{
// Skip comments
while (ReadComment())
{}
// Parse header
int ver = ReadInt(L"File version");
int count = ReadInt(L"Number of objects");
// TODO: Validate version
// Create file
TFile<OBJ>* file = new TFile<OBJ>(count);
TFilePtr output(file);
// Parse objects
for (int i = 0; i < count; ++i)
{
OBJ obj(t);
// Read header/contents/footer
ReadHeader(obj);
ReadObject(obj, v);
ReadFooter(obj);
// Add to file
file->Objects.push_back(obj);
}
// Return non-generic file
return output;
}
示例6: io
static ZS_status_t
io()
{
ZS_status_t ret;
uint32_t wr_flags = 0;
uint32_t i = 0;
char key[256] = {'\0'};
char value[256] = {'\0'};
char *data = NULL;
uint64_t len = 0;
fprintf(fp,"****** io started ******\n");
fprintf(fp,"****** Writing objects *******\n");
for (i = 0; i < MAX_ITERATION; i++) {
snprintf(key, 255, "%s_%d", "key", i);
snprintf(value, 255, "%s_%d", "value", i);
if(ZS_SUCCESS == (ret = WriteObject(cguid, key, value, wr_flags)))
{
fprintf(fp,"write sucessful: key%s\n", key);
} else {
fprintf(fp,"write failed: key=%s error=%s\n", key, ZSStrError(ret));
goto exit_io;
}
/*
* Flush few object
*/
if (0 == (i % 2)) {
if(ZS_SUCCESS == (ret = FlushObject(cguid, key)))
{
fprintf(fp,"flush sucessful: key%s\n", key);
} else {
fprintf(fp,"flush failed: key=%s error=%s\n", key, ZSStrError(ret));
goto exit_io;
}
}
}
/*
* Issue read
*/
fprintf(fp,"****** Reading objects *******\n");
for (i = 0; i < MAX_ITERATION; i++) {
snprintf(key, 255, "%s_%d", "key", i);
if(ZS_SUCCESS == (ret = ReadObject(cguid, key, &data, &len)))
{
fprintf(fp,"read successful: key=%s data=%s\n", key, data);
} else {
fprintf(fp,"read failed: read key= %s error=%s\n", key, ZSStrError(ret));
goto exit_io;
}
}
exit_io:
return ret;
}
示例7: ReadToken
bool JsonString::ReadValue()
{
Token token;
ReadToken(token);
bool successful = true;
switch(token.type_)
{
case tokenObjectBegin:
objnum++;
successful = ReadObject(token);
break;
case tokenArrayBegin:
successful = ReadArray(token);
break;
case tokenNumber:
case tokenString:
case tokenTrue:
case tokenFalse:
case tokenNull:
break;
default:
return false;
}
return successful;
}
示例8: ReadMembers
void Stream::ReadMember(uint8* object, Type* pType)
{
Type_type kind = pType->get_Kind();
if (kind == type_class)
{
ReadMembers(object, static_cast<ClassType*>(pType));
}
else if (kind == type_pointer)
{
Type* pPointerTo = pType->GetPointerTo()->GetStripped();
if (pPointerTo->get_Kind() == type_class)
{
*(void**)object = ReadObject();
}
else
{
ASSERT(0);
}
}
else
{
Read(object, pType->get_sizeof());
}
}
示例9: Deserialize
void Deserialize(T& t, const char* key)
{
Document& doc = m_jsutil.GetDocument();
Value& jsonval = doc[key];
ReadObject(t, jsonval);
}
示例10: selectCommand
void
PersistentRule::DeleteByAccountID(__int64 iAccountID)
{
SQLCommand selectCommand("select * from hm_rules where ruleaccountid = @ACCOUNTID");
selectCommand.AddParameter("@ACCOUNTID", iAccountID);
shared_ptr<DALRecordset> pRS = Application::Instance()->GetDBManager()->OpenRecordset(selectCommand);
if (!pRS)
return ;
bool bRetVal = false;
while (!pRS->IsEOF())
{
// Create and read the fetch account.
shared_ptr<Rule> oRule = shared_ptr<Rule>(new Rule);
if (ReadObject(oRule, pRS))
{
// Delete this fetch account and all the
// UID's connected to it.
DeleteObject(oRule);
}
pRS->MoveNext();
}
// All the fetch accounts have been deleted.
}
示例11: selectCommand
bool
PersistentDistributionList::ReadObject(std::shared_ptr<DistributionList> pDistList, __int64 iID)
{
SQLCommand selectCommand("select * from hm_distributionlists where distributionlistid = @LISTID");
selectCommand.AddParameter("@LISTID", iID);
return ReadObject(pDistList, selectCommand);
}
示例12: command
bool
PersistentSecurityRange::ReadObject(shared_ptr<SecurityRange> pSR, __int64 lDBID)
{
SQLCommand command(_T("select * from hm_securityranges where rangeid = @RANGEID"));
command.AddParameter("@RANGEID", lDBID);
return ReadObject(pSR, command);
}
示例13: GetLongValue
bool EditorConfig::GetLongValue(const wxString& name, long& value)
{
SimpleLongValue data;
if(ReadObject(name, &data)) {
value = data.GetValue();
return true;
}
return false;
}
示例14: _CHECK_IO
bool SQFunctionProto::Load(SQVM *v,SQUserPointer up,SQREADFUNC read)
{
SQInteger i, nsize = _literals.size();
SQObjectPtr o;
_CHECK_IO(CheckTag(v,read,up,SQ_CLOSURESTREAM_PART));
_CHECK_IO(ReadObject(v, up, read, _sourcename));
_CHECK_IO(ReadObject(v, up, read, _name));
_CHECK_IO(CheckTag(v,read,up,SQ_CLOSURESTREAM_PART));
_CHECK_IO(SafeRead(v,read,up, &nsize, sizeof(nsize)));
for(i = 0;i < nsize; i++){
_CHECK_IO(ReadObject(v, up, read, o));
_literals.push_back(o);
}
_CHECK_IO(CheckTag(v,read,up,SQ_CLOSURESTREAM_PART));
_CHECK_IO(SafeRead(v,read,up, &nsize, sizeof(nsize)));
for(i = 0; i < nsize; i++){
_CHECK_IO(ReadObject(v, up, read, o));
_parameters.push_back(o);
}
_CHECK_IO(CheckTag(v,read,up,SQ_CLOSURESTREAM_PART));
_CHECK_IO(SafeRead(v,read,up,&nsize,sizeof(nsize)));
for(i = 0; i < nsize; i++){
SQUnsignedInteger type;
SQObjectPtr name;
_CHECK_IO(SafeRead(v,read,up, &type, sizeof(SQUnsignedInteger)));
_CHECK_IO(ReadObject(v, up, read, o));
_CHECK_IO(ReadObject(v, up, read, name));
_outervalues.push_back(SQOuterVar(name,o, (SQOuterType)type));
}
_CHECK_IO(CheckTag(v,read,up,SQ_CLOSURESTREAM_PART));
_CHECK_IO(SafeRead(v,read,up,&nsize, sizeof(nsize)));
for(i = 0; i < nsize; i++){
SQLocalVarInfo lvi;
_CHECK_IO(ReadObject(v, up, read, lvi._name));
_CHECK_IO(SafeRead(v,read,up, &lvi._pos, sizeof(SQUnsignedInteger)));
_CHECK_IO(SafeRead(v,read,up, &lvi._start_op, sizeof(SQUnsignedInteger)));
_CHECK_IO(SafeRead(v,read,up, &lvi._end_op, sizeof(SQUnsignedInteger)));
_localvarinfos.push_back(lvi);
}
_CHECK_IO(CheckTag(v,read,up,SQ_CLOSURESTREAM_PART));
_CHECK_IO(SafeRead(v,read,up, &nsize,sizeof(nsize)));
_lineinfos.resize(nsize);
_CHECK_IO(SafeRead(v,read,up, &_lineinfos[0], sizeof(SQLineInfo)*nsize));
_CHECK_IO(CheckTag(v,read,up,SQ_CLOSURESTREAM_PART));
_CHECK_IO(SafeRead(v,read,up, &nsize, sizeof(nsize)));
_instructions.resize(nsize);
_CHECK_IO(SafeRead(v,read,up, &_instructions[0], sizeof(SQInstruction)*nsize));
_CHECK_IO(CheckTag(v,read,up,SQ_CLOSURESTREAM_PART));
_CHECK_IO(SafeRead(v,read,up, &nsize, sizeof(nsize)));
for(i = 0; i < nsize; i++){
o = SQFunctionProto::Create();
_CHECK_IO(_funcproto(o)->Load(v, up, read));
_functions.push_back(o);
}
_CHECK_IO(SafeRead(v,read,up, &_stacksize, sizeof(_stacksize)));
_CHECK_IO(SafeRead(v,read,up, &_bgenerator, sizeof(_bgenerator)));
_CHECK_IO(SafeRead(v,read,up, &_varparams, sizeof(_varparams)));
return true;
}
示例15: command
bool
PersistentAlias::ReadObject(std::shared_ptr<Alias> pAccount, __int64 ObjectID)
{
SQLCommand command("select * from hm_aliases where aliasid = @ALIASID");
command.AddParameter("@ALIASID", ObjectID);
bool bResult = ReadObject(pAccount, command);
return bResult;
}