/** @cond doxygenLibsbmlInternal */
SBase*
BoundingBox::createObject (XMLInputStream& stream)
{
  const std::string& name   = stream.peek().getName();
  SBase*        object = 0;

  if (name == "dimensions")
  {
    if (getDimensionsExplicitlySet() == true)
    {
      getErrorLog()->logPackageError("layout", LayoutBBoxAllowedElements, 
          getPackageVersion(), getLevel(), getVersion(), "", getLine(), getColumn());
    }
    object = &mDimensions;
    mDimensionsExplicitlySet = true;
  }

  else if ( name == "position"    )
  {
    if (getPositionExplicitlySet() == true)
    {
      getErrorLog()->logPackageError("layout", LayoutBBoxAllowedElements, 
          getPackageVersion(), getLevel(), getVersion(), "", getLine(), getColumn());
    }
      object = &mPosition;
      mPositionExplicitlySet = true;
  }

  return object;
}
示例#2
0
/** @cond doxygenLibsbmlInternal */
SBase*
ReactionGlyph::createObject (XMLInputStream& stream)
{
  const std::string& name   = stream.peek().getName();
  
  SBase*        object = 0;

  if (name == "listOfSpeciesReferenceGlyphs")
  {
    if (mSpeciesReferenceGlyphs.size() != 0)
    {
      getErrorLog()->logPackageError("layout", LayoutRGAllowedElements, 
        getPackageVersion(), getLevel(), getVersion(), "", getLine(), getColumn());
    }

    object = &mSpeciesReferenceGlyphs;
  }
  else if(name=="curve")
  {
    if (getCurveExplicitlySet() == true)
    {
      getErrorLog()->logPackageError("layout", LayoutRGAllowedElements, 
        getPackageVersion(), getLevel(), getVersion(), "", getLine(), getColumn());
    }

    object = &mCurve;
    mCurveExplicitlySet = true;
  }
  else
  {
    object=GraphicalObject::createObject(stream);
  }
  
  return object;
}
QString DiagnosticsDialog::getBrowsers() const
{
#if defined(Q_OS_LINUX)
	return getPackageVersion( QStringList() << "chromium-browser" << "firefox" << "MozillaFirefox");
#elif defined(Q_OS_MAC)
	return getPackageVersion( QStringList() << "Google Chrome" << "Firefox" << "Safari" );
#endif
}
/** @cond doxygenLibsbmlInternal */
void BoundingBox::readAttributes (const XMLAttributes& attributes,
                                  const ExpectedAttributes& expectedAttributes)
{
  const unsigned int sbmlLevel   = getLevel  ();
  const unsigned int sbmlVersion = getVersion();

  unsigned int numErrs;

  SBase::readAttributes(attributes, expectedAttributes);

  // look to see whether an unknown attribute error was logged
  if (getErrorLog() != NULL)
  {
    numErrs = getErrorLog()->getNumErrors();
    for (int n = (int)numErrs-1; n >= 0; n--)
    {
      if (getErrorLog()->getError((unsigned int)n)->getErrorId() == UnknownPackageAttribute)
      {
        const std::string details =
          getErrorLog()->getError((unsigned int)n)->getMessage();
        getErrorLog()->remove(UnknownPackageAttribute);
        getErrorLog()->logPackageError("layout", LayoutBBoxAllowedAttributes,
          getPackageVersion(), sbmlLevel, sbmlVersion, details, getLine(), getColumn());
      }
      else if (getErrorLog()->getError((unsigned int)n)->getErrorId() == UnknownCoreAttribute)
      {
        const std::string details =
          getErrorLog()->getError((unsigned int)n)->getMessage();
        getErrorLog()->remove(UnknownCoreAttribute);
        getErrorLog()->logPackageError("layout", 
          LayoutBBoxAllowedCoreAttributes,
          getPackageVersion(), sbmlLevel, sbmlVersion, details, getLine(), getColumn());
      }
    }
  }

  bool assigned = false;

  //
  // id SId  ( use = "optional" )
  //
  assigned = attributes.readInto("id", mId);

  if (assigned == true && getErrorLog() != NULL)
  {
    // check string is not empty and correct syntax

    if (mId.empty() == true)
    {
      logEmptyString(mId, getLevel(), getVersion(), "<BoundingBox>");
    }
    else if (SyntaxChecker::isValidSBMLSId(mId) == false)
    {
      getErrorLog()->logPackageError("layout", LayoutSIdSyntax, 
        getPackageVersion(), sbmlLevel, sbmlVersion);
    }
  }
}
/** @cond doxygenLibsbmlInternal */
SBase*
CompSBasePlugin::createObject(XMLInputStream& stream)
{
  SBase*        object = 0;

  const std::string&   name   = stream.peek().getName();
  const XMLNamespaces& xmlns  = stream.peek().getNamespaces();
  const std::string&   prefix = stream.peek().getPrefix();

  const std::string& targetPrefix = (xmlns.hasURI(mURI)) ? xmlns.getPrefix(mURI) : mPrefix;
  
  if (prefix == targetPrefix)
  {
    if ( name == "listOfReplacedElements" ) 
    {
      if (mListOfReplacedElements != NULL)
      {
        getErrorLog()->logPackageError("comp", CompOneListOfReplacedElements, 
          getPackageVersion(), getLevel(), getVersion());
      }
      createListOfReplacedElements();
      object = mListOfReplacedElements;
    
      if (targetPrefix.empty())
      {
        //
        // (NOTE)
        //
        // A top-level element (listOfReplacedElements) of the comp extension is located 
        // in a default namespace, and thus xmlns=".." attribute must be added to 
        // the element.
        // This is done by invoking SBMLDocument::enableDefaultNS() function with 
        // the two arguments (the URI of this package and true value).
        //
        mListOfReplacedElements->getSBMLDocument()->enableDefaultNS(mURI,true);
      }
    }
    if ( name == "replacedBy" ) {
      if (mReplacedBy != NULL)
      {
        if (mSBML != NULL && getErrorLog() != NULL)
        {
          getErrorLog()->logPackageError("comp", CompOneReplacedByElement, 
                          getPackageVersion(), getLevel(), getVersion());
        }
      }
      delete mReplacedBy;

      COMP_CREATE_NS(compns, getSBMLNamespaces());
      mReplacedBy = new ReplacedBy(compns);
      object = mReplacedBy;
      object->connectToParent(getParentSBMLObject());
      delete compns;
    }
  }
  return object;
}
int
CompSBasePlugin::addReplacedElement (const ReplacedElement* replacedElement)
{
  if (replacedElement == NULL)
  {
    return LIBSBML_INVALID_OBJECT;
  }
  else if (!(replacedElement->hasRequiredAttributes()) || !(replacedElement->hasRequiredElements()))
  {
    return LIBSBML_INVALID_OBJECT;
  }
  else if (getLevel() != replacedElement->getLevel())
  {
    return LIBSBML_LEVEL_MISMATCH;
  }
  else if (getVersion() != replacedElement->getVersion())
  {
    return LIBSBML_VERSION_MISMATCH;
  }
  else if (getPackageVersion() != replacedElement->getPackageVersion())
  {
    return LIBSBML_PKG_VERSION_MISMATCH;
  }
  else
  {
    createListOfReplacedElements();
    return mListOfReplacedElements->append(replacedElement);
  }
}
示例#7
0
/** @cond doxygenLibsbmlInternal */
SBase*
ListOfLineSegments::createObject (XMLInputStream& stream)
{
  const std::string& name   = stream.peek().getName();
  SBase*        object = 0;


  if (name == "curveSegment")
  {
    std::string type = "LineSegment";
    XMLTriple triple("type","http://www.w3.org/2001/XMLSchema-instance","xsi");

    if (!stream.peek().getAttributes().readInto(triple, type))
    {
      //std::cout << "[DEBUG] ListOfLineSegments::createObject () : 
      //              Failed to read xsi:type" << std::endl;
      getErrorLog()->logPackageError("layout", 
                     LayoutXsiTypeAllowedLocations,
                     getPackageVersion(), getLevel(), getVersion(), "", getLine(), getColumn());

      return object;
    }

    //std::cout << "[DEBUG] ListOfLineSegments::createObject () : type " 
    //          << type << std::endl;
    
    LAYOUT_CREATE_NS(layoutns,this->getSBMLNamespaces());
    if(type=="LineSegment")
    {
      object = new LineSegment(layoutns);
    }
    else if(type=="CubicBezier")
    {
      object = new CubicBezier(layoutns);
    }
    else
    {
      getErrorLog()->logPackageError("layout", LayoutXsiTypeSyntax,
                     getPackageVersion(), getLevel(), getVersion(), "", getLine(), getColumn());
    }
    delete layoutns;
  }
  
  if(object) appendAndOwn(object);

  return object;
}
示例#8
0
/** @cond doxygenLibsbmlInternal */
SBase*
CubicBezier::createObject (XMLInputStream& stream)
{

  const std::string& name   = stream.peek().getName();
  SBase*        object = 0;

  if (name == "basePoint1")
  {
    if (getBasePt1ExplicitlySet() == true)
    {
      getErrorLog()->logPackageError("layout", LayoutCBezAllowedElements, 
          getPackageVersion(), getLevel(), getVersion(), "", getLine(), getColumn());
    }

    object = &mBasePoint1;
    mBasePt1ExplicitlySet = true;
  }
  else if(name == "basePoint2")
  {
    if (getBasePt2ExplicitlySet() == true)
    {
      getErrorLog()->logPackageError("layout", LayoutCBezAllowedElements, 
          getPackageVersion(), getLevel(), getVersion(), "", getLine(), getColumn());
    }

    object = &mBasePoint2;
    mBasePt2ExplicitlySet = true;
  }
  else
  {
      object = LineSegment::createObject(stream);
  }
 
  return object;
}
示例#9
0
/** @cond doxygenLibsbmlInternal */
void Curve::readAttributes (const XMLAttributes& attributes,
                            const ExpectedAttributes& expectedAttributes)
{
  const unsigned int sbmlLevel   = getLevel  ();
  const unsigned int sbmlVersion = getVersion();

  unsigned int numErrs;

  SBase::readAttributes(attributes, expectedAttributes);

  // look to see whether an unknown attribute error was logged
  if (getErrorLog() != NULL)
  {
    numErrs = getErrorLog()->getNumErrors();
    for (int n = (int)numErrs-1; n >= 0; n--)
    {
      if (getErrorLog()->getError((unsigned int)n)->getErrorId() == UnknownPackageAttribute)
      {
        const std::string details =
                          getErrorLog()->getError((unsigned int)n)->getMessage();
        getErrorLog()->remove(UnknownPackageAttribute);
        getErrorLog()->logPackageError("layout", LayoutCurveAllowedAttributes,
                       getPackageVersion(), sbmlLevel, sbmlVersion, details, getLine(), getColumn());
      }
      else if (getErrorLog()->getError((unsigned int)n)->getErrorId() == UnknownCoreAttribute)
      {
        const std::string details =
                          getErrorLog()->getError((unsigned int)n)->getMessage();
        getErrorLog()->remove(UnknownCoreAttribute);
        getErrorLog()->logPackageError("layout", 
                       LayoutCurveAllowedCoreAttributes,
                       getPackageVersion(), sbmlLevel, sbmlVersion, details, getLine(), getColumn());
      }
    }
  }
}
示例#10
0
/*
 * Subclasses should override this method to read values from the given
 * XMLAttributes set into their specific fields.
 */
void
SBasePlugin::readAttributes (const XMLAttributes& attributes,
                             const ExpectedAttributes& expectedAttributes)
{
  if (&attributes == NULL || &expectedAttributes == NULL ) return;

  const unsigned int sbmlLevel   = getLevel  ();
  const unsigned int sbmlVersion = getVersion();
  const unsigned int pkgVersion  = getPackageVersion();

   std::string element = (mParent) ? mParent->getElementName() : std::string();

  //
  // (NOTE)
  //
  // This function is just used to identify unexpected
  // attributes with the prefix of the package.
  //

#if 0
  std::cout << "[DEBUG] SBasePlugin::readAttributes() " << element << std::endl;
#endif

  //
  // check that all attributes of this plugin object are expected
  //
  for (int i = 0; i < attributes.getLength(); i++)
  {
    std::string name = attributes.getName(i);
    std::string uri  = attributes.getURI(i);

#if 0
    std::cout << "[DEBUG] SBasePlugin::readAttributes() name : " << name 
              << " uri " << uri << std::endl;
#endif
    
    if (uri != mURI) continue;

    if (!expectedAttributes.hasAttribute(name))
    {    
      logUnknownAttribute(name, sbmlLevel, sbmlVersion, pkgVersion, element);
    }      
  }
}
示例#11
0
/** @cond doxygenLibsbmlInternal */
SBase*
Curve::createObject (XMLInputStream& stream)
{

  const std::string& name   = stream.peek().getName();
  SBase*        object = 0;

  if (name == "listOfCurveSegments")
  {
    if (mCurveSegments.size() != 0)
    {
      getErrorLog()->logPackageError("layout", LayoutCurveAllowedElements, 
        getPackageVersion(), getLevel(), getVersion(), "", getLine(), getColumn());
    }

    object = &mCurveSegments;
  }
 
  return object;
}
示例#12
0
int
CompSBasePlugin::setReplacedBy (const ReplacedBy* replacedBy)
{
  if (mReplacedBy == replacedBy) 
  {
    return LIBSBML_OPERATION_SUCCESS;
  }
  else if (replacedBy == NULL)
  {
    if (mReplacedBy != NULL) delete mReplacedBy;
    mReplacedBy = NULL;
    return LIBSBML_OPERATION_SUCCESS;
  }
  else if (!replacedBy->hasRequiredAttributes() || !replacedBy->hasRequiredElements()) {
    return LIBSBML_INVALID_OBJECT;
  }
  else if (getLevel() != replacedBy->getLevel())
  {
    return LIBSBML_LEVEL_MISMATCH;
  }
  else if (getVersion() != replacedBy->getVersion())
  {
    return LIBSBML_VERSION_MISMATCH;
  }
  else if (getPackageVersion() != replacedBy->getPackageVersion())
  {
    return LIBSBML_PKG_VERSION_MISMATCH;
  }
  else
  {
    if (mReplacedBy != NULL) delete mReplacedBy;
    mReplacedBy = replacedBy->clone();
    if (mReplacedBy == NULL) {
      return LIBSBML_OPERATION_FAILED;
    }
    mReplacedBy->connectToParent(getParentSBMLObject());
    return LIBSBML_OPERATION_SUCCESS;
  }
}
示例#13
0
void 
CompSBasePlugin::logInvalidId(const std::string& attribute,
                              const std::string& wrongattribute)
{

  if (&attribute == NULL || &wrongattribute == NULL) return;
  bool knownelement = (getParentSBMLObject() == NULL);
  std::ostringstream msg;

  msg << "Setting the attribute '" << attribute << "' ";
  if (knownelement) {
    msg << "of a <" << getParentSBMLObject()->getElementName() << "> ";
  }
  msg << "in the " << getPackageName() 
      << " package (version " << getPackageVersion() << ") to '" << wrongattribute
      << "' is illegal:  the string is not a well-formed SId.";

  SBMLErrorLog* errlog = getErrorLog();
  if (errlog)
  {
    errlog->logError(NotSchemaConformant, getLevel(), getVersion(), msg.str());
  }
}
示例#14
0
/** @cond doxygenLibsbmlInternal */
void SpeciesGlyph::readAttributes (const XMLAttributes& attributes,
                                   const ExpectedAttributes& expectedAttributes)
{
  const unsigned int sbmlLevel   = getLevel  ();
  const unsigned int sbmlVersion = getVersion();

  unsigned int numErrs;

  /* look to see whether an unknown attribute error was logged
  * during the read of the listOfSpeciesGlyphs - which will have
  * happened immediately prior to this read
  */

  bool loSubGlyphs = false;
  if (getParentSBMLObject() != NULL
    && getParentSBMLObject()->getElementName() == "listOfSubGlyphs")
  {
    loSubGlyphs = true;
  }

  if (getErrorLog() != NULL &&
    static_cast<ListOfSpeciesGlyphs*>(getParentSBMLObject())->size() < 2)
  {
    numErrs = getErrorLog()->getNumErrors();
    for (int n = (int)numErrs-1; n >= 0; n--)
    {
      if (getErrorLog()->getError((unsigned int)n)->getErrorId() == UnknownPackageAttribute)
      {
        const std::string details =
          getErrorLog()->getError((unsigned int)n)->getMessage();
        getErrorLog()->remove(UnknownPackageAttribute);
        if (loSubGlyphs == true)
        {
          getErrorLog()->logPackageError("layout", 
            LayoutLOSubGlyphAllowedAttribs,
            getPackageVersion(), sbmlLevel, sbmlVersion, details, getLine(), getColumn());
        }
        else
        {
          getErrorLog()->logPackageError("layout", 
            LayoutLOSpeciesGlyphAllowedAttributes,
            getPackageVersion(), sbmlLevel, sbmlVersion, details, getLine(), getColumn());
        }
      }
      else if (getErrorLog()->getError((unsigned int)n)->getErrorId() == UnknownCoreAttribute)
      {
        const std::string details =
          getErrorLog()->getError((unsigned int)n)->getMessage();
        getErrorLog()->remove(UnknownCoreAttribute);
        if (loSubGlyphs == true)
        {
          getErrorLog()->logPackageError("layout", 
            LayoutLOSubGlyphAllowedAttribs,
            getPackageVersion(), sbmlLevel, sbmlVersion, details, getLine(), getColumn());
        }
        else
        {
          getErrorLog()->logPackageError("layout", 
            LayoutLOSpeciesGlyphAllowedAttributes,
            getPackageVersion(), sbmlLevel, sbmlVersion, details, getLine(), getColumn());
        }
      }
    }
  }

  GraphicalObject::readAttributes(attributes, expectedAttributes);

  // look to see whether an unknown attribute error was logged
  if (getErrorLog() != NULL)
  {
    numErrs = getErrorLog()->getNumErrors();
    for (int n = (int)numErrs-1; n >= 0; n--)
    {
      if (getErrorLog()->getError((unsigned int)n)->getErrorId() == UnknownPackageAttribute)
      {
        const std::string details =
          getErrorLog()->getError((unsigned int)n)->getMessage();
        getErrorLog()->remove(UnknownPackageAttribute);
        getErrorLog()->logPackageError("layout", LayoutSGAllowedAttributes,
          getPackageVersion(), sbmlLevel, sbmlVersion, details, getLine(), getColumn());
      }
      else if (getErrorLog()->getError((unsigned int)n)->getErrorId() == UnknownCoreAttribute)
      {
        const std::string details =
          getErrorLog()->getError((unsigned int)n)->getMessage();
        getErrorLog()->remove(UnknownCoreAttribute);
        getErrorLog()->logPackageError("layout", LayoutSGAllowedCoreAttributes,
          getPackageVersion(), sbmlLevel, sbmlVersion, details, getLine(), getColumn());
      }
    }
  }

  bool assigned = false;

  //
  // species SIdRef   ( use = "optional" )
  //
  assigned = attributes.readInto("species", mSpecies);

  if (assigned == true && getErrorLog() != NULL)
  {
    // check string is not empty and correct syntax

    if (mSpecies.empty() == true)
    {
      logEmptyString(mSpecies, getLevel(), getVersion(), "<SpeciesGlyph>");
    }
    else if (SyntaxChecker::isValidSBMLSId(mSpecies) == false)
    {
      getErrorLog()->logPackageError("layout", LayoutSGSpeciesSyntax,
        getPackageVersion(), sbmlLevel, sbmlVersion, "The species on the <" 
        + getElementName() + "> is '" + mSpecies + "', which does not conform to the syntax.", getLine(), getColumn());
    }
  }

}
示例#15
0
/** @cond doxygenLibsbmlInternal */
void GeneralGlyph::readAttributes (const XMLAttributes& attributes,
                                    const ExpectedAttributes& expectedAttributes)
{
	const unsigned int sbmlLevel   = getLevel  ();
	const unsigned int sbmlVersion = getVersion();

	unsigned int numErrs;

	/* look to see whether an unknown attribute error was logged
	 * during the read of the listOfAdditionalGraphicalObjects - which will have
	 * happened immediately prior to this read
	*/

  bool loSubGlyphs = false;
  if (getParentSBMLObject() != NULL
    && getParentSBMLObject()->getElementName() == "listOfSubGlyphs")
  {
    loSubGlyphs = true;
  }

	if (getErrorLog() != NULL &&
	    static_cast<ListOfGraphicalObjects*>(getParentSBMLObject())->size() < 2)
	{
		numErrs = getErrorLog()->getNumErrors();
		for (int n = numErrs-1; n >= 0; n--)
		{
			if (getErrorLog()->getError(n)->getErrorId() == UnknownPackageAttribute)
			{
				const std::string details =
				      getErrorLog()->getError(n)->getMessage();
				getErrorLog()->remove(UnknownPackageAttribute);
        if (loSubGlyphs == true)
        {
				  getErrorLog()->logPackageError("layout", 
                                    LayoutLOSubGlyphAllowedAttribs,
				            getPackageVersion(), sbmlLevel, sbmlVersion, details);
        }
        else
        {
				  getErrorLog()->logPackageError("layout", 
                                    LayoutLOAddGOAllowedAttribut,
				            getPackageVersion(), sbmlLevel, sbmlVersion, details);
        }
			}
			else if (getErrorLog()->getError(n)->getErrorId() == UnknownCoreAttribute)
			{
				const std::string details =
				           getErrorLog()->getError(n)->getMessage();
				getErrorLog()->remove(UnknownCoreAttribute);
        if (loSubGlyphs == true)
        {
				  getErrorLog()->logPackageError("layout", 
                                    LayoutLOSubGlyphAllowedAttribs,
				            getPackageVersion(), sbmlLevel, sbmlVersion, details);
        }
        else
        {
				  getErrorLog()->logPackageError("layout", 
                                    LayoutLOAddGOAllowedAttribut,
				            getPackageVersion(), sbmlLevel, sbmlVersion, details);
        }
			}
		}
	}

	GraphicalObject::readAttributes(attributes, expectedAttributes);

	// look to see whether an unknown attribute error was logged
	if (getErrorLog() != NULL)
	{
		numErrs = getErrorLog()->getNumErrors();
		for (int n = numErrs-1; n >= 0; n--)
		{
			if (getErrorLog()->getError(n)->getErrorId() == UnknownPackageAttribute)
			{
				const std::string details =
				                  getErrorLog()->getError(n)->getMessage();
				getErrorLog()->remove(UnknownPackageAttribute);
				getErrorLog()->logPackageError("layout", LayoutGGAllowedAttributes,
				               getPackageVersion(), sbmlLevel, sbmlVersion, details);
			}
			else if (getErrorLog()->getError(n)->getErrorId() == UnknownCoreAttribute)
			{
				const std::string details =
				                  getErrorLog()->getError(n)->getMessage();
				getErrorLog()->remove(UnknownCoreAttribute);
				getErrorLog()->logPackageError("layout", LayoutGGAllowedCoreAttributes,
				               getPackageVersion(), sbmlLevel, sbmlVersion, details);
			}
		}
	}

	bool assigned = false;

	//
	// reference SIdRef   ( use = "optional" )
	//
	assigned = attributes.readInto("reference", mReference);

	if (assigned == true)
	{
		// check string is not empty and correct syntax

		if (mReference.empty() == true)
		{
			logEmptyString(mReference, getLevel(), getVersion(), "<GeneralGlyph>");
		}
		else if (SyntaxChecker::isValidSBMLSId(mReference) == false)
		{
			getErrorLog()->logPackageError("layout", LayoutGGReferenceSyntax,
				             getPackageVersion(), sbmlLevel, sbmlVersion);
		}
	}


}
DiagnosticsDialog::DiagnosticsDialog( QWidget *parent )
:	QDialog( parent )
{
	setupUi( this );
	setAttribute( Qt::WA_DeleteOnClose, true );

	QString info;
	QTextStream s( &info );

	s << "<b>" << tr("Locale:") << "</b> ";
	QString locale = QLocale::c().name();
	s << (locale == "C" ? "en_us" : locale) << "<br /><br />";

#if defined(Q_OS_LINUX)
	QString package = getPackageVersion( QStringList() << "estonianidcard", false );
	QString utility = getPackageVersion( QStringList() << "qesteidutil", false );
	if ( !package.isEmpty() )
		s << "<b>" << tr("ID-card package version:") << "</b> " << package << "<br />";
	if ( !utility.isEmpty() )
		s << "<b>" << tr("ID-card utility version:") << "</b> " << utility << "<br />";
#else
	s << "<b>" << tr("ID-card utility version:") << "</b> " << QCoreApplication::applicationVersion() << "<br />";
#endif

	s << "<b>" << tr("OS:") << "</b> ";
#if defined(Q_OS_LINUX)
	QProcess p;
	p.start( "lsb_release", QStringList() << "-s" << "-d" );
	p.waitForReadyRead();
	s << p.readAll();
#elif defined(Q_OS_MAC)
	SInt32 major, minor, bugfix;
	
	if( Gestalt(gestaltSystemVersionMajor, &major) == noErr &&
			Gestalt(gestaltSystemVersionMinor, &minor) == noErr &&
			Gestalt(gestaltSystemVersionBugFix, &bugfix) == noErr )
		s << "Mac OS " << major << "." << minor << "." << bugfix;
	else
		s << "Mac OS 10.3";
#endif

	s << " (" << QSysInfo::WordSize << ")<br />";
#if defined(Q_OS_LINUX)
	s << "<b>" << tr("CPU:") << "</b> " << getProcessor() << "<br /><br />";
#endif

	s << "<b>" << tr("Library paths:") << "</b> " << QCoreApplication::libraryPaths().join( ";" ) << "<br />";

	s << "<b>" << tr("Libraries") << ":</b><br />";
#if defined(Q_OS_MAC)
	QProcess p;
	p.start( "/Library/OpenSC/bin/opensc-tool", QStringList() << "-i" );
	p.waitForReadyRead();
	s << p.readAll() << "<br />";
#elif defined(Q_OS_LINUX)
	s << getPackageVersion( QStringList() << "openssl" << "libpcsclite1" << "opensc" );
#endif
	s << "QT (" << qVersion() << ")<br />" << "<br />";

	s << "<b>" << tr("PCSC service status: ") << "</b>" << " " << (isPCSCRunning() ? tr("Running") : tr("Not running")) << "<br /><br />";

	s << "<b>" << tr("Card readers") << ":</b><br />" << getReaderInfo() << "<br />";

	QString browsers = getBrowsers();
	if ( !browsers.isEmpty() )
		s << "<b>" << tr("Browsers:") << "</b><br />" << browsers << "<br /><br />";

	diagnosticsText->setHtml( info );
}
示例#17
0
/** @cond doxygenLibsbmlInternal */
void ReferenceGlyph::readAttributes (const XMLAttributes& attributes,
                                const ExpectedAttributes& expectedAttributes)
{
  const unsigned int sbmlLevel   = getLevel  ();
  const unsigned int sbmlVersion = getVersion();

  unsigned int numErrs;

  /* look to see whether an unknown attribute error was logged
  * during the read of the listOfReferenceGlyphs - which will have
  * happened immediately prior to this read
  */

  bool loSubGlyphs = false;
  if (getParentSBMLObject() != NULL
    && getParentSBMLObject()->getElementName() == "listOfSubGlyphs")
  {
    loSubGlyphs = true;
  }

  if (getErrorLog() != NULL &&
    static_cast<ListOfReferenceGlyphs*>(getParentSBMLObject())->size() < 2)
  {
    numErrs = getErrorLog()->getNumErrors();
    for (int n = (int)numErrs-1; n >= 0; n--)
    {
      if (getErrorLog()->getError((unsigned int)n)->getErrorId() == UnknownPackageAttribute)
      {
        const std::string details =
          getErrorLog()->getError((unsigned int)n)->getMessage();
        getErrorLog()->remove(UnknownPackageAttribute);
        if (loSubGlyphs == true)
        {
          getErrorLog()->logPackageError("layout", 
            LayoutLOSubGlyphAllowedAttribs,
            getPackageVersion(), sbmlLevel, sbmlVersion, details, getLine(), getColumn());
        }
        else
        {
          getErrorLog()->logPackageError("layout", 
            LayoutLOReferenceGlyphAllowedAttribs,
            getPackageVersion(), sbmlLevel, sbmlVersion, details, getLine(), getColumn());
        }
      }
      else if (getErrorLog()->getError((unsigned int)n)->getErrorId() == UnknownCoreAttribute)
      {
        const std::string details =
          getErrorLog()->getError((unsigned int)n)->getMessage();
        getErrorLog()->remove(UnknownCoreAttribute);
        if (loSubGlyphs == true)
        {
          getErrorLog()->logPackageError("layout", 
            LayoutLOSubGlyphAllowedAttribs,
            getPackageVersion(), sbmlLevel, sbmlVersion, details, getLine(), getColumn());
        }
        else
        {
          getErrorLog()->logPackageError("layout", 
            LayoutLOReferenceGlyphAllowedAttribs,
            getPackageVersion(), sbmlLevel, sbmlVersion, details, getLine(), getColumn());
        }
      }
    }
  }

  GraphicalObject::readAttributes(attributes, expectedAttributes);

  // look to see whether an unknown attribute error was logged
  if (getErrorLog() != NULL)
  {
    numErrs = getErrorLog()->getNumErrors();
    for (int n = (int)numErrs-1; n >= 0; n--)
    {
      if (getErrorLog()->getError((unsigned int)n)->getErrorId() == UnknownPackageAttribute)
      {
        const std::string details =
          getErrorLog()->getError((unsigned int)n)->getMessage();
        getErrorLog()->remove(UnknownPackageAttribute);
        getErrorLog()->logPackageError("layout", LayoutREFGAllowedAttributes,
          getPackageVersion(), sbmlLevel, sbmlVersion, details, getLine(), getColumn());
      }
      else if (getErrorLog()->getError((unsigned int)n)->getErrorId() == UnknownCoreAttribute)
      {
        const std::string details =
          getErrorLog()->getError((unsigned int)n)->getMessage();
        getErrorLog()->remove(UnknownCoreAttribute);
        getErrorLog()->logPackageError("layout", 
          LayoutREFGAllowedCoreAttributes,
          getPackageVersion(), sbmlLevel, sbmlVersion, details, getLine(), getColumn());
      }
    }
  }

  bool assigned = false;

  //
  // glyph SIdRef   ( use = "required" )
  //
  assigned = attributes.readInto("glyph", mGlyph);

  if (getErrorLog() != NULL)
  {
    if (assigned == true)
    {
      // check string is not empty and correct syntax

      if (mGlyph.empty() == true)
      {
        logEmptyString(mGlyph, getLevel(), getVersion(), "<ReferenceGlyph>");
      }
      else if (SyntaxChecker::isValidSBMLSId(mGlyph) == false)
      {
        getErrorLog()->logPackageError("layout", LayoutREFGGlyphSyntax,
          getPackageVersion(), sbmlLevel, sbmlVersion, "The glyph on the <" 
          + getElementName() + "> is '" + mGlyph + "', which does not conform to the syntax.", getLine(), getColumn());
      }
    }
    else
    {
      std::string message = "Layout attribute 'glyph' is missing.";
      getErrorLog()->logPackageError("layout", LayoutREFGAllowedAttributes,
        getPackageVersion(), sbmlLevel, sbmlVersion, message, getLine(), getColumn());
    }
  }

  //
  // reference SIdRef   ( use = "optional" )
  //
  assigned = attributes.readInto("reference", mReference);

  if (assigned == true && getErrorLog() != NULL)
  {
    // check string is not empty and correct syntax

    if (mReference.empty() == true)
    {
      logEmptyString(mReference, getLevel(), getVersion(), "<ReferenceGlyph>");
    }
    else if (SyntaxChecker::isValidSBMLSId(mReference) == false)
    {
      getErrorLog()->logPackageError("layout", LayoutREFGReferenceSyntax,
        getPackageVersion(), sbmlLevel, sbmlVersion, "The reference on the <" 
        + getElementName() + "> is '" + mReference + "', which does not conform to the syntax.", getLine(), getColumn());
    }
  }

  //
  // role string   ( use = "optional" )
  //
  std::string role;
  assigned = attributes.readInto("role", role);

  if (assigned == true)
  {
    // check string is not empty

    if (role.empty() == true  && getErrorLog() != NULL)
    {
      logEmptyString(role, getLevel(), getVersion(), "<ReferenceGlyph>");
    }

    this->setRole(role);
  }

}