shirro 发表于 2013-11-8 19:49:59

osgDB::BEGIN_BRACKET

请问osgDB::BEGIN_BRACKET是哪个版本的osg中osgDB库中包含的?

shirro 发表于 2013-11-8 19:53:52

In ascii mode, such an output:
os << osgDB::PROPERTY("Account") << osgDB::BEGIN_BRACKET << std::endl;
os << osgDB::PROPERTY("ID") << (int)1 << std::endl;
os << osgDB::PROPERTY("Name"); os.writeWrappedString("Wang Rui"); os << std::endl;
os << osgDB::PROPERTY("Salary") << (float)25.5 << std::endl;
os << osgDB::END_BRACKET << std::endl;

Will result in:
Account {
    ID 1
    Name "Wang Rui"
    Salary 25.5
}

And to read the information back, just invert the operators and omit the endl symbol:
std::string name; int id; float salary;
is >> osgDB::PROPERTY("Account") >> osgDB::BEGIN_BRACKET;
is >> osgDB::PROPERTY("ID") >> id;
is >> osgDB::PROPERTY("Name"); is.readWrappedString(name);
is >> osgDB::PROPERTY("Salary") >> salary;
is >> osgDB::END_BRACKET;

起到输入输出作用?

shirro 发表于 2013-11-8 19:59:49

osgDB::InputStream中有具体定义,看了一下:
// Property & mask variables
    ObjectProperty PROPERTY;
    ObjectMark BEGIN_BRACKET;
    ObjectMark END_BRACKET;

shirro 发表于 2013-11-8 20:54:28

用is.BEGIN_BRACKET或者 os.BEGIN_BRACKET解决

亦舒雪 发表于 2013-11-19 10:01:41

:)

亦舒雪 发表于 2013-11-19 10:02:04

osg3.2版本便编译没问题……
页: [1]
查看完整版本: osgDB::BEGIN_BRACKET