package scala.tools.nsc
package plugins
import java.io.File
import scala.xml.{Node,NodeSeq}
abstract class PluginDescription {
val name: String
val classname: String
def toXML: Node = {
<plugin>
<name>{name}</name>
<classname>{classname}</classname>
</plugin>
}
}
object PluginDescription {
def fromXML(xml: Node): Option[PluginDescription] = {
xml match {
case <plugin>{_*}</plugin> => ()
case _ => return None
}
def getField(field: String): Option[String] = {
val text = (xml \\ field).text.trim
if (text == "") None else Some(text)
}
val name1 = getField("name") match {
case None => return None
case Some(str) => str
}
val classname1 = getField("classname") match {
case None => return None
case Some(str) => str
}
Some(new PluginDescription {
val name = name1
val classname = classname1
})
}
}