本文整理汇总了C++中trpgReadBuffer::PopLimit方法的典型用法代码示例。如果您正苦于以下问题:C++ trpgReadBuffer::PopLimit方法的具体用法?C++ trpgReadBuffer::PopLimit怎么用?C++ trpgReadBuffer::PopLimit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类trpgReadBuffer
的用法示例。
在下文中一共展示了trpgReadBuffer::PopLimit方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Read
bool trpgLightTable::Read(trpgReadBuffer &buf)
{
int32 numLights;
trpgToken lightTok;
int32 len;
try {
buf.Get(numLights);
for (int i=0;i<numLights;i++) {
buf.GetToken(lightTok,len);
if (lightTok != TRPGLIGHTATTR) throw 1;
buf.PushLimit(len);
trpgLightAttr light;// = lightList[i];
bool status = light.Read(buf);
buf.PopLimit();
if (!status) throw 1;
AddLightAttr(light);
}
}
catch (...) {
return false;
}
return true;
}
示例2: Read
bool trpgRangeTable::Read(trpgReadBuffer &buf)
{
int32 numRange;
trpgToken tok;
int32 len;
valid = false;
try {
buf.Get(numRange);
if (numRange < 0) throw 1;
for (int i=0;i<numRange;i++) {
// Read in the individual range
buf.GetToken(tok,len);
if (tok != TRPG_RANGE) throw 1;
buf.PushLimit(len);
trpgRange range;
bool status = range.Read(buf);
buf.PopLimit();
if (!status) throw 1;
AddRange(range);
}
valid = true;
}
catch (...) {
return false;
}
return isValid();
}
示例3: Read
bool trpgSupportStyleTable::Read(trpgReadBuffer &buf)
{
trpgSupportStyle style;
trpgToken styleTok;
int32 len;
bool status;
int numStyle;
int i;
Reset();
try
{
buf.Get(numStyle);
if (numStyle < 0)
throw 1;
//styles.resize(numStyle);
for (i=0;i<numStyle;i++) {
buf.GetToken(styleTok,len);
if (styleTok != TRPG_SUPPORT_STYLE) throw 1;
buf.PushLimit(len);
style.Reset();
status = style.Read(buf);
buf.PopLimit();
if (!status) throw 1;
AddStyle(style);
}
}
catch (...)
{
return false;
}
return isValid();
}
示例4: Read
bool trpgMatTable::Read(trpgReadBuffer &buf)
{
trpgMaterial mat;
trpgToken matTok;
int32 len;
bool status;
int i,j;
int nMat,nTable;
try {
buf.Get(nTable);
buf.Get(nMat);
if (nTable <= 0 || nMat < 0) throw 1;
// Read the materials
for (i=0;i<nTable;i++)
for (j=0;j<nMat;j++) {
buf.GetToken(matTok,len);
if (matTok != TRPGMATERIAL) throw 1;
buf.PushLimit(len);
mat.Reset();
status = mat.Read(buf);
buf.PopLimit();
if (!status) throw 1;
AddMaterial(mat,false);
}
numTable += nTable;
numMat = materialMap.size();
}
catch (...) {
return false;
}
return isValid();
}
示例5: Read
bool trpgModelTable::Read(trpgReadBuffer &buf)
{
int32 numModel;
trpgToken tok;
int32 len;
bool status;
try {
buf.Get(numModel);
for (int i=0;i<numModel;i++) {
trpgModel model;
buf.GetToken(tok,len);
bool readHandle;
if (tok == TRPGMODELREF)
readHandle = false;
else if (tok == TRPGMODELREF2)
readHandle = true;
else
throw 1;
buf.PushLimit(len);
status = model.Read(buf,readHandle);
buf.PopLimit();
if (!status) throw 1;
AddModel(model);
}
}
catch (...) {
return false;
}
return isValid();
}
示例6: 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;
}