[msitools] wixl: introduce WixResolver
- From: Paolo Bonzini <pbonzini src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [msitools] wixl: introduce WixResolver
- Date: Thu, 24 Jan 2013 20:32:01 +0000 (UTC)
commit ac82ebd7518aab2ac905f5e1a2bedb9a43b830f6
Author: Paolo Bonzini <pbonzini redhat com>
Date: Thu Jan 24 21:16:42 2013 +0100
wixl: introduce WixResolver
tools/wixl/builder.vala | 22 +---------------------
tools/wixl/wix.vala | 24 ++++++++++++++++++++++++
2 files changed, 25 insertions(+), 21 deletions(-)
---
diff --git a/tools/wixl/builder.vala b/tools/wixl/builder.vala
index 55f16f6..bb5510b 100644
--- a/tools/wixl/builder.vala
+++ b/tools/wixl/builder.vala
@@ -1,6 +1,6 @@
namespace Wixl {
- class WixBuilder: WixNodeVisitor {
+ class WixBuilder: WixNodeVisitor, WixResolver {
public WixBuilder (string[] includedirs) {
add_path (".");
@@ -324,26 +324,6 @@ namespace Wixl {
SHARED,
}
- G? resolve<G> (WixElement element) throws GLib.Error {
- G? resolved = null;
-
- if (element.get_type () == typeof (G))
- resolved = element;
- else if (element is WixElementRef) {
- var ref = element as WixElementRef<G>;
- if (ref.ref_type != typeof (G))
- resolved = null;
- else if (ref.resolved == null)
- ref.resolved = find_element<G> (element.Id);
- resolved = ref.resolved;
- }
-
- if (resolved == null)
- throw new Wixl.Error.FAILED ("couldn't resolve %s", element.Id);
-
- return resolved;
- }
-
public override void visit_component (WixComponent comp) throws GLib.Error {
var attr = 0;
diff --git a/tools/wixl/wix.vala b/tools/wixl/wix.vala
index beacd2f..205721b 100644
--- a/tools/wixl/wix.vala
+++ b/tools/wixl/wix.vala
@@ -1,5 +1,29 @@
namespace Wixl {
+ public interface WixResolver {
+ public abstract G? find_element<G> (string Id);
+
+ public G? resolve<G> (WixElement element) throws GLib.Error {
+ G? resolved = null;
+
+ if (element.get_type ().is_a (typeof (G)))
+ resolved = element;
+ else if (element is WixElementRef) {
+ var ref = element as WixElementRef<G>;
+ if (!ref.ref_type.is_a (typeof (G)))
+ resolved = null;
+ else if (ref.resolved == null)
+ ref.resolved = find_element<G> (element.Id);
+ resolved = ref.resolved;
+ }
+
+ if (resolved == null)
+ throw new Wixl.Error.FAILED ("couldn't resolve %s", element.Id);
+
+ return resolved;
+ }
+ }
+
public enum VisitState {
ENTER,
INFIX,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]