Skip to content

Commit

Permalink
[bindings] Added more docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelClerx committed Oct 3, 2017
1 parent 493423d commit 7810d8e
Show file tree
Hide file tree
Showing 5 changed files with 123 additions and 12 deletions.
17 changes: 10 additions & 7 deletions src/bindings/interface/component.i
Expand Up @@ -31,8 +31,8 @@ component in the `importSource`.";
"Appends `math` to the existing math string for this component.";

%feature("docstring") libcellml::Component::getMath
"Returns a math string if one has been appended for this component. Returns an
empty string if math has not been appended (or has been removed).";
"Returns a math string if one has been created for this component (empty string
if not).";

%feature("docstring") libcellml::Component::setMath
"Sets the math string for this component.
Expand All @@ -42,17 +42,20 @@ If `math` is an empty string, math will be removed from the component.";
"Adds variable `v` to this component.";

%feature("docstring") libcellml::Component::getVariable
"Returns the variable at the given index `index`, or with the given`name`.";
"Returns a Variable from this component, specified by name or index.";

%feature("docstring") libcellml::Component::hasVariable
"Tests if `variable` is in this component.";
"Tests if this component contains a given variable, specified by name or as
`Variable` object.";

%feature("docstring") libcellml::Component::removeVariable
"Removes a variable from this component, specified either by name, by index,
or by passing in the variable object.
"Removes a variable from this component, specified by name, index, or
`Variable` object.
If the variable to be removed is in a connection (is equivalent to another
variable), this component will not be serialised in the connection.";
variable), this component will not be serialised in the connection.
Returns `True` on success.";

%feature("docstring") libcellml::Component::removeAllVariables
"Clears all variables that have been added to this component.
Expand Down
13 changes: 8 additions & 5 deletions src/bindings/interface/componententity.i
Expand Up @@ -46,7 +46,7 @@ A second argument can be given to specify whether or not child components
should be searched for the component to remove.";

%feature("docstring") libcellml::ComponentEntity::getComponent
"Returns a component, specified by an index, name, or with a Component object.
"Returns a component, specified by an index or name.
A second argument can be given to specify whether or not child components
should be searched for the component to remove.";
Expand All @@ -55,21 +55,24 @@ should be searched for the component to remove.";
"Removes a component, specified by an index, name, or with a Component object.
A second argument can be given to specify whether or not child components
should be searched for the component to remove.";
should be searched for the component to remove.
Returns `True` on success.";

%feature("docstring") libcellml::ComponentEntity::removeAllComponents
"Removes all components that have been added to this entity.";

%feature("docstring") libcellml::ComponentEntity::takeComponent
"Removes and returns a component, specified by an index, name or with a
Component object.";
"Removes and returns a component, specified by an index or name.";

%feature("docstring") libcellml::ComponentEntity::replaceComponent
"Removes a component, specified by an index, name, or with a Component object,
and replaces it with the given component object (second argument).
A third argument can be given to specify whether or not child components
should be searched for the component to remove.";
should be searched for the component to remove.
Returns `True` on success.";

%feature("docstring") libcellml::ComponentEntity::componentCount
"Returns the number of components the component contains. ";
Expand Down
59 changes: 59 additions & 0 deletions src/bindings/interface/error.i
Expand Up @@ -6,6 +6,65 @@

%import "types.i"

%feature("docstring") libcellml::Error
"Base class for errors used with logger derived classes."

%feature("docstring") libcellml::Error::getDescription
"Get a string description for why this error was raised.";

%feature("docstring") libcellml::Error::setDescription
"Sets a string description for why this error was raised.";

%feature("docstring") libcellml::Error::getKind
"Get the `kind` of this error. If no kind has been set for this error, will
return Kind::UNDEFINED.";

%feature("docstring") libcellml::Error::isKind
"Tests if this error matches the given `kind`.";

%feature("docstring") libcellml::Error::setKind
"Sets the `kind` of this error.";

%feature("docstring") libcellml::Error::getRule
"Get the `SpecificationRule` of this error.";

%feature("docstring") libcellml::Error::setRule
"Sets the `SpecificationRule` for this error.";

%feature("docstring") libcellml::Error::getSpecificationHeading
"Returns the CellML 2.0 Specification heading associated with the
SpecificationRule for this error (empty string if not set).";

%feature("docstring") libcellml::Error::getComponent
"Returns the Component that this error is relevant to (or `None`).";

%feature("docstring") libcellml::Error::setComponent
"Sets the Component that this error is relevant to (`None` to unset).";

%feature("docstring") libcellml::Error::getImportSource
"Returns the ImportSource that this error is relevant to (or `None`).";

%feature("docstring") libcellml::Error::setImportSource
"Sets the ImportSource that this error is relevant to (`None` to unset).";

%feature("docstring") libcellml::Error::getModel
"Returns the Model that this error is relevant to (or `None`).";

%feature("docstring") libcellml::Error::setModel
"Sets the Model that this error is relevant to (`None` to unset).";

%feature("docstring") libcellml::Error::getUnits
"Get the Units that this error is relevant to (or `None`).";

%feature("docstring") libcellml::Error::setUnits
"Sets the Units that this error is relevant to (`None` to unset).";

%feature("docstring") libcellml::Error::getVariable
"Get the variable that this error is relevant to (or `None`).";

%feature("docstring") libcellml::Error::setVariable
"Sets the Variable that this error is relevant to (`None` to unset).";

%{
#include "libcellml/error.h"
%}
Expand Down
15 changes: 15 additions & 0 deletions src/bindings/interface/logger.i
Expand Up @@ -14,6 +14,21 @@
}
#endif

%feature("docstring") libcellml::Logger
"Base class for all serialisable libCellML classes.";

%feature("docstring") libcellml::Logger::addError
"Adds an error to this logger.";

%feature("docstring") libcellml::Logger::clearErrors
"Clears all errors from this logger.";

%feature("docstring") libcellml::Logger::getError
"Returns the error at the specified `index`.";

%feature("docstring") libcellml::Logger::errorCount
"Returns the number of errors currently stored in the logger.";

%{
#include "libcellml/logger.h"
%}
Expand Down
31 changes: 31 additions & 0 deletions src/bindings/interface/model.i
Expand Up @@ -27,6 +27,37 @@
}
#endif

%feature("docstring") libcellml::Model
"Represents a CellML model.";

%feature("docstring") libcellml::Model::addUnits
"Add a copy of the given Units to this model.";

%feature("docstring") libcellml::Model::getUnits
"Returns a Units object from this Model, specified by index or name.";

%feature("docstring") libcellml::Model::hasUnits
"Tests to see if this model has the given units, specified by name.";

%feature("docstring") libcellml::Model::removeUnits
"Removes the Units specified by index, name or Units object.
Returns `True` on success.";

%feature("docstring") libcellml::Model::removeAllUnits
"Removes all units stored in this model.";

%feature("docstring") libcellml::Model::replaceUnits
"Replaces a Units object, specified by index, name or Units object, by another
Units (second argument).
Returns `True` on success.";

%feature("docstring") libcellml::Model::takeUnits
"Removes and returns the Units specified by index or name.";

%feature("docstring") libcellml::Model::unitsCount
"Returns the number of units this model contains.";

%{
#include "libcellml/model.h"
Expand Down

0 comments on commit 7810d8e

Please sign in to comment.