EMMA Coverage Report (generated Mon Mar 20 21:34:30 PST 2006)
[all classes][com.moesol.generator.printer]

COVERAGE SUMMARY FOR SOURCE FILE [CniFwdTypePrinter.java]

nameclass, %method, %block, %line, %
CniFwdTypePrinter.java67%  (2/3)80%  (8/10)80%  (86/108)75%  (27/36)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class CniFwdTypePrinter$WrapIOException0%   (0/1)0%   (0/1)0%   (0/4)0%   (0/2)
CniFwdTypePrinter$WrapIOException (IOException): void 0%   (0/1)0%   (0/4)0%   (0/2)
     
class CniFwdTypePrinter100% (1/1)83%  (5/6)78%  (21/27)73%  (8/11)
arrayCxxType (Writer, Class): void 0%   (0/1)0%   (0/1)0%   (0/1)
objectCxxType (Writer, Class): void 100% (1/1)67%  (10/15)67%  (4/6)
<static initializer> 100% (1/1)100% (5/5)100% (1/1)
CniFwdTypePrinter (): void 100% (1/1)100% (3/3)100% (1/1)
getInstance (): JniTypePrinter 100% (1/1)100% (2/2)100% (1/1)
primitiveCxxType (Writer, Class): void 100% (1/1)100% (1/1)100% (1/1)
     
class CniFwdTypePrinter$BuildCxxName100% (1/1)100% (3/3)84%  (65/77)83%  (19/23)
visitPartName (String): void 100% (1/1)77%  (20/26)75%  (6/8)
visitClassName (String): void 100% (1/1)83%  (30/36)80%  (8/10)
CniFwdTypePrinter$BuildCxxName (Writer): void 100% (1/1)100% (15/15)100% (5/5)

1/*
2 * $Id: CniFwdTypePrinter.java,v 1.2 2004/05/18 23:10:52 hastings Exp $
3 *
4 * (c) Copyright, Moebius Solutions, Inc., 2004
5 *
6 *                       All Rights Reserved
7 *
8 * This material may be reproduced by or for the U. S. Government
9 * pursuant to the copyright license under the clause at
10 * DFARS 252.227-7014 (OCT 2001).
11 */
12 
13package com.moesol.generator.printer;
14 
15import java.io.*;
16 
17import com.moesol.generator.core.JniMangleFilterWriter;
18import com.moesol.generator.core.VisitClassName;
19import com.moesol.generator.visitor.*;
20 
21/**
22 * Print types out in a manner suitable for interfacing with Cni,
23 * including return types and parameters.
24 */
25public class CniFwdTypePrinter extends JniTypePrinter {
26    protected CniFwdTypePrinter() { }
27    private static CniFwdTypePrinter instance = new CniFwdTypePrinter();
28    public static JniTypePrinter getInstance() {
29        return instance;
30    }
31 
32    protected void primitiveCxxType(Writer out, Class type) throws IOException {
33    }
34    protected void arrayCxxType(Writer out, Class type) throws IOException {
35    }
36    protected void objectCxxType(Writer out, Class type) throws IOException {
37        BuildCxxName v = new BuildCxxName(out);
38        try {
39            VisitClassName.visit(type, v);
40        } catch (WrapIOException e) {
41            throw (IOException)e.getCause();
42        }
43    }
44    private static class WrapIOException extends RuntimeException {
45        public WrapIOException(IOException e) {
46            super(e);
47        }
48    }
49    private static class BuildCxxName implements ClassNameVisitor {
50        public BuildCxxName(Writer out) {
51            m_out = out;
52            m_mangled_out = new JniMangleFilterWriter(out);
53        }
54        public void visitPartName(String name) {
55            try {
56                m_out.write("namespace ");
57                m_mangled_out.write(name);
58                m_out.write(" { ");
59                m_opens++;
60            } catch (IOException e) {
61                throw new WrapIOException(e);
62            }
63        }
64        public void visitClassName(String name) {
65            try {
66                m_out.write("class ");
67                m_mangled_out.write(name);
68                m_out.write(";");
69                for (int i = 0; i < m_opens; i++) {
70                    m_out.write(" } ");
71                }
72                m_out.write("\n");
73            } catch (IOException e) {
74                throw new WrapIOException(e);
75            }
76        }
77        private int m_opens = 0;
78        private Writer m_out;
79        private JniMangleFilterWriter m_mangled_out;
80    }
81}

[all classes][com.moesol.generator.printer]
EMMA 2.0.5312 (C) Vladimir Roubtsov