本文整理汇总了C++中XMLAttributes::GetValue方法的典型用法代码示例。如果您正苦于以下问题:C++ XMLAttributes::GetValue方法的具体用法?C++ XMLAttributes::GetValue怎么用?C++ XMLAttributes::GetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XMLAttributes
的用法示例。
在下文中一共展示了XMLAttributes::GetValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: beginElement
virtual void beginElement(const string &name,const XMLAttributes &atts)
{
if (name == "description")
{
font->name = atts.GetValue("family");
}
else if (name == "metrics")
{
font->height = atoi(atts.GetValue("height").c_str());
font->ascender = atoi(atts.GetValue("ascender").c_str());
font->descender = atoi(atts.GetValue("descender").c_str());
}
else if (name == "texture")
{
font->imgfile = atts.GetValue("file");
font->imgw = atoi(atts.GetValue("width").c_str());
font->imgh = atoi(atts.GetValue("height").c_str());
}
else if (name == "padding")
{
font->padl = atoi(atts.GetValue("left").c_str());
font->padt = atoi(atts.GetValue("top").c_str());
font->padr = atoi(atts.GetValue("right").c_str());
font->padb = atoi(atts.GetValue("bottom").c_str());
}
else if (name == "char")
{
eavlBitmapFont::Character c;
c.id = atts.GetValue("id");
c.c = char(c.id[0]);
if (c.id.length() == 1)
{
font->shortmap[(int)(unsigned char)(c.c)] = font->chars.size();
}
c.offx = atoi(atts.GetValue("offset_x").c_str());
c.offy = atoi(atts.GetValue("offset_y").c_str());
c.x = atoi(atts.GetValue("rect_x").c_str());
c.y = atoi(atts.GetValue("rect_y").c_str());
c.w = atoi(atts.GetValue("rect_w").c_str());
c.h = atoi(atts.GetValue("rect_h").c_str());
c.adv = atoi(atts.GetValue("advance").c_str());
font->chars.push_back(c);
}
else if (name == "kerning")
{
// we should now be parsing a character which has just
// been added to the end of the list in the font
eavlBitmapFont::Character &c = font->chars[font->chars.size()-1];
string s = atts.GetValue("id");
char shortid = char(s[0]);
if (s.length() == 1)
{
c.kern[(int)(unsigned char)(shortid)] = atoi(atts.GetValue("advance").c_str());
//cerr << "c.c="<<c.c<<" id="<<shortid<<" kern="<<c.kern[(int)(unsigned char)(shortid)]<<endl;
}
}
}