Ejemplo n.º 1
0
QDomNamedNodeMap QDomNodeProto:: attributes() const
{
  QDomNode *item = qscriptvalue_cast<QDomNode*>(thisObject());
  if (item)
    return item->attributes();
  return QDomNamedNodeMap();
}
Ejemplo n.º 2
0
void InternetServerPlatform::readVariables( QDomNode node )
{
	Logging::logInfo( this, "readVariables()" );

	if( node.isNull() )
		return;

	QDomNode variable = node.firstChild();
	while( false == variable.isNull() )
	{
		if( QDomNode::CommentNode != variable.nodeType() )
		{
			QString variableName = variable.nodeName();

			if( _variableList.contains(variableName) )
				continue;

			QString variableValue = variable.attributes().namedItem("value").nodeValue();

			replaceVariables( variableValue );

			_variableList.insert( variableName, variableValue );

			Logging::logInfo( this, QString("%1 = %2").arg(variableName).arg(variableValue) );

			variable = variable.nextSibling();
		}	
	}	
}
Ejemplo n.º 3
0
QVariant MetricDomModel::data(const QModelIndex &index, int role) const
{
    if (!index.isValid())
        return QVariant();

    if (role != Qt::DisplayRole)
        return QVariant();

    DomItem *item = static_cast<DomItem*>(index.internalPointer());

    QDomNode node = item->node();

    QStringList attributes;
    QDomNamedNodeMap attributeMap = node.attributes();

    switch (index.column()) {
        case 0:
            return node.nodeName();
        case 1:
        	if( !attributeMap.contains("Type") ) {
        		return QVariant();
        	}
        	return attributeMap.namedItem("Type").nodeValue();
        case 2:
        	if( !attributeMap.contains("Format") ) {
        		return QVariant();
        	}
        	return attributeMap.namedItem("Format").nodeValue();
        default:
            return QVariant();
    }
}
Ejemplo n.º 4
0
//copyright : (C) 2002-2004 InfoSiAL S.L.
//email     : [email protected]
void MReportEngine::drawDetailHeader( MPageCollection * pages, int level ) {
  MReportSection * header = findDetailHeader( level );

  if ( header ) {
    QDomNode record = records.item( currRecord_ );

    if ( !header->mustBeDrawed( &record ) )
      return ;

    header->setPageNumber( currPage );

    header->setReportDate( currDate );

    if (( currY + header->getHeight() ) > currHeight )
      newPage( pages );

    QString value;

    QDomNamedNodeMap fields = record.attributes();

    for ( int i = 0; i < header->getFieldCount(); i++ ) {
      value = fields.namedItem( header->getFieldName( i ) ).nodeValue();
      header->setFieldData( i, value );
    }

    header->setCalcFieldData( 0, 0, &record );

    int sectionHeight = header->getHeight();
    header->draw( p, leftMargin, currY, sectionHeight );
    header->setLastPageIndex( pages->getCurrentIndex() );
    header->setOnPage(( QPicture * ) p->painter()->device() );
    currY += sectionHeight;
  }
}
Ejemplo n.º 5
0
//! [3]
QVariant DomModel::data(const QModelIndex &index, int role) const
{
    if (!index.isValid())
        return QVariant();

    if (role != Qt::DisplayRole)
        return QVariant();

    DomItem *item = static_cast<DomItem*>(index.internalPointer());

    QDomNode node = item->node();
//! [3] //! [4]
    QStringList attributes;
    QDomNamedNodeMap attributeMap = node.attributes();

    switch (index.column()) {
        case 0:
            return node.nodeName();
        case 1:
            for (int i = 0; i < attributeMap.count(); ++i) {
                QDomNode attribute = attributeMap.item(i);
                attributes << attribute.nodeName() + "=\""
                              +attribute.nodeValue() + "\"";
            }
            return attributes.join(" ");
        case 2:
            return node.nodeValue().split("\n").join(" ");
        default:
            return QVariant();
    }
}
Ejemplo n.º 6
0
// the constructor
ComponentGenerator::ComponentGenerator(QDomNode &generatorNode):
    Generator(generatorNode),
    scope_(ComponentGenerator::INSTANCE),
    groups_() {

    QDomNamedNodeMap attributeMap = generatorNode.attributes();

    // get the spirit scope attribute
    QString scope = attributeMap.namedItem(QString("spirit:scope")).nodeValue();
    if (scope == QString("entity")) {
        scope_ = ComponentGenerator::ENTITY;
    }
    else {
        scope_ = ComponentGenerator::INSTANCE;
    }

    // go through all the child nodes of the component generator
    for (int i = 0; i < generatorNode.childNodes().count(); ++i) {
        QDomNode tempNode = generatorNode.childNodes().at(i);

        if (tempNode.nodeName() == QString("spirit:group")) {
            QString groupName = tempNode.childNodes().at(0).nodeValue();
            groupName = XmlUtils::removeWhiteSpace(groupName);
            groups_.append(groupName);
        }
    }
}
Ejemplo n.º 7
0
IntParameter::IntParameter(QDomNode node, QObject *parent)
  : AbstractParameter(parent),
    _node(node),
    _label(0),
    _slider(0),
    _spinBox(0)
{
  _name = node.attributes().namedItem( "name" ).nodeValue();
  QString min = node.attributes().namedItem( "min" ).nodeValue();
  QString max = node.attributes().namedItem( "max" ).nodeValue();
  QString def = node.attributes().namedItem( "default" ).nodeValue();
  QString value = node.toElement().attribute("savedValue",def);
  _min = min.toInt();
  _max = max.toInt();
  _default = def.toInt();
  _value = value.toInt();
}
Ejemplo n.º 8
0
void Parser3::ParseVideoFeed( QDomNode Node, VideoFeedPtr Info ) {
    QDomNode Child = Node.firstChild();

    while( !Child.isNull() )
    {
        QString NodeName = Child.nodeName();
        if( NodeName == "title" )
        {
            Info->Title = Child.namedItem("#text").nodeValue();
        }
        else if( NodeName == "link" && ( Child.attributes().namedItem("rel").nodeValue() == "next" ) )
        {
            Info->NextPageInFeed = QUrl( Child.attributes().namedItem("href").nodeValue() );
        }
        else if( NodeName == "author" )
        {
            Info->Author = Child.namedItem("name").namedItem("#text").nodeValue();
            Info->UrlAuthor = QUrl( Child.namedItem("uri").namedItem("#text").nodeValue() );
        }
        else if( NodeName == "openSearch:totalResults" )
        {
            Info->Size = Child.namedItem("#text").nodeValue().toInt();
        }
        else if( NodeName == "media:group" )
        {
            Info->Description = Child.namedItem("media:description").namedItem("#text").nodeValue();
            if( !Child.namedItem("media:thumbnail").isNull() )
            {/*If we allready has a thumbnail we don't want to erase it*/
                Info->UrlThumbnail = QUrl( Child.namedItem("media:thumbnail").namedItem("#text").nodeValue() );
            }
        }
        else if( NodeName == "entry" )
        {
            VideoInfo *Video = new VideoInfo;
            ParseVideoEntry(Child,Video);
            Info->Content.push_back( Video );
        }

        Child = Child.nextSibling();
    }

    Info->ParsedPages++;
    Info->FixInfo();
    return;
}
Ejemplo n.º 9
0
QDomNode
vleSmDT::nodeOutPort(const QString& portName)
{
    QDomNode outNode =
            mDocSm->elementsByTagName("out").item(0);
    QDomNodeList outList =
        outNode.toElement().elementsByTagName("port");
    for (int i = 0; i< outList.length(); i++) {
        QDomNode out = outList.at(i);
        for (int j=0; j< out.attributes().size(); j++) {
            if ((out.attributes().item(j).nodeName() == "name") and
                    (out.attributes().item(j).nodeValue() == portName))  {
                return out;
            }
        }
    }
    return QDomNode() ;
}
Ejemplo n.º 10
0
QDomNode
vleSmDT::nodeInPort(const QString& portName)
{
    QDomNode inNode =
            mDocSm->elementsByTagName("in").item(0);
    QDomNodeList inList =
        inNode.toElement().elementsByTagName("port");
    for (int i = 0; i< inList.length(); i++) {
        QDomNode in = inList.at(i);
        for (int j=0; j< in.attributes().size(); j++) {
            if ((in.attributes().item(j).nodeName() == "name") and
                    (in.attributes().item(j).nodeValue() == portName))  {
                return in;
            }
        }
    }
    return QDomNode() ;
}
Ejemplo n.º 11
0
QDomNode
vleSmDT::nodeCondPort(const QString& portName)
{
    QDomNode conditionNode =
            mDocSm->elementsByTagName("condition").item(0);
    QDomNodeList portList =
        conditionNode.toElement().elementsByTagName("port");
    for (int i = 0; i< portList.length(); i++) {
        QDomNode port = portList.at(i);
        for (int j=0; j< port.attributes().size(); j++) {
            if ((port.attributes().item(j).nodeName() == "name") and
                    (port.attributes().item(j).nodeValue() == portName))  {
                return port;
            }
        }
    }
    return QDomNode() ;
}
Ejemplo n.º 12
0
QDomNode
vleSmDT::nodeObsPort(const QString& portName)
{
    QDomNode observableNode =
            mDocSm->elementsByTagName("condition").item(0);
    QDomNodeList obsList =
        observableNode.toElement().elementsByTagName("port");
    for (int i = 0; i< obsList.length(); i++) {
        QDomNode obs = obsList.at(i);
        for (int j=0; j< obs.attributes().size(); j++) {
            if ((obs.attributes().item(j).nodeName() == "name") and
                    (obs.attributes().item(j).nodeValue() == portName))  {
                return obs;
            }
        }
    }
    return QDomNode() ;
}
Ejemplo n.º 13
0
QString
vleSmDT::getNamespace()
{
    QDomElement docElem = mDocSm->documentElement();

    QDomNode srcPluginNode =
        mDocSm->elementsByTagName("srcPlugin").item(0);
    return srcPluginNode.attributes().namedItem("namespace").nodeValue();
}
Ejemplo n.º 14
0
QDomNode
vleSmDT::nodeVariable(const QString& varName)
{
    QDomNode variablesNode =
            mDocSm->elementsByTagName("variables").item(0);
    QDomNodeList variableList =
            variablesNode.toElement().elementsByTagName("variable");
    for (int i = 0; i< variableList.length(); i++) {
        QDomNode variable = variableList.at(i);
        for (int j=0; j< variable.attributes().size(); j++) {
            if ((variable.attributes().item(j).nodeName() == "name") and
                    (variable.attributes().item(j).nodeValue() == varName))  {
                return variable;
            }
        }
    }
    return QDomNode() ;
}
Ejemplo n.º 15
0
QVariant XUPProjectModel::data( const QModelIndex& index, int role ) const
{
    if ( !index.isValid() ) {
        return QVariant();
    }
    
    XUPItem* item = static_cast<XUPItem*>( index.internalPointer() );

    switch ( role ) {
        case Qt::DecorationRole:
            return item->displayIcon();
        case Qt::DisplayRole:
            return item->displayText();
        case XUPProjectModel::TypeRole:
            return item->type();
        case Qt::ToolTipRole:
        {
            const QDomNode node = item->node();
            const QDomNamedNodeMap attributeMap = node.attributes();
            QStringList attributes;
            
            if ( item->type() == XUPItem::Project ) {
                attributes << QString( "Project: %1" ).arg( item->project()->fileName() );
            }
            
            for ( int i = 0; i < attributeMap.count(); i++ ) {
                const QDomNode attribute = attributeMap.item( i );
                const QString name = attribute.nodeName();
                const QString value = attribute.nodeValue();
                
                attributes << QString( "%1=\"%2\"" ).arg( name ).arg( value );
            }
            
            switch ( item->type() ) {
                case XUPItem::Value:
                    attributes << QString( "Value=\"%1\"" ).arg( item->content() );
                    break;
                case XUPItem::File:
                    attributes << QString( "File=\"%1\"" ).arg( item->content() );
                    break;
                case XUPItem::Path:
                    attributes << QString( "Path=\"%1\"" ).arg( item->content() );
                    break;
                default:
                    break;
            }
            
            return attributes.join( "\n" );
        }
        case Qt::SizeHintRole:
            return QSize( -1, 18 );
        default:
            break;
    }
    
    return QVariant();
}
Ejemplo n.º 16
0
bool EpochModel::Init(QDomNode &node)
{
 if(!node.hasAttributes()) return false;
 QDomNamedNodeMap attr= node.attributes();
 QString indexString = (attr.namedItem("index")).nodeValue() ;
 qDebug("reading Model with index %i ",indexString.toInt());
        for(QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling())
              {
                if(n.nodeName() == QString("camera"))  cameraName = n.attributes().namedItem("filename").nodeValue();
                if(n.nodeName() == QString("texture")) textureName= n.attributes().namedItem("filename").nodeValue();
                if(n.nodeName() == QString("depth"))   depthName  = n.attributes().namedItem("filename").nodeValue();
                if(n.nodeName() == QString("count"))   countName  = n.attributes().namedItem("filename").nodeValue();
            }

  QString tmpName=textureName.left(textureName.length()-4);
  maskName = tmpName.append(".mask.png");
  return true;
}
Ejemplo n.º 17
0
bool InternetServerPlatform::readSockets( QDomNode node )
{
	Logging::logInfo( this, "readSockets()" );

	if( node.isNull() )
		return false;

    QString applicationPath = QCoreApplication::applicationDirPath();
	
	QDomNode socket = IspComponents::Dom::getChildNodeByName( node, "socket" );
	while( false == socket.isNull() )
	{
		if( QDomNode::CommentNode != socket.nodeType() )
		{
			SocketSettings* socketSettings = new SocketSettings();

            // read the logfile read on
			socketSettings->_on = socket.attributes().namedItem( "on" ).nodeValue();

            // read the daemon
			socketSettings->_daemon	= socket.attributes().namedItem( "daemon" ).nodeValue();
		    socketSettings->_daemon = socketSettings->_daemon.startsWith("/")
                ? socketSettings->_daemon
                : QString( "%1/%2" ).arg( applicationPath ).arg( socketSettings->_daemon );

			// read the logfile
			QDomNode logFile = IspComponents::Dom::getChildNodeByName( socket, "logFile" );	
			socketSettings->_logFile = logFile.attributes().namedItem("value").nodeValue();
		    socketSettings->_logFile = socketSettings->_logFile.startsWith("/")
                ? socketSettings->_logFile
                : QString( "%1/%2" ).arg( applicationPath ).arg( socketSettings->_logFile );

			// read the block-from
			QDomNode blockFrom = IspComponents::Dom::getChildNodeByName( socket, "blockFrom" );
			readBlockFrom( blockFrom, socketSettings->_blockFrom );

			_socketSettingsList.append( socketSettings );
		}

		socket = socket.nextSibling();
	}

	return true;
}
QString XmlRelationCheckerCoreImpl::CheckIsSubNodeFrom(const QDomNode& nodeToCheck, XmlRelation* xmlRelation) const
{
    //Precondition: the passed node is an element

    //For debug
    //const QString& nodeName = nodeToCheck.nodeName();

    //List of the key of the referenced value
    QString key = "";

    //If the relation is a SUB_TAG relation, otherwise is not supported and always return false
    if(xmlRelation->GetRelationType() == SUB_TAG)
    {
        //For debug
        //QString subTagName = xmlRelation->GetSubTagNameOfTagFrom();

        //Check the tag name corresponds with the subtag from name
        if(nodeToCheck.nodeName() == xmlRelation->GetSubTagNameOfTagFrom())
        {
            //Now it has to search all the child node with the given tag name with the right attribute

            //Obtain the parent node
            const QDomNode& parentNode = nodeToCheck.parentNode();

            //If the node is the correct child of the right node from
            if(parentNode.isElement() && parentNode.nodeName() == xmlRelation->GetTagFromName())
            {
                //Check the presence of the right attribute

                const QDomNamedNodeMap& attributeNodesList = nodeToCheck.attributes();

                //For exit when the fist match is found
                bool attributeFound = false;

                //Flow the list searching the
                for(int i=0; i<attributeNodesList.size() && !attributeFound; ++i)
                {
                    const QDomAttr& attritubeNode = attributeNodesList.item(i).toAttr();
                    const QString& attributeName = attritubeNode.name();

                    //If the attribute match set to display the value
                    if( attributeName == xmlRelation->GetAttributeNameofTagFrom() )
                    {
                        //Attribute found exit the cycle
                        attributeFound = true;

                        //Add the key in the list
                        key = attritubeNode.value();
                    }
                }
            }
        }
    }

    return key;
}
Ejemplo n.º 19
0
void DefinitionParser::parseAssetNodes (QDomNode& node, const Content::Class clazz)
{
	bool sprite = false;
	QString nodeName;
	switch (clazz) {
	case Content::MOVIECLIP:
		nodeName = NODE_MOVIECLIP;
		sprite = true;
		break;
	case Content::SPRITE:
		sprite = true;
		nodeName = NODE_SPRITE;
		break;
	case Content::BITMAPDATA:
		nodeName = NODE_BITMAP;
		break;
	case Content::SOUND:
		nodeName = NODE_SOUND;
		break;
	case Content::BYTEARRAY:
		nodeName = NODE_BINARY;
		break;
	default:
		error("invalid class type " + QString::number(clazz));
		return;
	}
	while (!node.isNull()) {
		QDomElement elem = node.toElement();
		QDomNode parseNode = node;
		QDomNamedNodeMap attributes = node.attributes();
		QDomNode frame = node.firstChild();
		checkAttributes(node);
		node = node.nextSibling();

		if (elem.isNull()) {
			continue;
		}

		const QString tag = elem.tagName();
		if (nodeName != tag) {
			warnInvalidTag(tag, parseNode.parentNode().nodeName());
			continue;
		}

		if (attributes.isEmpty() || attributes.namedItem(ATTR_CLASS).nodeValue().isEmpty()) {
			warnMissingAttr(ATTR_CLASS, tag);
			continue;
		}

		if (frame.isNull() || !sprite) {
			createSingleFrameAsset(parseNode, clazz, nodeName);
		} else {
			createMultiFrameSprite(frame, clazz);
		}
	}
}
Ejemplo n.º 20
0
void PathMapper::readConfig()
{
  QDomNode node = pathMapperNode();

  // Server
  QDomNode valuenode = node.namedItem("mappings");
  QDomNode child = valuenode.firstChild();
  QString serverpath, localpath;
  while(!child.isNull())
  {
    serverpath = child.attributes().namedItem("serverpath").nodeValue();
    localpath = child.attributes().namedItem("localpath").nodeValue();
    kdDebug(24002) << "PathMapper::readConfig " << serverpath << ", " << localpath << endl;

    m_serverlist.append(serverpath);
    m_locallist.append(localpath);
    child = child.nextSibling();
  }
}
Ejemplo n.º 21
0
SBGNPort::SBGNPort(QDomNode node)
{
    QDomNamedNodeMap attrs = node.attributes();

    float x = attrs.namedItem("x").toAttr().value().toFloat();
    float y = attrs.namedItem("y").toAttr().value().toFloat();
    m_pos = QPointF(x,y);

    m_id = attrs.namedItem("id").toAttr().value();
}
Ejemplo n.º 22
0
QString TocDomModel::getLinkStringFromIndex(const QModelIndex &index) {
    /* TODO: where does the info that the named item is called 'Destination' come from?! */
    if (!index.isValid()) return QString();

    TocDomItem *item = static_cast<TocDomItem*>(index.internalPointer());
    QDomNode node = item->node();
    QDomNamedNodeMap attributeMap = node.attributes();

    return attributeMap.namedItem("Destination").nodeValue();
}
Ejemplo n.º 23
0
/******************************************************************************
    PopulateComponent
******************************************************************************/
void
CUpdateInfoGetter::PopulateComponent(
    const QDomNode &appNode,
    CComponentInfo& info)
{

    //TODO: sanity check xml

    //if (vecStrings.size() != 5)
    //{
    //    Q_ASSERT(false);
    //    throw ConnectionException(QT_TR_NOOP("Downloaded update info for "
    //        "component didn't contain the correct number of entries."));
    //}

    info.Clear();

    QDomNamedNodeMap appAttributes = appNode.attributes();

    info.SetName(appAttributes.namedItem( "name" ).nodeValue());

    #ifdef WIN32
        string sPF = UnicornUtils::programFilesPath();
        if (sPF == "")
        {
            // Do our best at faking it. Will at least work some of the time.
            LOG(1, "Couldn't get PF path so trying to fake it.");
            sPF = "C:\\Program Files\\";
        }
        info.SetPath(QString::fromStdString(sPF) +
                     appNode.firstChildElement("Path").text());
    #else // not WIN32
        info.SetPath(appNode.firstChildElement("Path").text());
    #endif // WIN32

    if ( !appNode.firstChildElement("Size").isNull() )
        info.SetSize( appNode.firstChildElement("Size").text().toInt() );
    else
        info.SetSize( 0 );

    info.SetDownloadURL ( appNode.firstChildElement("Url").text() );
    info.SetVersion     ( appAttributes.namedItem( "version" ).nodeValue() );
    info.SetInstallArgs ( appNode.firstChildElement("Args").text()  );

    if( appAttributes.contains( "majorUpgrade" )) {
        info.SetMajorUpgrade( appAttributes.namedItem( "majorUpgrade" ).nodeValue()
                              == "true" );
    }

    if( !appNode.firstChildElement("Description").isNull())
        info.SetDescription( appNode.firstChildElement("Description").text());

    if( !appNode.firstChildElement("Image").isNull())
        info.SetImage( QUrl( appNode.firstChildElement("Image").text()));
}
Ejemplo n.º 24
0
QString
vleVpm::getCondGUIplugin(const QString& condName) const
{
    QStringList res;
    if (mDocVpm) {
        QDomElement docElem = mDocVpm->documentElement();
        QDomNode condsPlugins =
                mDocVpm->elementsByTagName("condPlugins").item(0);
        QDomNodeList plugins =
                condsPlugins.toElement().elementsByTagName("condPlugin");
        for (int i =0; i< plugins.length(); i++) {
            QDomNode plug = plugins.item(i);
            if (plug.attributes().contains("cond") and
                (plug.attributes().namedItem("cond").nodeValue() == condName)) {
                return plug.attributes().namedItem("plugin").nodeValue();
            }
        }
    }
    return "";
}
Ejemplo n.º 25
0
void MainWindow::nbAttributesMax(QDomNode doc, int *nbAttributes)
{
    if(!doc.isNull())
    {
        if(doc.attributes().length() > *nbAttributes)
        {
            *nbAttributes = doc.attributes().length();
        }

        if(!doc.childNodes().isEmpty() && (doc.firstChild().toElement().tagName() != "" || doc.firstChild().isComment()))
        {
            QDomNodeList nodeList = doc.childNodes();

            for(int i = 0; i < nodeList.length(); i++)
            {
                nbAttributesMax(nodeList.at(i), nbAttributes);
            }
        }
    }
}
  void
  operator <<= (Miro::SensorGroupIDL& group, const QDomNode& node)
  {
    if (!node.isNull()) {

      // set sensor defaults
      Miro::SensorPositionIDL sensor;
      sensor.masked = false;
      QDomNamedNodeMap map = node.attributes();
      QDomNode n;
      n = map.namedItem("height");
      if (!n.isNull()) {
	QDomAttr attr = n.toAttr();
	if (!attr.isNull()) 
	  sensor.height = attr.value().toInt();
      }
      n = map.namedItem("distance");
      if (!n.isNull()) {
	QDomAttr attr = n.toAttr();
	if (!attr.isNull()) 
	  sensor.distance =attr.value().toInt();
      }
      n = map.namedItem("alpha");
      if (!n.isNull()) {
	QDomAttr attr = n.toAttr();
	if (!attr.isNull()) 
	  sensor.alpha = deg2Rad(attr.value().toDouble());
      }
      n = map.namedItem("beta");
      if (!n.isNull()) {
	QDomAttr attr = n.toAttr();
	if (!attr.isNull()) 
	  sensor.beta = deg2Rad(attr.value().toDouble());
      }
      n = map.namedItem("gamma");
      if (!n.isNull()) {
	QDomAttr attr = n.toAttr();
	if (!attr.isNull()) 
	  sensor.gamma = deg2Rad(attr.value().toDouble());
      }
      QDomNode n1 = node.firstChild();
      while(!n1.isNull() ) {
	if (n1.nodeName() == "description") {
	  group.description <<= n1;
	}
	else if (n1.nodeName() == "sensor") {
	  group.sensor.length(group.sensor.length() + 1);
	  group.sensor[group.sensor.length() - 1] = sensor;
	  group.sensor[group.sensor.length() - 1] <<= n1;
	}
	n1 = n1.nextSibling();
      }
    }
  }
Ejemplo n.º 27
0
inline void DefinitionParser::checkAttributes (QDomNode& node) const
{
	const QString tag = node.toElement().tagName();
	QDomNamedNodeMap attr = node.attributes();
	for (int i = 0; i < attr.size(); ++i) {
		QDomNode a = attr.item(i);
		if (!_attributesMap[a.nodeName()]) {
			warning("invalid attribute \'" + a.nodeName() + "\' in \'" + tag + "\'");
		}
	}
}
Ejemplo n.º 28
0
void Exif2GPX::loadPoint(const QDomNode& node) {
  QDomNode node2 = node.namedItem("time");
  if (!node2.isNull()) {
    std::tm timestruct;
    double lat, lon;
    QDateTime t = QDateTime::fromString(node2.firstChild().nodeValue(),
					Qt::ISODate);
    if (t.isValid()) {
      node2 = node.attributes().namedItem("lat");
      if (node2.isNull())
	return;
      lat = node2.nodeValue().toDouble();
      node2 = node.attributes().namedItem("lon");
      if (node2.isNull())
	return;
      lon = node2.nodeValue().toDouble();
      points[t] = std::pair<double, double>(lat, lon);
      std::cerr<<node.nodeName()<<std::endl;
    }
  }
}
Ejemplo n.º 29
0
bool SshServer::readUser( QDomNode userNode, UserSettings& userSettings )
{
	userSettings._name = userNode.attributes().namedItem("name").nodeValue();
	logInfo( this, QString("name=%1").arg(userSettings._name), true );
	if( userSettings._name.isEmpty() )
		return false;

	userSettings._home=userNode.attributes().namedItem("home").nodeValue();
	logInfo( this, QString("home=%1").arg(userSettings._home), true );
	if( userSettings._home.isEmpty() )
		return false;
	
	userSettings._lockInHome=(userNode.attributes().namedItem("lockInHome").nodeValue()=="yes");
	logInfo( this, QString("lockInHome=%1").arg(userSettings._lockInHome?"yes":"no"), true );
	
	userSettings._publicKey=userNode.attributes().namedItem("publicKey").nodeValue();
	logInfo( this, QString("publicKey=%1").arg(userSettings._publicKey), true );
	if( userSettings._publicKey.isEmpty() )
		return false;
	
	userSettings._publicKeyFormat=userNode.attributes().namedItem("publicKeyFormat").nodeValue();
	logInfo( this, QString("publicKeyFormat=%1").arg(userSettings._publicKeyFormat), true );
	if( userSettings._publicKeyFormat.isEmpty() )
		return false;
	
	userSettings._acceptedShellCommands=userNode.attributes().namedItem("value").nodeValue().split(",");
	foreach( QString shellCommand, userSettings._acceptedShellCommands )
		logInfo( this, QString("shellCommand=%1").arg(shellCommand), true );
        
    return true;
}
Ejemplo n.º 30
0
/**
 * \brief load the keyword definition list from
 * \param nodes the node list from which the definition of the block comments should be loaded
 * \return true on sucess, false on any error
 *
 * This function loads the definition of the keywords list on this syntax from the node list passed as a parameter.
 */
bool	QsvLangDef::loadKeywordList( QDomNodeList nodes )
{
	QDomNodeList strs;
	QDomNode str;
	QString s;

	int i, size = nodes.size();
	int j;
	
	for( i=0; i<size; i++ )
	{
		QsvEntityKeywordList e;
		QDomNode node = nodes.at( i );
		
		if (!loadEntity( node, e )) return false;
		e.list.clear();

		e.caseSensitive               = isTrue( node.attributes().namedItem("case-sensitive").nodeValue() );
		e.matchEmptyStringAtBeginning = isTrue( node.attributes().namedItem("match-empty-string-at-beginning").nodeValue() );
		e.matchEmptyStringAtEnd       = isTrue( node.attributes().namedItem("match-empty-string-at-end").nodeValue() );
		e.startRegex                  = node.attributes().namedItem("beginning-regex").nodeValue();
		e.endRegex                    = node.attributes().namedItem("end-regex").nodeValue();

		// WTF???
		e.startRegex.replace( "\\\\", "\\" );
		e.endRegex.replace( "\\\\", "\\" );
		
		// read strings
		strs = node.toElement().elementsByTagName("keyword");
		for( j=0; j<strs.size(); j++ )
		{
			str = strs.item( j );
			e.list << str.toElement().text();
		}
		
		keywordListDefs << e;
	}	

	return true;
}