More consistent formatting of examples in documentation
This commit is contained in:
parent
c454f2ce2f
commit
04131a988f
8 changed files with 161 additions and 160 deletions
|
|
@ -1275,7 +1275,7 @@ Foo *BarToFoo(Bar *b) {
|
|||
}
|
||||
|
||||
Foo *IncrFoo(Foo *f, int i) {
|
||||
return f+i;
|
||||
return f+i;
|
||||
}
|
||||
%}
|
||||
</pre>
|
||||
|
|
@ -1385,7 +1385,7 @@ example, consider this:
|
|||
<div class="code">
|
||||
<pre>
|
||||
struct Bar {
|
||||
int x[16];
|
||||
int x[16];
|
||||
};
|
||||
</pre>
|
||||
</div>
|
||||
|
|
@ -1715,9 +1715,9 @@ Similarly, if you have a class like this,
|
|||
<pre>
|
||||
class Foo {
|
||||
public:
|
||||
Foo();
|
||||
Foo(const Foo &);
|
||||
...
|
||||
Foo();
|
||||
Foo(const Foo &);
|
||||
...
|
||||
};
|
||||
</pre>
|
||||
</div>
|
||||
|
|
@ -1950,11 +1950,11 @@ For example:
|
|||
%rename(Bar_spam) Bar::spam;
|
||||
|
||||
namespace Foo {
|
||||
int spam();
|
||||
int spam();
|
||||
}
|
||||
|
||||
namespace Bar {
|
||||
int spam();
|
||||
int spam();
|
||||
}
|
||||
</pre>
|
||||
</div>
|
||||
|
|
@ -2165,9 +2165,9 @@ have a class like this
|
|||
<pre>
|
||||
class Foo {
|
||||
public:
|
||||
int x;
|
||||
int spam(int);
|
||||
...
|
||||
int x;
|
||||
int spam(int);
|
||||
...
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
|
|
@ -2178,19 +2178,19 @@ then SWIG transforms it into a set of low-level procedural wrappers. For example
|
|||
<div class="code">
|
||||
<pre>
|
||||
Foo *new_Foo() {
|
||||
return new Foo();
|
||||
return new Foo();
|
||||
}
|
||||
void delete_Foo(Foo *f) {
|
||||
delete f;
|
||||
delete f;
|
||||
}
|
||||
int Foo_x_get(Foo *f) {
|
||||
return f->x;
|
||||
return f->x;
|
||||
}
|
||||
void Foo_x_set(Foo *f, int value) {
|
||||
f->x = value;
|
||||
f->x = value;
|
||||
}
|
||||
int Foo_spam(Foo *f, int arg1) {
|
||||
return f->spam(arg1);
|
||||
return f->spam(arg1);
|
||||
}
|
||||
</pre>
|
||||
</div>
|
||||
|
|
@ -2309,10 +2309,10 @@ please refer to the python documentation:</p>
|
|||
<div class="code">
|
||||
<pre>
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
PyObject *dict;
|
||||
PyObject *args;
|
||||
PyObject *message;
|
||||
PyObject_HEAD
|
||||
PyObject *dict;
|
||||
PyObject *args;
|
||||
PyObject *message;
|
||||
} PyBaseExceptionObject;
|
||||
</pre>
|
||||
</div>
|
||||
|
|
@ -2322,12 +2322,12 @@ typedef struct {
|
|||
<div class="code">
|
||||
<pre>
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
void *ptr;
|
||||
swig_type_info *ty;
|
||||
int own;
|
||||
PyObject *next;
|
||||
PyObject *dict;
|
||||
PyObject_HEAD
|
||||
void *ptr;
|
||||
swig_type_info *ty;
|
||||
int own;
|
||||
PyObject *next;
|
||||
PyObject *dict;
|
||||
} SwigPyObject;
|
||||
</pre>
|
||||
</div>
|
||||
|
|
@ -2338,13 +2338,13 @@ typedef struct {
|
|||
<pre>
|
||||
class MyException {
|
||||
public:
|
||||
MyException (const char *msg_);
|
||||
~MyException ();
|
||||
MyException (const char *msg_);
|
||||
~MyException ();
|
||||
|
||||
const char *what () const;
|
||||
const char *what () const;
|
||||
|
||||
private:
|
||||
char *msg;
|
||||
char *msg;
|
||||
};
|
||||
</pre>
|
||||
</div>
|
||||
|
|
@ -2371,9 +2371,9 @@ strings, you can define an <tt>'operator+ (const char*)'</tt> method :</p>
|
|||
<pre>
|
||||
class MyString {
|
||||
public:
|
||||
MyString (const char *init);
|
||||
MyString operator+ (const char *other) const;
|
||||
...
|
||||
MyString (const char *init);
|
||||
MyString operator+ (const char *other) const;
|
||||
...
|
||||
};
|
||||
</pre>
|
||||
</div>
|
||||
|
|
@ -2472,11 +2472,12 @@ slot entries. For example, suppose you have this class:
|
|||
<pre>
|
||||
class Twit {
|
||||
public:
|
||||
Twit operator+ (const Twit& twit) const;
|
||||
Twit operator+ (const Twit& twit) const;
|
||||
|
||||
// Forward to operator+
|
||||
Twit add (const Twit& twit) const
|
||||
{ return *this + twit; }
|
||||
// Forward to operator+
|
||||
Twit add (const Twit& twit) const {
|
||||
return *this + twit;
|
||||
}
|
||||
};
|
||||
</pre>
|
||||
</div>
|
||||
|
|
@ -2635,8 +2636,8 @@ ownership of the result. For example:
|
|||
<pre>
|
||||
class Foo {
|
||||
public:
|
||||
Foo();
|
||||
Foo bar();
|
||||
Foo();
|
||||
Foo bar();
|
||||
};
|
||||
</pre>
|
||||
</div>
|
||||
|
|
@ -2665,9 +2666,9 @@ they came from. Therefore, the ownership is set to zero. For example:
|
|||
<pre>
|
||||
class Foo {
|
||||
public:
|
||||
...
|
||||
Foo *spam();
|
||||
...
|
||||
...
|
||||
Foo *spam();
|
||||
...
|
||||
};
|
||||
</pre>
|
||||
</div>
|
||||
|
|
@ -2706,8 +2707,8 @@ or global variable. For example, consider this interface:
|
|||
%module example
|
||||
|
||||
struct Foo {
|
||||
int value;
|
||||
Foo *next;
|
||||
int value;
|
||||
Foo *next;
|
||||
};
|
||||
|
||||
Foo *head = 0;
|
||||
|
|
@ -2938,15 +2939,15 @@ the methods one() and two() (but not three()):
|
|||
%feature("director") Foo;
|
||||
class Foo {
|
||||
public:
|
||||
Foo(int foo);
|
||||
virtual ~Foo();
|
||||
virtual void one();
|
||||
virtual void two();
|
||||
Foo(int foo);
|
||||
virtual ~Foo();
|
||||
virtual void one();
|
||||
virtual void two();
|
||||
};
|
||||
|
||||
class Bar: public Foo {
|
||||
public:
|
||||
virtual void three();
|
||||
virtual void three();
|
||||
};
|
||||
</pre>
|
||||
</div>
|
||||
|
|
@ -3090,8 +3091,8 @@ public:
|
|||
};
|
||||
class FooContainer {
|
||||
public:
|
||||
void addFoo(Foo *);
|
||||
...
|
||||
void addFoo(Foo *);
|
||||
...
|
||||
};
|
||||
</pre>
|
||||
</div>
|
||||
|
|
@ -3161,8 +3162,8 @@ suitable exception handler:
|
|||
<div class="code">
|
||||
<pre>
|
||||
%exception {
|
||||
try { $action }
|
||||
catch (Swig::DirectorException &e) { SWIG_fail; }
|
||||
try { $action }
|
||||
catch (Swig::DirectorException &e) { SWIG_fail; }
|
||||
}
|
||||
</pre>
|
||||
</div>
|
||||
|
|
@ -3239,7 +3240,7 @@ references, such as
|
|||
<pre>
|
||||
class Foo {
|
||||
…
|
||||
virtual const int& bar();
|
||||
virtual const int& bar();
|
||||
…
|
||||
};
|
||||
</pre>
|
||||
|
|
@ -3257,7 +3258,7 @@ types, wherever possible, for example
|
|||
<pre>
|
||||
class Foo {
|
||||
…
|
||||
virtual int bar();
|
||||
virtual int bar();
|
||||
…
|
||||
};
|
||||
</pre>
|
||||
|
|
@ -3510,7 +3511,7 @@ def bar(*args):
|
|||
|
||||
class Foo {
|
||||
public:
|
||||
int bar(int x);
|
||||
int bar(int x);
|
||||
};
|
||||
</pre>
|
||||
</div>
|
||||
|
|
@ -3547,7 +3548,7 @@ proxy, just before the return statement.
|
|||
|
||||
class Foo {
|
||||
public:
|
||||
int bar(int x);
|
||||
int bar(int x);
|
||||
};
|
||||
</pre>
|
||||
</div>
|
||||
|
|
@ -3576,7 +3577,7 @@ SWIG version 1.3.28 you can use the directive forms
|
|||
|
||||
class Foo {
|
||||
public:
|
||||
int bar(int x);
|
||||
int bar(int x);
|
||||
};
|
||||
</pre>
|
||||
</div>
|
||||
|
|
@ -3605,8 +3606,8 @@ as it will then get attached to all the overloaded C++ methods. For example:
|
|||
|
||||
class Foo {
|
||||
public:
|
||||
int bar(int x);
|
||||
int bar();
|
||||
int bar(int x);
|
||||
int bar();
|
||||
};
|
||||
</pre>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue