class Autoproj::RosPackageManifest::Loader
@api private
REXML stream parser object used to load the XML contents into a {PackageManifest} object
Constants
- DEPEND_TAGS
- MANIFEST_CLASS
Access to the information contained in a package’s package.xml file
Use
PackageManifest.load
to create- SUPPORTED_MODES
Public Class Methods
new(path, manifest)
click to toggle source
Calls superclass method
Autoproj::PackageManifest::Loader::new
# File lib/autoproj/ros_package_manifest.rb, line 26 def initialize(path, manifest) super @env = manifest.package.ws.env @condition_parser = RosConditionParser.new(@env) end
Public Instance Methods
depend_tag_end(name)
click to toggle source
# File lib/autoproj/ros_package_manifest.rb, line 84 def depend_tag_end(name) return unless handle_condition(@depend_condition) if @tag_text.strip.empty? raise InvalidPackageManifest, "found '#{name}' tag in #{path} "\ "without content" end mode = [] if (m = /^(\w+)_depend$/.match(name)) mode = SUPPORTED_MODES & [m[1]] end manifest.add_dependency(@tag_text, modes: mode) end
exportlevel_tag_end(name)
click to toggle source
# File lib/autoproj/ros_package_manifest.rb, line 53 def exportlevel_tag_end(name) return unless name == "build_type" return unless handle_condition(@build_type_condition) manifest.build_type = @tag_text.strip end
exportlevel_tag_start(name, attributes)
click to toggle source
# File lib/autoproj/ros_package_manifest.rb, line 46 def exportlevel_tag_start(name, attributes) return unless name == "build_type" @build_type_condition = attributes["condition"] @tag_text = "" end
handle_condition(expr)
click to toggle source
# File lib/autoproj/ros_package_manifest.rb, line 78 def handle_condition(expr) return true unless expr && !expr.empty? @condition_parser.evaluate(expr) end
tag_end(name)
click to toggle source
Calls superclass method
Autoproj::PackageManifest::BaseLoader#tag_end
# File lib/autoproj/ros_package_manifest.rb, line 37 def tag_end(name) super exportlevel_tag_end(name) if @export_level if @tag_level == 0 && name == "package" && (!manifest.name || manifest.name.empty?) raise InvalidPackageManifest, "Package name missiing in #{path}" end end
tag_start(name, attributes)
click to toggle source
Calls superclass method
Autoproj::PackageManifest::BaseLoader#tag_start
# File lib/autoproj/ros_package_manifest.rb, line 32 def tag_start(name, attributes) super exportlevel_tag_start(name, attributes) if @export_level end
toplevel_tag_end(name)
click to toggle source
# File lib/autoproj/ros_package_manifest.rb, line 108 def toplevel_tag_end(name) if DEPEND_TAGS.include?(name) depend_tag_end(name) elsif AUTHOR_FIELDS.include?(name) author_tag_end(name) elsif TEXT_FIELDS.include?(name) field = @tag_text.strip manifest.send("#{name}=", field) unless field.empty? elsif name == "name" manifest.name = @tag_text.strip elsif name == "export" @export_level = false end @tag_text = nil end
toplevel_tag_start(name, attributes)
click to toggle source
# File lib/autoproj/ros_package_manifest.rb, line 60 def toplevel_tag_start(name, attributes) if DEPEND_TAGS.include?(name) @depend_condition = attributes["condition"] @tag_text = "" elsif TEXT_FIELDS.include?(name) @tag_text = "" elsif AUTHOR_FIELDS.include?(name) @author_email = attributes["email"] @tag_text = "" elsif name == "name" @tag_text = "" elsif name == "export" @export_level = true else @tag_text = nil end end