~ubuntu-branches/ubuntu/wily/docky/wily-proposed

« back to all changes in this revision

Viewing changes to lib/gio-sharp/generator/StructGen.cs

  • Committer: Bazaar Package Importer
  • Author(s): Christopher James Halse Rogers
  • Date: 2010-02-17 15:10:07 UTC
  • Revision ID: james.westby@ubuntu.com-20100217151007-msxpd0lsj300ndde
Tags: upstream-2.0.0
ImportĀ upstreamĀ versionĀ 2.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// GtkSharp.Generation.StructGen.cs - The Structure Generatable.
 
2
//
 
3
// Author: Mike Kestner <mkestner@speakeasy.net>
 
4
//
 
5
// Copyright (c) 2001 Mike Kestner
 
6
//
 
7
// This program is free software; you can redistribute it and/or
 
8
// modify it under the terms of version 2 of the GNU General Public
 
9
// License as published by the Free Software Foundation.
 
10
//
 
11
// This program is distributed in the hope that it will be useful,
 
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
14
// General Public License for more details.
 
15
//
 
16
// You should have received a copy of the GNU General Public
 
17
// License along with this program; if not, write to the
 
18
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 
19
// Boston, MA 02111-1307, USA.
 
20
 
 
21
 
 
22
namespace GtkSharp.Generation {
 
23
 
 
24
        using System;
 
25
        using System.IO;
 
26
        using System.Xml;
 
27
 
 
28
        public class StructGen : StructBase {
 
29
                
 
30
                public StructGen (XmlElement ns, XmlElement elem) : base (ns, elem) {}
 
31
                
 
32
                public override void Generate (GenerationInfo gen_info)
 
33
                {
 
34
                        gen_info.CurrentType = Name;
 
35
 
 
36
                        StreamWriter sw = gen_info.Writer = gen_info.OpenStream (Name);
 
37
                        base.Generate (gen_info);
 
38
                        if (GetMethod ("GetType") == null && GetMethod ("GetGType") == null) {
 
39
                                sw.WriteLine ("\t\tprivate static GLib.GType GType {");
 
40
                                sw.WriteLine ("\t\t\tget { return GLib.GType.Pointer; }");
 
41
                                sw.WriteLine ("\t\t}");
 
42
                        }
 
43
                        sw.WriteLine ("#endregion");
 
44
                        AppendCustom (sw, gen_info.CustomDir);
 
45
                        sw.WriteLine ("\t}");
 
46
                        sw.WriteLine ("}");
 
47
                        sw.Close ();
 
48
                        gen_info.Writer = null;
 
49
                        Statistics.StructCount++;
 
50
                }
 
51
        }
 
52
}
 
53