~ubuntu-branches/ubuntu/maverick/docky/maverick

« back to all changes in this revision

Viewing changes to lib/gio-sharp/generator/LPUGen.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.LPUGen.cs - unsugned long/pointer generatable.
 
2
//
 
3
// Author: Mike Kestner <mkestner@novell.com>
 
4
//
 
5
// Copyright (c) 2004 Novell, Inc.
 
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
 
 
27
        public class LPUGen : SimpleGen, IAccessor {
 
28
                
 
29
                public LPUGen (string ctype) : base (ctype, "ulong", "0") {}
 
30
 
 
31
                public override string MarshalType {
 
32
                        get {
 
33
                                return "UIntPtr";
 
34
                        }
 
35
                }
 
36
 
 
37
                public override string CallByName (string var_name)
 
38
                {
 
39
                        return "new UIntPtr (" + var_name + ")";
 
40
                }
 
41
                
 
42
                public override string FromNative(string var)
 
43
                {
 
44
                        return "(ulong) " + var;
 
45
                }
 
46
 
 
47
                public void WriteAccessors (StreamWriter sw, string indent, string var)
 
48
                {
 
49
                        sw.WriteLine (indent + "get {");
 
50
                        sw.WriteLine (indent + "\treturn " + FromNative (var) + ";");
 
51
                        sw.WriteLine (indent + "}");
 
52
                        sw.WriteLine (indent + "set {");
 
53
                        sw.WriteLine (indent + "\t" + var + " = " + CallByName ("value") + ";");
 
54
                        sw.WriteLine (indent + "}");
 
55
                }
 
56
        }
 
57
}
 
58