当前位置: 首页>>代码示例>>C++>>正文


C++ trpgReadBuffer::isEmpty方法代码示例

本文整理汇总了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();
}
开发者ID:BlitzMaxModules,项目名称:osg.mod,代码行数:27,代码来源:trpage_nodes.cpp

示例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();
}
开发者ID:BlitzMaxModules,项目名称:osg.mod,代码行数:34,代码来源:trpage_material.cpp

示例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;
}
开发者ID:yueying,项目名称:osg,代码行数:70,代码来源:trpage_parse.cpp


注:本文中的trpgReadBuffer::isEmpty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。