Remove C++ escaping from *Py.xml templates

Now all escaping required for the C++ code generation is done when the
.cpp/.h files are generated. Previously, only newlines were escaped
automatically. This was a) inconsistent and b) leaked c++ details into
the xml data.
In addition, the escaping is now done in one central place, harmonizing
the three previous implementations.

Pre-existing c++ escape sequences in the XML files have been replaced by
their literal equivalent so that the resulting python doc sting remains
unchanged.
This commit is contained in:
Jonas Bähr
2023-08-13 23:34:20 +02:00
committed by wwmayer
parent 05df2da6b4
commit 3e68d6fd50
25 changed files with 1193 additions and 600 deletions

View File

@@ -16,23 +16,30 @@
<Documentation>
<Author Licence="LGPL" Name="Juergen Riegel" EMail="FreeCAD@juergen-riegel.net" />
<DeveloperDocu>This is the Matrix export class</DeveloperDocu>
<UserDocu>Base.Matrix class.\n
<UserDocu>Base.Matrix class.
A 4x4 Matrix.
In particular, this matrix can represent an affine transformation, that is,
given a 3D vector `x`, apply the transformation y = M*x + b, where the matrix
`M` is a linear map and the vector `b` is a translation.
`y` can be obtained using a linear transformation represented by the 4x4 matrix
`A` conformed by the augmented 3x4 matrix (M|b), augmented by row with
(0,0,0,1), therefore: (y, 1) = A*(x, 1).\n
The following constructors are supported:\n
(0,0,0,1), therefore: (y, 1) = A*(x, 1).
The following constructors are supported:
Matrix()
Empty constructor.\n
Empty constructor.
Matrix(matrix)
Copy constructor.
matrix : Base.Matrix.\n
matrix : Base.Matrix.
Matrix(*coef)
Define from 16 coefficients of the 4x4 matrix.
coef : sequence of float\n The sequence can have up to 16 elements which complete the matrix by rows.\n
coef : sequence of float
The sequence can have up to 16 elements which complete the matrix by rows.
Matrix(vector1, vector2, vector3, vector4)
Define from four 3D vectors which represent the columns of the 3x4 submatrix,
useful to represent an affine transformation. The fourth row is made up by
@@ -40,212 +47,272 @@ useful to represent an affine transformation. The fourth row is made up by
vector1 : Base.Vector
vector2 : Base.Vector
vector3 : Base.Vector
vector4 : Base.Vector\n Default to (0,0,0). Optional.</UserDocu>
vector4 : Base.Vector
Default to (0,0,0). Optional.</UserDocu>
</Documentation>
<Methode Name="move">
<Documentation>
<UserDocu>move(vector) -> None
move(x, y, z) -> None\n
move(x, y, z) -> None
Move the matrix along a vector, equivalent to left multiply the matrix
by a pure translation transformation.\n
by a pure translation transformation.
vector : Base.Vector, tuple
x : float\n `x` translation.
y : float\n `y` translation.
z : float\n `z` translation.</UserDocu>
x : float
`x` translation.
y : float
`y` translation.
z : float
`z` translation.</UserDocu>
</Documentation>
</Methode>
<Methode Name="scale">
<Documentation>
<UserDocu>scale(vector) -> None
scale(x, y, z) -> None
scale(factor) -> None\n
Scale the first three rows of the matrix.\n
scale(factor) -> None
Scale the first three rows of the matrix.
vector : Base.Vector
x : float\n First row factor scale.
y : float\n Second row factor scale.
z : float\n Third row factor scale.
factor : float\n global factor scale.</UserDocu>
x : float
First row factor scale.
y : float
Second row factor scale.
z : float
Third row factor scale.
factor : float
global factor scale.</UserDocu>
</Documentation>
</Methode>
<Methode Name="hasScale" Const="true">
<Documentation>
<UserDocu>hasScale(tol=0) -> ScaleType\n
<UserDocu>hasScale(tol=0) -> ScaleType
Return an enum value of ScaleType. Possible values are:
Uniform, NonUniformLeft, NonUniformRight, NoScaling or Other
if it's not a scale matrix.\n
if it's not a scale matrix.
tol : float</UserDocu>
</Documentation>
</Methode>
<Methode Name="nullify">
<Documentation>
<UserDocu>nullify() -> None\n
<UserDocu>nullify() -> None
Make this the null matrix.</UserDocu>
</Documentation>
</Methode>
<Methode Name="isNull" Const="true">
<Documentation>
<UserDocu>isNull() -> bool\n
<UserDocu>isNull() -> bool
Check if this is the null matrix.</UserDocu>
</Documentation>
</Methode>
<Methode Name="unity">
<Documentation>
<UserDocu>unity() -> None\n
<UserDocu>unity() -> None
Make this matrix to unity (4D identity matrix).</UserDocu>
</Documentation>
</Methode>
<Methode Name="isUnity" Const="true">
<Documentation>
<UserDocu>isUnity() -> bool\n
<UserDocu>isUnity() -> bool
Check if this is the unit matrix (4D identity matrix).</UserDocu>
</Documentation>
</Methode>
<Methode Name="transform">
<Documentation>
<UserDocu>transform(vector, matrix2) -> None\n
<UserDocu>transform(vector, matrix2) -> None
Transform the matrix around a given point.
Equivalent to left multiply the matrix by T*M*T_inv, where M is `matrix2`, T the
translation generated by `vector` and T_inv the inverse translation.
For example, if `matrix2` is a rotation, the result is the transformation generated
by the current matrix followed by a rotation around the point represented by `vector`.\n
by the current matrix followed by a rotation around the point represented by `vector`.
vector : Base.Vector
matrix2 : Base.Matrix</UserDocu>
</Documentation>
</Methode>
<Methode Name="col" Const="true">
<Documentation>
<UserDocu>col(index) -> Base.Vector\n
<UserDocu>col(index) -> Base.Vector
Return the vector of a column, that is, the vector generated by the three
first elements of the specified column.\n
index : int\n Required column index.</UserDocu>
first elements of the specified column.
index : int
Required column index.</UserDocu>
</Documentation>
</Methode>
<Methode Name="setCol">
<Documentation>
<UserDocu>setCol(index, vector) -> None\n
<UserDocu>setCol(index, vector) -> None
Set the vector of a column, that is, the three first elements of the specified
column by index.\n
index : int\n Required column index.
column by index.
index : int
Required column index.
vector : Base.Vector</UserDocu>
</Documentation>
</Methode>
<Methode Name="row" Const="true">
<Documentation>
<UserDocu>row(index) -> Base.Vector\n
<UserDocu>row(index) -> Base.Vector
Return the vector of a row, that is, the vector generated by the three
first elements of the specified row.\n
index : int\n Required row index.</UserDocu>
first elements of the specified row.
index : int
Required row index.</UserDocu>
</Documentation>
</Methode>
<Methode Name="setRow">
<Documentation>
<UserDocu>setRow(index, vector) -> None\n
<UserDocu>setRow(index, vector) -> None
Set the vector of a row, that is, the three first elements of the specified
row by index.\n
index : int\n Required row index.
row by index.
index : int
Required row index.
vector : Base.Vector</UserDocu>
</Documentation>
</Methode>
<Methode Name="trace" Const="true">
<Documentation>
<UserDocu>trace() -> Base.Vector\n
<UserDocu>trace() -> Base.Vector
Return the diagonal of the 3x3 leading principal submatrix as vector.</UserDocu>
</Documentation>
</Methode>
<Methode Name="setTrace">
<Documentation>
<UserDocu>setTrace(vector) -> None\n
Set the diagonal of the 3x3 leading principal submatrix.\n
<UserDocu>setTrace(vector) -> None
Set the diagonal of the 3x3 leading principal submatrix.
vector : Base.Vector</UserDocu>
</Documentation>
</Methode>
<Methode Name="rotateX">
<Documentation>
<UserDocu>rotateX(angle) -> None\n
Rotate around X axis.\n
angle : float\n Angle in radians.</UserDocu>
<UserDocu>rotateX(angle) -> None
Rotate around X axis.
angle : float
Angle in radians.</UserDocu>
</Documentation>
</Methode>
<Methode Name="rotateY">
<Documentation>
<UserDocu>rotateY(angle) -> None\n
Rotate around Y axis.\n
angle : float\n Angle in radians.</UserDocu>
<UserDocu>rotateY(angle) -> None
Rotate around Y axis.
angle : float
Angle in radians.</UserDocu>
</Documentation>
</Methode>
<Methode Name="rotateZ">
<Documentation>
<UserDocu>rotateZ(angle) -> None\n
Rotate around Z axis.\n
angle : float\n Angle in radians.</UserDocu>
<UserDocu>rotateZ(angle) -> None
Rotate around Z axis.
angle : float
Angle in radians.</UserDocu>
</Documentation>
</Methode>
<Methode Name="multiply" Const="true">
<Documentation>
<UserDocu>multiply(matrix) -> Base.Matrix
multiply(vector) -> Base.Vector\n
multiply(vector) -> Base.Vector
Right multiply the matrix by the given object.
If the argument is a vector, this is augmented to the 4D vector (`vector`, 1).\n
If the argument is a vector, this is augmented to the 4D vector (`vector`, 1).
matrix : Base.Matrix
vector : Base.Vector</UserDocu>
</Documentation>
</Methode>
<Methode Name="multVec" Const="true">
<Documentation>
<UserDocu>multVec(vector) -> Base.Vector\n
Compute the transformed vector using the matrix.\n
<UserDocu>multVec(vector) -> Base.Vector
Compute the transformed vector using the matrix.
vector : Base.Vector</UserDocu>
</Documentation>
</Methode>
<Methode Name="invert">
<Documentation>
<UserDocu>invert() -> None\n
<UserDocu>invert() -> None
Compute the inverse matrix in-place, if possible.</UserDocu>
</Documentation>
</Methode>
<Methode Name="inverse" Const="true">
<Documentation><UserDocu>inverse() -> Base.Matrix\n
<Documentation><UserDocu>inverse() -> Base.Matrix
Compute the inverse matrix, if possible.</UserDocu>
</Documentation>
</Methode>
<Methode Name="transpose">
<Documentation>
<UserDocu>transpose() -> None\n
<UserDocu>transpose() -> None
Transpose the matrix in-place.</UserDocu>
</Documentation>
</Methode>
<Methode Name="transposed" Const="true">
<Documentation>
<UserDocu>transposed() -> Base.Matrix\n
<UserDocu>transposed() -> Base.Matrix
Returns a transposed copy of this matrix.</UserDocu>
</Documentation>
</Methode>
<Methode Name="determinant" Const="true">
<Documentation>
<UserDocu>determinant() -> float\n
<UserDocu>determinant() -> float
Compute the determinant of the matrix.</UserDocu>
</Documentation>
</Methode>
<Methode Name="isOrthogonal" Const="true">
<Documentation>
<UserDocu>isOrthogonal(tol=1e-6) -> float\n
<UserDocu>isOrthogonal(tol=1e-6) -> float
Checks if the matrix is orthogonal, i.e. M * M^T = k*I and returns
the multiple of the identity matrix. If it's not orthogonal 0 is returned.\n
tol : float\n Tolerance used to check orthogonality.</UserDocu>
the multiple of the identity matrix. If it's not orthogonal 0 is returned.
tol : float
Tolerance used to check orthogonality.</UserDocu>
</Documentation>
</Methode>
<Methode Name="submatrix" Const="true">
<Documentation>
<UserDocu>submatrix(dim) -> Base.Matrix\n
<UserDocu>submatrix(dim) -> Base.Matrix
Get the leading principal submatrix of the given dimension.
The (4 - `dim`) remaining dimensions are completed with the
corresponding identity matrix.\n
dim : int\n Dimension parameter must be in the range [1,4].</UserDocu>
corresponding identity matrix.
dim : int
Dimension parameter must be in the range [1,4].</UserDocu>
</Documentation>
</Methode>
<Methode Name="analyze" Const="true">
<Documentation>
<UserDocu>analyze() -> str\n
<UserDocu>analyze() -> str
Analyzes the type of transformation.</UserDocu>
</Documentation>
</Methode>