diff options
Diffstat (limited to 'src/core/model')
-rw-r--r-- | src/core/model/Document.cpp | 19 | ||||
-rw-r--r-- | src/core/model/Document.hpp | 25 |
2 files changed, 21 insertions, 23 deletions
diff --git a/src/core/model/Document.cpp b/src/core/model/Document.cpp index 1fd429b..219e512 100644 --- a/src/core/model/Document.cpp +++ b/src/core/model/Document.cpp @@ -302,8 +302,7 @@ const NodeVector<StructureNode> &DocumentEntity::getField( return fields[enforceGetFieldDescriptorIndex(descriptor, fieldDescriptor)]; } -const NodeVector<StructureNode> &DocumentEntity::getField( - const size_t &idx) const +const NodeVector<StructureNode> &DocumentEntity::getField(size_t idx) const { if (idx >= fields.size()) { throw OusiaException(std::string("Descriptor \"") + @@ -314,7 +313,7 @@ const NodeVector<StructureNode> &DocumentEntity::getField( return fields[idx]; } -void DocumentEntity::addStructureNode(Handle<StructureNode> s, const size_t &i) +void DocumentEntity::addStructureNode(Handle<StructureNode> s, size_t i) { // only add the new node if we don't have it already. auto it = fields[i].find(s); @@ -371,7 +370,7 @@ void DocumentEntity::addStructureNodes( } bool DocumentEntity::removeStructureNodeFromField(Handle<StructureNode> s, - const int &i) + size_t i) { auto it = fields[i].find(s); if (it != fields[i].end()) { @@ -422,8 +421,8 @@ Rooted<StructuredEntity> DocumentEntity::createChildStructuredEntity( } Rooted<StructuredEntity> DocumentEntity::createChildStructuredEntity( - Handle<StructuredClass> descriptor, const size_t &fieldIdx, - Variant attributes, std::string name) + Handle<StructuredClass> descriptor, size_t fieldIdx, Variant attributes, + std::string name) { return Rooted<StructuredEntity>{ new StructuredEntity(subInst->getManager(), subInst, descriptor, @@ -438,7 +437,7 @@ Rooted<DocumentPrimitive> DocumentEntity::createChildDocumentPrimitive( } Rooted<DocumentPrimitive> DocumentEntity::createChildDocumentPrimitive( - Variant content, const size_t &fieldIdx) + Variant content, size_t fieldIdx) { return Rooted<DocumentPrimitive>{new DocumentPrimitive( subInst->getManager(), subInst, std::move(content), fieldIdx)}; @@ -449,7 +448,7 @@ Rooted<Anchor> DocumentEntity::createChildAnchor(const std::string &fieldName) return Rooted<Anchor>{ new Anchor(subInst->getManager(), subInst, fieldName)}; } -Rooted<Anchor> DocumentEntity::createChildAnchor(const size_t &fieldIdx) +Rooted<Anchor> DocumentEntity::createChildAnchor(size_t fieldIdx) { return Rooted<Anchor>{new Anchor(subInst->getManager(), subInst, fieldIdx)}; } @@ -608,7 +607,7 @@ StructureNode::StructureNode(Manager &mgr, std::string name, } StructureNode::StructureNode(Manager &mgr, std::string name, - Handle<Node> parent, const size_t &fieldIdx) + Handle<Node> parent, size_t fieldIdx) : Node(mgr, std::move(name), parent) { if (parent->isa(&RttiTypes::StructuredEntity)) { @@ -998,4 +997,4 @@ const Rtti AnnotationEntity = .parent(&Node) .composedOf({&StructuredEntity, &DocumentPrimitive, &Anchor}); } -}
\ No newline at end of file +} diff --git a/src/core/model/Document.hpp b/src/core/model/Document.hpp index 2f82127..6b2ae47 100644 --- a/src/core/model/Document.hpp +++ b/src/core/model/Document.hpp @@ -260,7 +260,7 @@ public: * FieldDescriptor in the Ontology description. * @return a NodeVector of all StructuredEntities in that field. */ - const NodeVector<StructureNode> &getField(const size_t &idx) const; + const NodeVector<StructureNode> &getField(size_t idx) const; /** * This adds a StructureNode to the field with the given index. @@ -273,7 +273,7 @@ public: * @param fieldIdx is the index of a field as specified in the * FieldDescriptor in the Ontology description. */ - void addStructureNode(Handle<StructureNode> s, const size_t &fieldIdx); + void addStructureNode(Handle<StructureNode> s, size_t fieldIdx); /** * This adds a StructureNode to the field with the given name. * @@ -316,8 +316,7 @@ public: * @return true if this StructureNode was a child here and false if * if was not found. */ - bool removeStructureNodeFromField(Handle<StructureNode> s, - const int &fieldIdx); + bool removeStructureNodeFromField(Handle<StructureNode> s, size_t fieldIdx); /** * This removes a StructureNode from the field with the given name. * @@ -432,7 +431,7 @@ public: * @return the newly created StructuredEntity. */ Rooted<StructuredEntity> createChildStructuredEntity( - Handle<StructuredClass> descriptor, const size_t &fieldIdx, + Handle<StructuredClass> descriptor, size_t fieldIdx, Variant attributes = Variant::mapType{}, std::string name = ""); /** * Creates a new DocumentPrimitive as child of this DocumentEntity. @@ -460,8 +459,8 @@ public: * * @return the newly created DocumentPrimitive. */ - Rooted<DocumentPrimitive> createChildDocumentPrimitive( - Variant content, const size_t &fieldIdx); + Rooted<DocumentPrimitive> createChildDocumentPrimitive(Variant content, + size_t fieldIdx); /** * Creates a new Anchor as child of this DocumentEntity. @@ -482,7 +481,7 @@ public: * * @return the newly created Anchor. */ - Rooted<Anchor> createChildAnchor(const size_t &fieldIdx); + Rooted<Anchor> createChildAnchor(size_t fieldIdx); /** * Does an inverse depth first search starting at this DocumentEntity to @@ -522,7 +521,7 @@ public: * Constructor for a StructureNode in the StructureTree. */ StructureNode(Manager &mgr, std::string name, Handle<Node> parent, - const size_t &fieldIdx); + size_t fieldIdx); /** * Constructor for an empty StructureNode. @@ -590,7 +589,7 @@ public: * for later reference. It is empty per default. */ StructuredEntity(Manager &mgr, Handle<Node> parent, - Handle<StructuredClass> descriptor, const size_t &fieldIdx, + Handle<StructuredClass> descriptor, size_t fieldIdx, Variant attributes = Variant::mapType{}, std::string name = "") : StructureNode(mgr, std::move(name), parent, fieldIdx), @@ -695,7 +694,7 @@ public: * where this DocumentPrimitive shall be added. */ DocumentPrimitive(Manager &mgr, Handle<Node> parent, Variant content, - const size_t &fieldIdx) + size_t fieldIdx) : StructureNode(mgr, "", parent, fieldIdx), content(content) { } @@ -760,7 +759,7 @@ public: * @param fieldIdx is the index of the field in the parent DocumentEntity * where this Anchor shall be added. */ - Anchor(Manager &mgr, Handle<Node> parent, const size_t &fieldIdx) + Anchor(Manager &mgr, Handle<Node> parent, size_t fieldIdx) : StructureNode(mgr, "", parent, fieldIdx) { } @@ -1092,4 +1091,4 @@ extern const Rtti Anchor; } } -#endif /* _OUSIA_MODEL_DOCUMENT_HPP_ */
\ No newline at end of file +#endif /* _OUSIA_MODEL_DOCUMENT_HPP_ */ |