Consistent formatting of example code in the docs

This commit is contained in:
William S Fulton 2016-10-21 19:14:32 +01:00
commit 268b942865
25 changed files with 1705 additions and 1714 deletions

View file

@ -51,9 +51,9 @@ is a simple example:
<pre>
%contract sqrt(double x) {
require:
x &gt;= 0;
x &gt;= 0;
ensure:
sqrt &gt;= 0;
sqrt &gt;= 0;
}
...
@ -106,20 +106,20 @@ The <tt>%contract</tt> directive can also be applied to class methods and constr
<pre>
%contract Foo::bar(int x, int y) {
require:
x &gt; 0;
x &gt; 0;
ensure:
bar &gt; 0;
bar &gt; 0;
}
%contract Foo::Foo(int a) {
require:
a &gt; 0;
a &gt; 0;
}
class Foo {
public:
Foo(int);
int bar(int, int);
Foo(int);
int bar(int, int);
};
</pre>
</div>
@ -133,7 +133,7 @@ Thus, any contract that you specified for a base class will also be attached to
<pre>
class Spam : public Foo {
public:
int bar(int,int); // Gets contract defined for Foo::bar(int,int)
int bar(int,int); // Gets contract defined for Foo::bar(int,int)
};
</pre>
</div>
@ -146,22 +146,22 @@ In addition to this, separate contracts can be applied to both the base class an
<pre>
%contract Foo::bar(int x, int) {
require:
x &gt; 0;
x &gt; 0;
}
%contract Spam::bar(int, int y) {
require:
y &gt; 0;
y &gt; 0;
}
class Foo {
public:
int bar(int,int); // Gets Foo::bar contract.
int bar(int,int); // Gets Foo::bar contract.
};
class Spam : public Foo {
public:
int bar(int,int); // Gets Foo::bar and Spam::bar contract
int bar(int,int); // Gets Foo::bar and Spam::bar contract
};
</pre>
</div>
@ -225,7 +225,7 @@ function can be used in contracts. For example:
%contract move(SomeObject *, int direction, in) {
require:
check_direction(direction);
check_direction(direction);
}
#define UP 1
@ -246,7 +246,7 @@ Alternatively, it can be used in typemaps and other directives. For example:
%aggregate_check(int, check_direction, UP, DOWN, RIGHT, LEFT);
%typemap(check) int direction {
if (!check_direction($1)) SWIG_exception(SWIG_ValueError, "Bad direction");
if (!check_direction($1)) SWIG_exception(SWIG_ValueError, "Bad direction");
}
#define UP 1