本文整理汇总了C++中trpgReadBuffer::isEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ trpgReadBuffer::isEmpty方法的具体用法?C++ trpgReadBuffer::isEmpty怎么用?C++ trpgReadBuffer::isEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类trpgReadBuffer
的用法示例。
在下文中一共展示了trpgReadBuffer::isEmpty方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Read
// Read in LOD
bool trpgLod::Read(trpgReadBuffer &buf)
{
try {
buf.Get(id);
buf.Get(numRange);
if (numRange < 0) throw 1;
buf.Get(center);
buf.Get(switchIn);
buf.Get(switchOut);
buf.Get(width);
if ( !buf.isEmpty() ) {
char nm[1024] = {0};
buf.Get(nm,1024);
if (*nm)
SetName(nm);
// Look for a range index
if (!buf.isEmpty())
buf.Get(rangeIndex);
}
}
catch (...) {
return false;
}
return isValid();
}
示例2: Read
bool trpgLocalMaterial::Read(trpgReadBuffer &buf)
{
try {
buf.Get(baseMatTable);
buf.Get(baseMat);
buf.Get(sx);
buf.Get(sy);
buf.Get(ex);
buf.Get(ey);
buf.Get(destWidth);
buf.Get(destHeight);
buf.Get(addr[0].file);
buf.Get(addr[0].offset);
if ( !buf.isEmpty() ) {
// there might be more
int extraAddrs;
buf.Get(extraAddrs);
if (extraAddrs!=0) {
addr.resize(extraAddrs+1);
for (int i=1;i<=extraAddrs;i++) {
buf.Get(addr[i].file);
buf.Get(addr[i].offset);
addr[i].col = -1;
addr[i].row = -1;
}
}
}
}
catch (...) {
return false;
}
return isValid();
}
示例3: Parse
/* Parse Buffer
This runs through the given buffer parsing token sets until
it (1) runs out of buffer or (2) fails.
Note: Good place to return an exception, but keep it simple for now.
*/
bool trpgr_Parser::Parse(trpgReadBuffer &buf)
{
bool ret = true;
try
{
while (!buf.isEmpty())
{
/* We're expecting the following
Token (int32)
Length (int32)
Data (variable)
*/
trpgToken tok;
int32 len;
if (!buf.Get(tok)) throw 1;
// Push and Pop are special - no data
if (tok != TRPG_PUSH && tok != TRPG_POP)
{
if (!buf.Get(len)) throw 1;
if (!TokenIsValid(tok)) throw 1;
if (len < 0) throw 1;
// Limit what we're reading to the length of this
buf.PushLimit(len);
}
// Call our token handler for this one
try
{
const trpgr_Token *tcb = NULL;
tok_map::const_iterator p = tokenMap.find(tok);
if (p != tokenMap.end())
tcb = &(*p).second;
if (!tcb)
// No such token, call the default
tcb = &defCb;
// Run the callback
if (tcb->cb)
{
void *ret = tcb->cb->Parse(tok,buf);
// Note: Do something with the return value
lastObject = ret;
}
}
catch (...)
{
// Don't want to screw up the limit stack
}
// No limit to worry about with push and pop
if (tok != TRPG_PUSH && tok != TRPG_POP)
{
buf.SkipToLimit();
buf.PopLimit();
}
}
}
catch (...)
{
// Failed to parse.
ret = false;
}
return ret;
}