pimgen: Add new Mako templates

Add three new templates in preparation for another round of refactoring.

argument - For rendering array arguments.
method - For rendering method calls.
signature - For rendering dbus signature arguments.

Change-Id: I9f9806bcb5c1e048aa283e76f9c6f0f8a7bb53ac
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/argument.mako.cpp b/argument.mako.cpp
new file mode 100644
index 0000000..0bd4a19
--- /dev/null
+++ b/argument.mako.cpp
@@ -0,0 +1,3 @@
+{
+${indent(1)}${(',\n' + indent(1)).join([val.argument(loader, indent=indent +1) for val in arg.values])}
+${indent(0)}}\
diff --git a/method.mako.cpp b/method.mako.cpp
new file mode 100644
index 0000000..6450193
--- /dev/null
+++ b/method.mako.cpp
@@ -0,0 +1,9 @@
+${'::'.join(method.namespace + [method.name])}\
+% if method.templates:
+<${(',\n' + indent(1)).join([t.qualified() for t in method.templates])}>\
+% endif
+(\
+% if method.args:
+
+${indent(1)}${(',\n' + indent(1)).join([arg.argument(loader, indent=indent +1) for arg in method.args])})\
+% endif
diff --git a/pimgen.py b/pimgen.py
index 0b6cb6b..9c177c1 100755
--- a/pimgen.py
+++ b/pimgen.py
@@ -86,6 +86,16 @@
 
         return m
 
+    def call(self, loader, indent):
+        return self.render(
+            loader,
+            'method.mako.cpp',
+            method=self,
+            indent=indent)
+
+    def argument(self, loader, indent):
+        return self.call(loader, indent)
+
 
 class Filter(MethodCall):
     '''Provide common attributes for any filter.'''
@@ -111,6 +121,13 @@
         kw.clear()
         super(DbusSignature, self).__init__(**kw)
 
+    def argument(self, loader, indent):
+        return self.render(
+            loader,
+            'signature.mako.cpp',
+            signature=self,
+            indent=indent)
+
 
 class DestroyObject(Action):
     '''Render a destroyObject action.'''
diff --git a/signature.mako.cpp b/signature.mako.cpp
new file mode 100644
index 0000000..008aeab
--- /dev/null
+++ b/signature.mako.cpp
@@ -0,0 +1,9 @@
+% for i, s in enumerate(signature.sig.items()):
+    % if i == 0:
+${'"{0}=\'{1}\',"'.format(*s)}
+    % elif i + 1 == len(signature.sig):
+${indent(1)}${'"{0}=\'{1}\'"'.format(*s)}\
+    % else:
+${indent(1)}${'"{0}=\'{1}\',"'.format(*s)}
+    % endif
+% endfor