From 2a5e714d1d222cc5e27fc442c56c1a880df573d2 Mon Sep 17 00:00:00 2001 From: Andreas Stöckel Date: Tue, 3 Mar 2015 19:16:26 +0100 Subject: Converted size_t references to values --- src/core/model/Document.cpp | 17 ++++++++--------- src/core/model/Document.hpp | 23 +++++++++++------------ 2 files changed, 19 insertions(+), 21 deletions(-) (limited to 'src/core/model') diff --git a/src/core/model/Document.cpp b/src/core/model/Document.cpp index 62dad11..40c03ac 100644 --- a/src/core/model/Document.cpp +++ b/src/core/model/Document.cpp @@ -302,8 +302,7 @@ const NodeVector &DocumentEntity::getField( return fields[enforceGetFieldDescriptorIndex(descriptor, fieldDescriptor)]; } -const NodeVector &DocumentEntity::getField( - const size_t &idx) const +const NodeVector &DocumentEntity::getField(size_t idx) const { if (idx >= fields.size()) { throw OusiaException(std::string("Descriptor \"") + @@ -314,7 +313,7 @@ const NodeVector &DocumentEntity::getField( return fields[idx]; } -void DocumentEntity::addStructureNode(Handle s, const size_t &i) +void DocumentEntity::addStructureNode(Handle s, size_t i) { // only add the new node if we don't have it already. auto it = fields[i].find(s); @@ -369,7 +368,7 @@ void DocumentEntity::addStructureNodes( } bool DocumentEntity::removeStructureNodeFromField(Handle s, - const int &i) + size_t i) { auto it = fields[i].find(s); if (it != fields[i].end()) { @@ -420,8 +419,8 @@ Rooted DocumentEntity::createChildStructuredEntity( } Rooted DocumentEntity::createChildStructuredEntity( - Handle descriptor, const size_t &fieldIdx, - Variant attributes, std::string name) + Handle descriptor, size_t fieldIdx, Variant attributes, + std::string name) { return Rooted{ new StructuredEntity(subInst->getManager(), subInst, descriptor, @@ -436,7 +435,7 @@ Rooted DocumentEntity::createChildDocumentPrimitive( } Rooted DocumentEntity::createChildDocumentPrimitive( - Variant content, const size_t &fieldIdx) + Variant content, size_t fieldIdx) { return Rooted{new DocumentPrimitive( subInst->getManager(), subInst, std::move(content), fieldIdx)}; @@ -447,7 +446,7 @@ Rooted DocumentEntity::createChildAnchor(const std::string &fieldName) return Rooted{ new Anchor(subInst->getManager(), subInst, fieldName)}; } -Rooted DocumentEntity::createChildAnchor(const size_t &fieldIdx) +Rooted DocumentEntity::createChildAnchor(size_t fieldIdx) { return Rooted{new Anchor(subInst->getManager(), subInst, fieldIdx)}; } @@ -595,7 +594,7 @@ StructureNode::StructureNode(Manager &mgr, std::string name, } StructureNode::StructureNode(Manager &mgr, std::string name, - Handle parent, const size_t &fieldIdx) + Handle parent, size_t fieldIdx) : Node(mgr, std::move(name), parent) { if (parent->isa(&RttiTypes::StructuredEntity)) { diff --git a/src/core/model/Document.hpp b/src/core/model/Document.hpp index 81e2f41..8019379 100644 --- a/src/core/model/Document.hpp +++ b/src/core/model/Document.hpp @@ -258,7 +258,7 @@ public: * FieldDescriptor in the Ontology description. * @return a NodeVector of all StructuredEntities in that field. */ - const NodeVector &getField(const size_t &idx) const; + const NodeVector &getField(size_t idx) const; /** * This adds a StructureNode to the field with the given index. @@ -271,7 +271,7 @@ public: * @param fieldIdx is the index of a field as specified in the * FieldDescriptor in the Ontology description. */ - void addStructureNode(Handle s, const size_t &fieldIdx); + void addStructureNode(Handle s, size_t fieldIdx); /** * This adds a StructureNode to the field with the given name. * @@ -314,8 +314,7 @@ public: * @return true if this StructureNode was a child here and false if * if was not found. */ - bool removeStructureNodeFromField(Handle s, - const int &fieldIdx); + bool removeStructureNodeFromField(Handle s, size_t fieldIdx); /** * This removes a StructureNode from the field with the given name. * @@ -430,7 +429,7 @@ public: * @return the newly created StructuredEntity. */ Rooted createChildStructuredEntity( - Handle descriptor, const size_t &fieldIdx, + Handle descriptor, size_t fieldIdx, Variant attributes = Variant::mapType{}, std::string name = ""); /** * Creates a new DocumentPrimitive as child of this DocumentEntity. @@ -458,8 +457,8 @@ public: * * @return the newly created DocumentPrimitive. */ - Rooted createChildDocumentPrimitive( - Variant content, const size_t &fieldIdx); + Rooted createChildDocumentPrimitive(Variant content, + size_t fieldIdx); /** * Creates a new Anchor as child of this DocumentEntity. @@ -480,7 +479,7 @@ public: * * @return the newly created Anchor. */ - Rooted createChildAnchor(const size_t &fieldIdx); + Rooted createChildAnchor(size_t fieldIdx); /** * Does an inverse depth first search starting at this DocumentEntity to @@ -520,7 +519,7 @@ public: * Constructor for a StructureNode in the StructureTree. */ StructureNode(Manager &mgr, std::string name, Handle parent, - const size_t &fieldIdx); + size_t fieldIdx); /** * Constructor for an empty StructureNode. @@ -588,7 +587,7 @@ public: * for later reference. It is empty per default. */ StructuredEntity(Manager &mgr, Handle parent, - Handle descriptor, const size_t &fieldIdx, + Handle descriptor, size_t fieldIdx, Variant attributes = Variant::mapType{}, std::string name = "") : StructureNode(mgr, std::move(name), parent, fieldIdx), @@ -693,7 +692,7 @@ public: * where this DocumentPrimitive shall be added. */ DocumentPrimitive(Manager &mgr, Handle parent, Variant content, - const size_t &fieldIdx) + size_t fieldIdx) : StructureNode(mgr, "", parent, fieldIdx), content(content) { } @@ -758,7 +757,7 @@ public: * @param fieldIdx is the index of the field in the parent DocumentEntity * where this Anchor shall be added. */ - Anchor(Manager &mgr, Handle parent, const size_t &fieldIdx) + Anchor(Manager &mgr, Handle parent, size_t fieldIdx) : StructureNode(mgr, "", parent, fieldIdx) { } -- cgit v1.2.3