File: XmlNode.xsp

package info (click to toggle)
libwx-perl 1%3A0.9909-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 3,912 kB
  • sloc: cpp: 9,728; perl: 8,182; ansic: 626; makefile: 41
file content (175 lines) | stat: -rw-r--r-- 4,576 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
#############################################################################
## Name:        ext/xrc/XS/XmlNode.xsp
## Purpose:     XS for Wx::XmlNode
## Author:      Mattia Barbon
## Modified by:
## Created:     25/07/2003
## RCS-ID:      $Id: XmlNode.xsp 2281 2007-11-11 13:46:12Z mbarbon $
## Copyright:   (c) 2003, 2007 Mattia Barbon
## Licence:     This program is free software; you can redistribute it and/or
##              modify it under the same terms as Perl itself
#############################################################################

%module{Wx};

%typemap{wxXmlProperty*}{simple};
%typemap{wxXmlAttribute*}{simple};
%typemap{wxXmlNode*}{simple};
%typemap{wxXmlNodeType}{simple};

#if WXPERL_W_VERSION_GE( 2, 9, 0 )

%name{Wx::XmlAttribute} class wxXmlAttribute
{
    wxXmlAttribute(const wxString& name = wxEmptyString,
                   const wxString& value = wxEmptyString,
                   wxXmlAttribute* next = NULL);

    wxString GetName() const;
    wxString GetValue() const;
    wxXmlAttribute* GetNext() const;

    void SetName(const wxString& name);
    void SetValue(const wxString& value);
    void SetNext(wxXmlAttribute* next);
};

%{

void
wxXmlAttribute::Destroy()
  CODE:
    delete THIS;

%}

#else

%name{Wx::XmlProperty} class wxXmlProperty
{
    wxXmlProperty(const wxString& name = wxEmptyString,
                  const wxString& value = wxEmptyString,
                  wxXmlProperty* next = NULL);

    wxString GetName() const;
    wxString GetValue() const;
    wxXmlProperty* GetNext() const;

    void SetName(const wxString& name);
    void SetValue(const wxString& value);
    void SetNext(wxXmlProperty* next);
};

%{

void
wxXmlProperty::Destroy()
  CODE:
    delete THIS;

%}

#endif

%name{Wx::XmlNode} class wxXmlNode
{
#if WXPERL_W_VERSION_GE( 2, 9, 0 )
    wxXmlNode(wxXmlNode* parent = NULL, wxXmlNodeType type = wxXmlNodeType(0),
              const wxString& name = wxEmptyString,
              const wxString& content = wxEmptyString,
              wxXmlAttribute* props = NULL, wxXmlNode* next = NULL);
#else
    wxXmlNode(wxXmlNode* parent = NULL, wxXmlNodeType type = wxXmlNodeType(0),
              const wxString& name = wxEmptyString,
              const wxString& content = wxEmptyString,
              wxXmlProperty* props = NULL, wxXmlNode* next = NULL);
#endif

    void AddChild(wxXmlNode* child);
    void InsertChild(wxXmlNode *child, wxXmlNode *before_node);
    bool RemoveChild(wxXmlNode *child);
#if WXPERL_W_VERSION_GE( 2, 9, 0 )
    void AddAttribute(const wxString& name, const wxString& value);
    bool DeleteAttribute(const wxString& name);
#else
    void AddProperty(const wxString& name, const wxString& value);
    bool DeleteProperty(const wxString& name);
#endif

    wxXmlNodeType GetType() const;
    wxString GetName() const;
    wxString GetContent() const;

    wxXmlNode *GetParent() const;
    wxXmlNode *GetNext() const;
    wxXmlNode *GetChildren() const;

#if WXPERL_W_VERSION_GE( 2, 9, 0 )
    wxXmlAttribute *GetAttributes() const;
#else
    wxXmlProperty *GetProperties() const;
#endif
##    bool GetPropVal(const wxString& propName, wxString *value) const;
##    wxString GetPropVal(const wxString& propName,
##                        const wxString& defaultVal) const;
#if WXPERL_W_VERSION_GE( 2, 9, 0 )
    bool HasAttribute(const wxString& propName) const;
#else
    bool HasProp(const wxString& propName) const;
#endif

    void SetType(wxXmlNodeType type);
    void SetName(const wxString& name);
    void SetContent(const wxString& con);

    void SetParent(wxXmlNode *parent);
    void SetNext(wxXmlNode *next);
    void SetChildren(wxXmlNode *child);

#if WXPERL_W_VERSION_GE( 2, 9, 0 )
    void SetAttributes(wxXmlAttribute *prop);
#else
    void SetProperties(wxXmlProperty *prop);
#endif
##    void AddProperty(wxXmlProperty *prop);
};

%{

void
wxXmlNode::Destroy()
  CODE:
    delete THIS;

#if WXPERL_W_VERSION_GE( 2, 9, 0 )

SV*
wxXmlNode::GetAttribute(name, value = &PL_sv_undef)
    wxString name
    SV* value
  CODE:
    wxString tmp;
    bool ok = THIS->GetAttribute(name, &tmp);
    if( ok )
        RETVAL = wxPli_wxString_2_sv( aTHX_ tmp, NEWSV(0, 0) );
    else
        RETVAL = SvREFCNT_inc( value );
  OUTPUT: RETVAL

#else

SV*
wxXmlNode::GetPropVal(name, value = &PL_sv_undef)
    wxString name
    SV* value
  CODE:
    wxString tmp;
    bool ok = THIS->GetPropVal(name, &tmp);
    if( ok )
        RETVAL = wxPli_wxString_2_sv( aTHX_ tmp, NEWSV(0, 0) );
    else
        RETVAL = SvREFCNT_inc( value );
  OUTPUT: RETVAL

#endif
%}