本文整理汇总了C++中XmlReader类的典型用法代码示例。如果您正苦于以下问题:C++ XmlReader类的具体用法?C++ XmlReader怎么用?C++ XmlReader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了XmlReader类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: read
void Hairpin::read(XmlReader& e)
{
foreach(SpannerSegment* seg, spannerSegments())
delete seg;
spannerSegments().clear();
int id = e.intAttribute("id", -1);
e.addSpanner(id, this);
while (e.readNextStartElement()) {
const QStringRef& tag(e.name());
if (tag == "subtype")
_hairpinType = Type(e.readInt());
else if (tag == "lineWidth") {
setLineWidth(Spatium(e.readDouble()));
lineWidthStyle = PropertyStyle::UNSTYLED;
}
else if (tag == "hairpinHeight") {
setHairpinHeight(Spatium(e.readDouble()));
hairpinHeightStyle = PropertyStyle::UNSTYLED;
}
else if (tag == "hairpinContHeight") {
setHairpinContHeight(Spatium(e.readDouble()));
hairpinContHeightStyle = PropertyStyle::UNSTYLED;
}
else if (tag == "hairpinCircledTip")
_hairpinCircledTip = e.readInt();
else if (tag == "veloChange")
_veloChange = e.readInt();
else if (tag == "dynType")
_dynRange = Dynamic::Range(e.readInt());
else if (tag == "useTextLine")
_useTextLine = e.readInt();
else if (!TextLine::readProperties(e))
e.unknown();
}
}
开发者ID:thaddeus-loke,项目名称:MuseScore,代码行数:37,代码来源:hairpin.cpp
示例2: read
bool TablatureFretFont::read(XmlReader& e)
{
defPitch = 9.0;
defYOffset = 0.0;
while (e.readNextStartElement()) {
const QStringRef& tag(e.name());
int val = e.intAttribute("value");
if (tag == "family")
family = e.readElementText();
else if (tag == "displayName")
displayName = e.readElementText();
else if (tag == "defaultPitch")
defPitch = e.readDouble();
else if (tag == "defaultYOffset")
defYOffset = e.readDouble();
else if (tag == "mark") {
QString val = e.attribute("value");
QString txt(e.readElementText());
if (val.size() < 1)
return false;
if (val == "x")
xChar = txt[0];
else if (val == "ghost")
ghostChar = txt[0];
}
else if (tag == "fret") {
bool bLetter = e.intAttribute("letter");
QString txt(e.readElementText());
if (bLetter) {
if (val >= 0 && val < NUM_OF_LETTERFRETS)
displayLetter[val] = txt[0];
}
else {
if (val >= 0 && val < NUM_OF_DIGITFRETS)
displayDigit[val] = txt;
}
}
else {
e.unknown();
return false;
}
}
return true;
}
开发者ID:flelax,项目名称:MuseScore,代码行数:46,代码来源:stafftype.cpp
示例3: read
void Hairpin::read(XmlReader& e)
{
foreach(SpannerSegment* seg, spannerSegments())
delete seg;
spannerSegments().clear();
int id = e.intAttribute("id", -1);
e.addSpanner(id, this);
while (e.readNextStartElement()) {
const QStringRef& tag(e.name());
if (tag == "subtype")
_hairpinType = Type(e.readInt());
else if (tag == "lineWidth") {
setLineWidth(Spatium(e.readDouble()));
lineWidthStyle = PropertyStyle::UNSTYLED;
}
else if (tag == "hairpinHeight") {
setHairpinHeight(Spatium(e.readDouble()));
hairpinHeightStyle = PropertyStyle::UNSTYLED;
}
else if (tag == "hairpinContHeight") {
setHairpinContHeight(Spatium(e.readDouble()));
hairpinContHeightStyle = PropertyStyle::UNSTYLED;
}
else if (tag == "hairpinCircledTip")
_hairpinCircledTip = e.readInt();
else if (tag == "veloChange")
_veloChange = e.readInt();
else if (tag == "dynType")
_dynRange = Dynamic::Range(e.readInt());
else if (tag == "useTextLine")
_useTextLine = e.readInt();
else if (!TextLine::readProperties(e))
e.unknown();
}
// add default text to legacy hairpins
if (score()->mscVersion() <= 206 && !_useTextLine) {
bool cresc = _hairpinType == Hairpin::Type::CRESCENDO;
if (!_beginText)
setBeginText(cresc ? "cresc." : "dim.");
if (!_continueText)
setContinueText(cresc ? "(cresc.)" : "(dim.)");
}
}
开发者ID:HerbertYu,项目名称:MuseScore,代码行数:47,代码来源:hairpin.cpp
示例4: WrapperXmlHandler
void RawStruct<RPG::Parameters>::BeginXml(RPG::Parameters& ref, XmlReader& stream) {
stream.SetHandler(new WrapperXmlHandler("Parameters", new ParametersXmlHandler(ref)));
}
开发者ID:ChrisOelmueller,项目名称:Readers,代码行数:3,代码来源:ldb_parameters.cpp
示例5: iter
void
Button::parse(XmlReader& reader)
{
// parse xml attributes
XmlReader::AttributeIterator iter(reader);
while(iter.next()) {
const char* attribute = (const char*) iter.getName();
const char* value = (const char*) iter.getValue();
if(parseAttribute(attribute, value)) {
continue;
} else if(strcmp(attribute, "width") == 0) {
if(sscanf(value, "%f", &fixWidth) != 1) {
std::stringstream msg;
msg << "Couldn't parse width '" << value << "'.";
throw std::runtime_error(msg.str());
}
} else if(strcmp(attribute, "height") == 0) {
if(sscanf(value, "%f", &fixHeight) != 1) {
std::stringstream msg;
msg << "Couldn't parse height '" << value << "'.";
throw std::runtime_error(msg.str());
}
} else if(strcmp(attribute, "lower") == 0) {
lowerOnClick=true;
} else if(strcmp(attribute, "direction") == 0) {
// skip
} else {
std::cerr << "Skipping unknown attribute '"
<< attribute << "'.\n";
}
}
// we need 4 child components
childs.assign(4, Child());
// parse contents of the xml-element
bool parseTooltip = false;
int depth = reader.getDepth();
fixWidth = -1;
fixHeight = -1;
while(reader.read() && reader.getDepth() > depth) {
if(reader.getNodeType() == XML_READER_TYPE_ELEMENT) {
std::string element = (const char*) reader.getName();
if(element == "image") {
if(comp_normal().getComponent() != 0)
std::cerr << "Warning: more than 1 component for state "
"comp_normal defined.\n";
setChildImage(comp_normal(), reader);
} else if(element == "text") {
if(comp_normal().getComponent() != 0)
std::cerr << "Warning: more than 1 component for state "
"comp_normal defined.\n";
setChildText(comp_normal(), reader);
} else if(element == "image-hover") {
if(comp_hover().getComponent() != 0)
std::cerr << "Warning: more than 1 component for state "
"comp_hover defined.\n";
setChildImage(comp_hover(), reader);
} else if(element == "text-hover") {
if(comp_hover().getComponent() != 0)
std::cerr << "Warning: more than 1 component for state "
"comp_hover defined.\n";
setChildText(comp_hover(), reader);
} else if(element == "image-clicked") {
if(comp_clicked().getComponent() != 0)
std::cerr << "Warning: more than 1 component for state "
"comp_clicked defined.\n";
setChildImage(comp_clicked(), reader);
} else if(element == "text-clicked") {
if(comp_clicked().getComponent() != 0)
std::cerr << "Warning: more than 1 component for state "
"comp_clicked defined.\n";
setChildText(comp_clicked(), reader);
} else if(element == "image-caption") {
if(comp_caption().getComponent() != 0)
std::cerr << "Warning: more than 1 component for comp_caption "
"defined.\n";
setChildImage(comp_caption(), reader);
} else if(element == "text-caption") {
if(comp_caption().getComponent() != 0)
std::cerr << "Warning: more than 1 component for comp_caption "
"defined.\n";
setChildText(comp_caption(), reader);
} else if (element == "tooltip") {
parseTooltip = true;
} else {
std::cerr << "Skipping unknown element '" << element << "'.\n";
}
} else if(reader.getNodeType() == XML_READER_TYPE_END_ELEMENT) {
std::string element = (const char*) reader.getName();
if(element == "tooltip")
parseTooltip = false;
} else if(reader.getNodeType() == XML_READER_TYPE_TEXT) {
if(!parseTooltip)
continue;
const char* p = (const char*) reader.getValue();
// skip trailing spaces
//.........这里部分代码省略.........
开发者ID:SirIvanMoReau,项目名称:lincity-ng,代码行数:101,代码来源:Button.cpp
示例6: File
void OgreImporter::LoadSkeleton(std::string FileName, vector<Bone> &Bones, vector<Animation> &Animations) const
{
//const aiScene* const m_CurrentScene=this->m_CurrentScene;//make sure, that we can access but not change the scene
//Unused..........
//most likely the skeleton file will only end with .skeleton
//But this is a xml reader, so we need: .skeleton.xml
FileName+=".xml";
DefaultLogger::get()->debug(string("Loading Skeleton: ")+FileName);
//Open the File:
boost::scoped_ptr<IOStream> File(m_CurrentIOHandler->Open(FileName));
if(NULL==File.get())
throw DeadlyImportError("Failed to open skeleton file "+FileName+".");
//Read the Mesh File:
boost::scoped_ptr<CIrrXML_IOStreamReader> mIOWrapper(new CIrrXML_IOStreamReader(File.get()));
XmlReader* SkeletonFile = irr::io::createIrrXMLReader(mIOWrapper.get());
if(!SkeletonFile)
throw DeadlyImportError(string("Failed to create XML Reader for ")+FileName);
//Quick note: Whoever read this should know this one thing: irrXml fucking sucks!!!
XmlRead(SkeletonFile);
if(string("skeleton")!=SkeletonFile->getNodeName())
throw DeadlyImportError("No <skeleton> node in SkeletonFile: "+FileName);
//------------------------------------load bones-----------------------------------------
XmlRead(SkeletonFile);
if(string("bones")!=SkeletonFile->getNodeName())
throw DeadlyImportError("No bones node in skeleton "+FileName);
XmlRead(SkeletonFile);
while(string("bone")==SkeletonFile->getNodeName())
{
//TODO: Maybe we can have bone ids for the errrors, but normaly, they should never appear, so what....
//read a new bone:
Bone NewBone;
NewBone.Id=GetAttribute<int>(SkeletonFile, "id");
NewBone.Name=GetAttribute<string>(SkeletonFile, "name");
//load the position:
XmlRead(SkeletonFile);
if(string("position")!=SkeletonFile->getNodeName())
throw DeadlyImportError("Position is not first node in Bone!");
NewBone.Position.x=GetAttribute<float>(SkeletonFile, "x");
NewBone.Position.y=GetAttribute<float>(SkeletonFile, "y");
NewBone.Position.z=GetAttribute<float>(SkeletonFile, "z");
//Rotation:
XmlRead(SkeletonFile);
if(string("rotation")!=SkeletonFile->getNodeName())
throw DeadlyImportError("Rotation is not the second node in Bone!");
NewBone.RotationAngle=GetAttribute<float>(SkeletonFile, "angle");
XmlRead(SkeletonFile);
if(string("axis")!=SkeletonFile->getNodeName())
throw DeadlyImportError("No axis specified for bone rotation!");
NewBone.RotationAxis.x=GetAttribute<float>(SkeletonFile, "x");
NewBone.RotationAxis.y=GetAttribute<float>(SkeletonFile, "y");
NewBone.RotationAxis.z=GetAttribute<float>(SkeletonFile, "z");
//append the newly loaded bone to the bone list
Bones.push_back(NewBone);
//Proceed to the next bone:
XmlRead(SkeletonFile);
}
//The bones in the file a not neccesarly ordered by there id's so we do it now:
std::sort(Bones.begin(), Bones.end());
//now the id of each bone should be equal to its position in the vector:
//so we do a simple check:
{
bool IdsOk=true;
for(int i=0; i<static_cast<signed int>(Bones.size()); ++i)//i is signed, because all Id's are also signed!
{
if(Bones[i].Id!=i)
IdsOk=false;
}
if(!IdsOk)
throw DeadlyImportError("Bone Ids are not valid!"+FileName);
}
DefaultLogger::get()->debug((Formatter::format(),"Number of bones: ",Bones.size()));
//________________________________________________________________________________
//----------------------------load bonehierarchy--------------------------------
if(string("bonehierarchy")!=SkeletonFile->getNodeName())
throw DeadlyImportError("no bonehierarchy node in "+FileName);
DefaultLogger::get()->debug("loading bonehierarchy...");
//.........这里部分代码省略.........
开发者ID:mdecicco,项目名称:HelloWorld,代码行数:101,代码来源:OgreImporter.cpp
示例7: loadFromXml
bool GenericDataTypeStruct::loadFromXml( const XmlReader& reader, const XmlElement* pTypeRoot )
{
if ( pTypeRoot == nullptr )
{
return false;
}
if ( !isStringEquals( pTypeRoot->name, "struct" ) )
{
TIKI_TRACE_ERROR( "[GenericDataStruct(%s)::readFromXml] node has a wrong tag('%s' != 'struct') \n", getName().cStr(), pTypeRoot->name );
return false;
}
const XmlElement* pChildElement = pTypeRoot->elements;
while ( pChildElement != nullptr )
{
const bool isField = isStringEquals( pChildElement->name, "field" );
const bool isValue = isStringEquals( pChildElement->name, "value" );
if ( isField || isValue )
{
const XmlAttribute* pNameAtt = reader.findAttributeByName( "name", pChildElement );
const XmlAttribute* pTypeAtt = reader.findAttributeByName( "type", pChildElement );
const XmlAttribute* pModeAtt = reader.findAttributeByName( "mode", pChildElement );
const XmlAttribute* pValueAtt = reader.findAttributeByName( "value", pChildElement );
if ( pNameAtt && pTypeAtt )
{
const GenericDataType* pType = m_collection.parseType( pTypeAtt->content );
if ( pType == nullptr )
{
TIKI_TRACE_WARNING( "[GenericDataStruct(%s)::readFromXml] Type(%s) for field with name '%s' can't be found.\n", getName().cStr(), pTypeAtt->content, pNameAtt->content );
return false;
}
GenericDataStructField* pValueField = nullptr;
const string fieldName = pNameAtt->content;
if ( isValue )
{
for (uint i = 0u; i < m_fields.getCount(); ++i)
{
GenericDataStructField& field = m_fields[ i ];
if ( field.name == fieldName )
{
pValueField = &field;
break;
}
}
if ( pValueField == nullptr )
{
TIKI_TRACE_ERROR( "[GenericDataStruct(%s)::readFromXml] field with name '%s' can't found in base class.\n", getName().cStr(), pNameAtt->content );
return false;
}
}
GenericDataStructField& field = (isValue ? *pValueField : m_fields.add());
if ( isField )
{
field.name = fieldName;
field.pType = pType;
field.defaultValue = GenericDataValue( pType );
field.mode = GenericDataTypeMode_ToolAndRuntime;
field.isInherited = false;
m_alignment = TIKI_MAX( m_alignment, field.pType->getAlignment() );
m_size = alignValue( m_size, field.pType->getAlignment() );
m_size = m_size + field.pType->getSize();
}
if ( isValue && field.pType != pType )
{
TIKI_TRACE_ERROR( "[GenericDataStruct(%s)::readFromXml] field with name '%s' must have the same type like in base class.\n", getName().cStr(), pNameAtt->content );
return false;
}
if ( pModeAtt != nullptr )
{
if ( !isValue )
{
GenericDataTypeMode mode = m_collection.findModeByName( pModeAtt->content );
if ( mode == GenericDataTypeMode_Invalid )
{
TIKI_TRACE_WARNING( "[GenericDataStruct(%s)::readFromXml] field with name '%s' has a invalid mode attribute. '%s' is not a valid mode.\n", getName().cStr(), pNameAtt->content, pModeAtt->content );
}
else
{
field.mode = mode;
}
}
else
{
TIKI_TRACE_WARNING( "[GenericDataStruct(%s)::readFromXml] can't override mode in value(%s).\n", getName().cStr(), pNameAtt->content );
}
}
if ( pValueAtt != nullptr )
{
if ( !m_collection.parseValue( field.defaultValue, pValueAtt->content, pType, this ) )
{
TIKI_TRACE_INFO( "[GenericDataStruct(%s)::readFromXml] default value of '%s' can't be parsed.\n", getName().cStr(), pNameAtt->content );
}
//.........这里部分代码省略.........
开发者ID:IreNox,项目名称:tiki3,代码行数:101,代码来源:genericdatatypestruct.cpp
示例8: readCapx
void CapKey::readCapx(XmlReader& e)
{
signature = e.intAttribute("fifths", 0);
qDebug("Key %d", signature);
e.readNext();
}
开发者ID:Tarkiyah,项目名称:MuseScore,代码行数:6,代码来源:capxml.cpp
示例9: readCapxNotes
void ChordObj::readCapxNotes(XmlReader& e)
{
while (e.readNextStartElement()) {
if (e.name() == "head") {
QString pitch = e.attribute("pitch");
QString sstep;
while (e.readNextStartElement()) {
const QStringRef& tag(e.name());
if (tag == "alter") {
sstep = e.attribute("step");
e.readNext();
}
else if (tag == "tie") {
rightTie = e.attribute("begin") == "true";
e.readNext();
}
else
e.unknown();
}
qDebug("ChordObj::readCapxNotes: pitch '%s' altstep '%s'",
qPrintable(pitch), qPrintable(sstep));
int istep = sstep.toInt();
CNote n;
n.pitch = pitchStr2Char(pitch);
n.explAlteration = 0;
n.headType = 0;
n.alteration = istep;
n.silent = 0;
notes.append(n);
}
else
e.unknown();
}
}
开发者ID:Tarkiyah,项目名称:MuseScore,代码行数:34,代码来源:capxml.cpp
示例10: getProperty
QVariant getProperty(P_ID id, XmlReader& e)
{
switch(propertyType(id)) {
case P_TYPE::BOOL:
return QVariant(bool(e.readInt()));
case P_TYPE::SUBTYPE:
case P_TYPE::INT:
return QVariant(e.readInt());
case P_TYPE::REAL:
case P_TYPE::SPATIUM:
case P_TYPE::SP_REAL:
case P_TYPE::TEMPO:
return QVariant(e.readDouble());
case P_TYPE::FRACTION:
return QVariant::fromValue(e.readFraction());
case P_TYPE::COLOR:
return QVariant(e.readColor());
case P_TYPE::POINT:
return QVariant(e.readPoint());
case P_TYPE::SCALE:
case P_TYPE::SIZE:
return QVariant(e.readSize());
case P_TYPE::STRING:
return QVariant(e.readElementText());
case P_TYPE::DIRECTION:
{
QString value(e.readElementText());
if (value == "up")
return QVariant(int(Direction::UP));
else if (value == "down")
return QVariant(int(Direction::DOWN));
else if (value == "auto")
return QVariant(int(Direction::AUTO));
}
break;
case P_TYPE::DIRECTION_H:
{
QString value(e.readElementText());
if (value == "left" || value == "1")
return QVariant(int(DirectionH::DH_LEFT));
else if (value == "right" || value == "2")
return QVariant(int(DirectionH::DH_RIGHT));
else if (value == "auto")
return QVariant(int(DirectionH::DH_AUTO));
}
break;
case P_TYPE::LAYOUT_BREAK: {
QString value(e.readElementText());
if (value == "line")
return QVariant(int(LayoutBreak::LayoutBreakType::LINE));
if (value == "page")
return QVariant(int(LayoutBreak::LayoutBreakType::PAGE));
if (value == "section")
return QVariant(int(LayoutBreak::LayoutBreakType::SECTION));
qDebug("getProperty: invalid P_TYPE::LAYOUT_BREAK: <%s>", qPrintable(value));
}
break;
case P_TYPE::VALUE_TYPE: {
QString value(e.readElementText());
if (value == "offset")
return QVariant(int(ValueType::OFFSET_VAL));
else if (value == "user")
return QVariant(int(ValueType::USER_VAL));
}
break;
case P_TYPE::PLACEMENT: {
QString value(e.readElementText());
if (value == "above")
return QVariant(int(Placement::ABOVE));
else if (value == "below")
return QVariant(int(Placement::BELOW));
}
break;
case P_TYPE::BEAM_MODE: // TODO
return QVariant(int(0));
case P_TYPE::GROUPS:
{
Groups g;
g.read(e);
return QVariant::fromValue(g);
}
case P_TYPE::POINT_MM:
case P_TYPE::SIZE_MM:
case P_TYPE::SYMID:
case P_TYPE::TEXT_STYLE:
return QVariant();
}
return QVariant();
}
开发者ID:WeiChou,项目名称:MuseScore,代码行数:90,代码来源:property.cpp
示例11: read
void PageFormat::read(XmlReader& e, Score* score)
{
qreal _oddRightMargin = 0.0;
qreal _evenRightMargin = 0.0;
bool landscape = false;
QString type;
while (e.readNextStartElement()) {
const QStringRef& tag(e.name());
if (tag == "pageFormat") // obsolete
setSize(getPaperSize(e.readElementText()));
else if (tag == "landscape") // obsolete
landscape = e.readInt();
else if (tag == "page-margins") {
type = e.attribute("type","both");
qreal lm = 0.0, rm = 0.0, tm = 0.0, bm = 0.0;
while (e.readNextStartElement()) {
const QStringRef& tag(e.name());
qreal val = e.readDouble() * 0.5 / PPI;
if (tag == "left-margin")
lm = val;
else if (tag == "right-margin")
rm = val;
else if (tag == "top-margin")
tm = val;
else if (tag == "bottom-margin")
bm = val;
else
e.unknown();
}
_twosided = type == "odd" || type == "even";
if (type == "odd" || type == "both") {
_oddLeftMargin = lm;
_oddRightMargin = rm;
_oddTopMargin = tm;
_oddBottomMargin = bm;
}
if (type == "even" || type == "both") {
_evenLeftMargin = lm;
_evenRightMargin = rm;
_evenTopMargin = tm;
_evenBottomMargin = bm;
}
}
else if (tag == "page-height")
_size.rheight() = e.readDouble() * 0.5 / PPI;
else if (tag == "page-width")
_size.rwidth() = e.readDouble() * .5 / PPI;
else if (tag == "page-offset") { // obsolete, moved to Score
QString val(e.readElementText());
if(score)
score->setPageNumberOffset(val.toInt());
}
else
e.unknown();
}
if (landscape)
_size.transpose();
qreal w1 = _size.width() - _oddLeftMargin - _oddRightMargin;
qreal w2 = _size.width() - _evenLeftMargin - _evenRightMargin;
_printableWidth = qMax(w1, w2); // silently adjust right margins
}
开发者ID:MatthewStein,项目名称:MuseScore,代码行数:62,代码来源:page.cpp
示例12: readProperties
bool TextLine::readProperties(XmlReader& e)
{
const QStringRef& tag(e.name());
if (tag == "beginHookHeight") {
_beginHookHeight = Spatium(e.readDouble());
_beginHook = true;
}
else if (tag == "beginHookType")
_beginHookType = HookType(e.readInt());
else if (tag == "endHookHeight" || tag == "hookHeight") { // hookHeight is obsolete
_endHookHeight = Spatium(e.readDouble());
_endHook = true;
}
else if (tag == "endHookType")
_endHookType = HookType(e.readInt());
else if (tag == "hookUp") // obsolete
_endHookHeight *= qreal(-1.0);
else if (tag == "beginSymbol" || tag == "symbol") { // "symbol" is obsolete
QString text(e.readElementText());
_beginSymbol = text[0].isNumber() ? SymId(text.toInt()) : Sym::name2id(text);
}
else if (tag == "continueSymbol") {
QString text(e.readElementText());
_continueSymbol = text[0].isNumber() ? SymId(text.toInt()) : Sym::name2id(text);
}
else if (tag == "endSymbol") {
QString text(e.readElementText());
_endSymbol = text[0].isNumber() ? SymId(text.toInt()) : Sym::name2id(text);
}
else if (tag == "beginSymbolOffset")
_beginSymbolOffset = e.readPoint();
else if (tag == "continueSymbolOffset")
_continueSymbolOffset = e.readPoint();
else if (tag == "endSymbolOffset")
_endSymbolOffset = e.readPoint();
else if (tag == "lineWidth")
_lineWidth = Spatium(e.readDouble());
else if (tag == "lineStyle")
_lineStyle = Qt::PenStyle(e.readInt());
else if (tag == "beginTextPlace")
_beginTextPlace = readPlacement(e);
else if (tag == "continueTextPlace")
_continueTextPlace = readPlacement(e);
else if (tag == "lineColor")
_lineColor = e.readColor();
else if (tag == "beginText") {
_beginText = new Text(score());
_beginText->setParent(this);
_beginText->read(e);
}
else if (tag == "continueText") {
_continueText = new Text(score());
_continueText->setParent(this);
_continueText->read(e);
}
else if (!SLine::readProperties(e)) {
qDebug(" ==readSLineProps: failed");
return false;
}
return true;
}
开发者ID:Isenbarth,项目名称:MuseScore,代码行数:62,代码来源:textline.cpp
示例13: if
QList<BasicDrawObj*> Capella::readCapxDrawObjectArray(XmlReader& e)
{
QList<BasicDrawObj*> ol;
while (e.readNextStartElement()) {
if (e.name() == "drawObj") {
BasicDrawObj* bdo = 0;
while (e.readNextStartElement()) {
const QStringRef& tag(e.name());
if (tag == "basic") {
// note: the <basic> element always follows the DrawObject it applies to
if (bdo)
bdo->readCapx(e);
else
e.skipCurrentElement();
}
else if (tag == "line") {
qDebug("readCapxDrawObjectArray: found line (skipping)");
e.skipCurrentElement();
}
else if (tag == "rectangle") {
qDebug("readCapxDrawObjectArray: found rectangle (skipping)");
e.skipCurrentElement();
}
else if (tag == "ellipse") {
qDebug("readCapxDrawObjectArray: found ellipse (skipping)");
e.skipCurrentElement();
}
else if (tag == "polygon") {
qDebug("readCapxDrawObjectArray: found polygon (skipping)");
e.skipCurrentElement();
}
else if (tag == "metafile") {
qDebug("readCapxDrawObjectArray: found metafile (skipping)");
e.skipCurrentElement();
}
else if (tag == "text") {
SimpleTextObj* o = new SimpleTextObj(this);
bdo = o; // save o to handle the "basic" tag (which sometimes follows)
o->readCapx(e);
ol.append(o);
}
else if (tag == "richText") {
qDebug("readCapxDrawObjectArray: found richText (skipping)");
e.skipCurrentElement();
}
else if (tag == "guitar") {
qDebug("readCapxDrawObjectArray: found guitar (skipping)");
e.skipCurrentElement();
}
else if (tag == "slur") {
SlurObj* o = new SlurObj(this);
bdo = o; // save o to handle the "basic" tag (which sometimes follows)
o->readCapx(e);
ol.append(o);
}
else if (tag == "wavyLine") {
qDebug("readCapxDrawObjectArray: found wavyLine (skipping)");
e.skipCurrentElement();
}
else if (tag == "bracket") {
qDebug("readCapxDrawObjectArray: found bracket (skipping)");
e.skipCurrentElement();
}
else if (tag == "wedge") {
WedgeObj* o = new WedgeObj(this);
bdo = o; // save o to handle the "basic" tag (which sometimes follows)
o->readCapx(e);
ol.append(o);
}
else if (tag == "notelines") {
qDebug("readCapxDrawObjectArray: found notelines (skipping)");
e.skipCurrentElement();
}
else if (tag == "volta") {
VoltaObj* o = new VoltaObj(this);
bdo = o; // save o to handle the "basic" tag (which sometimes follows)
o->readCapx(e);
ol.append(o);
}
else if (tag == "trill") {
TrillObj* o = new TrillObj(this);
bdo = o; // save o to handle the "basic" tag (which sometimes follows)
o->readCapx(e);
ol.append(o);
}
else if (tag == "transposable") {
qDebug("readCapxDrawObjectArray: found transposable (skipping)");
e.skipCurrentElement();
}
else if (tag == "group") {
qDebug("readCapxDrawObjectArray: found group (skipping)");
e.skipCurrentElement();
}
else
e.unknown();
}
}
else
e.unknown();
}
//.........这里部分代码省略.........
开发者ID:Tarkiyah,项目名称:MuseScore,代码行数:101,代码来源:capxml.cpp
示例14: read
void Ottava::read(XmlReader& e)
{
qDeleteAll(spannerSegments());
spannerSegments().clear();
e.addSpanner(e.intAttribute("id", -1), this);
while (e.readNextStartElement()) {
const QStringRef& tag(e.name());
if (tag == "subtype") {
QString s = e.readElementText();
bool ok;
int idx = s.toInt(&ok);
if (!ok) {
idx = int(Type::OTTAVA_8VA);
for (unsigned i = 0; i < sizeof(ottavaDefault)/sizeof(*ottavaDefault); ++i) {
if (s == ottavaDefault[i].name) {
idx = i;
break;
}
}
}
else if (score()->mscVersion() <= 114) {
//subtype are now in a different order...
if (idx == 1)
idx = 2;
else if (idx == 2)
idx = 1;
}
setOttavaType(Type(idx));
}
else if (tag == "numbersOnly") {
_numbersOnly = e.readInt();
numbersOnlyStyle = PropertyStyle::UNSTYLED;
}
else if (tag == "lineWidth") {
setLineWidth(Spatium(e.readDouble()));
lineWidthStyle = PropertyStyle::UNSTYLED;
}
else if (tag == "lineStyle") {
setLineStyle(Qt::PenStyle(e.readInt()));
lineStyleStyle = PropertyStyle::UNSTYLED;
}
else if (tag == "beginSymbol") { // obsolete
beginTextStyle = PropertyStyle::UNSTYLED;
QString text(e.readElementText());
setBeginText(QString("<sym>%1</sym>").arg(text[0].isNumber() ? Sym::id2name(SymId(text.toInt())) : text));
}
else if (tag == "continueSymbol") { // obsolete
continueTextStyle = PropertyStyle::UNSTYLED;
QString text(e.readElementText());
setContinueText(QString("<sym>%1</sym>").arg(text[0].isNumber() ? Sym::id2name(SymId(text.toInt())) : text));
}
else if (!TextLine::readProperties(e))
e.unknown();
}
if (beginText() != propertyDefault(P_ID::BEGIN_TEXT))
beginTextStyle = PropertyStyle::UNSTYLED;
if (continueText() != propertyDefault(P_ID::CONTINUE_TEXT))
continueTextStyle = PropertyStyle::UNSTYLED;
}
开发者ID:apatton090,项目名称:MuseScore,代码行数:59,代码来源:ottava.cpp
示例15: read
void Box::read(XmlReader& e)
{
_leftMargin = _rightMargin = _topMargin = _bottomMargin = 0.0;
bool keepMargins = false; // whether original margins have to be kept when reading old file
while (e.readNextStartElement()) {
const QStringRef& tag(e.name());
if (tag == "height")
_boxHeight = Spatium(e.readDouble());
else if (tag == "width")
_boxWidth = Spatium(e.readDouble());
else if (tag == "topGap")
_topGap = e.readDouble();
else if (tag == "bottomGap")
_bottomGap = e.readDouble();
else if (tag == "leftMargin")
_leftMargin = e.readDouble();
else if (tag == "rightMargin")
_rightMargin = e.readDouble();
else if (tag == "topMargin")
_topMargin = e.readDouble();
else if (tag == "bottomMargin")
_bottomMargin = e.readDouble();
else if (tag == "Text") {
Text* t;
if (type() == TBOX) {
t = static_cast<TBox*>(this)->getText();
t->read(e);
}
else {
t = new Text(score());
t->read(e);
add(t);
if (score()->mscVersion() <= 114)
t->setLayoutToParentWidth(true);
}
}
else if (tag == "Symbol") {
Symbol* s = new Symbol(score());
s->read(e);
add(s);
}
else if (tag == "Image") {
Image* image = new Image(score());
image->setTrack(score()->curTrack);
image->read(e);
add(image);
}
else if (tag == "FretDiagram") {
FretDiagram* f = new FretDiagram(score());
f->read(e);
add(f);
}
else if (tag == "LayoutBreak") {
LayoutBreak* lb = new LayoutBreak(score());
lb->read(e);
add(lb);
}
else if (tag == "HBox") {
HBox* hb = new HBox(score());
hb->read(e);
add(hb);
keepMargins = true; // in old file, box nesting used outer box margins
}
else if (tag == "VBox") {
VBox* vb = new VBox(score());
vb->read(e);
add(vb);
keepMargins = true; // in old file, box nesting used outer box margins
}
else if (Element::readProperties(e))
;
else
e.unknown();
}
// with .msc versions prior to 1.17, box margins were only used when nesting another box inside this box:
// for backward compatibility set them to 0 in all other cases
if (score()->mscVersion() < 117 && (type() == HBOX || type() == VBOX) && !keepMargins) {
_leftMargin = _rightMargin = _topMargin = _bottomMargin = 0.0;
}
}
开发者ID:macxcool,项目名称:MuseScore,代码行数:83,代码来源:box.cpp
示例16: readCapxStaveLayout
void Capella::readCapxStaveLayout(XmlReader& e, CapStaffLayout* sl, int
|
请发表评论