From 0c8ee80f5fa3083895322995f90fcb8e2b5cb8fb Mon Sep 17 00:00:00 2001 From: cantor Date: Tue, 10 Mar 2009 01:46:54 +0000 Subject: [PATCH] Switch to reference parameters as appropriate. git-svn-id: https://svn.middleware.georgetown.edu/cpp-xmltooling/branches/REL_1@568 de75baf8-a10c-0410-a50a-987c0e22f00f --- xmltooling/util/TemplateEngine.cpp | 13 ++++++------- xmltooling/util/TemplateEngine.h | 4 ++-- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/xmltooling/util/TemplateEngine.cpp b/xmltooling/util/TemplateEngine.cpp index 22881e3..2333c8c 100644 --- a/xmltooling/util/TemplateEngine.cpp +++ b/xmltooling/util/TemplateEngine.cpp @@ -206,20 +206,19 @@ void TemplateEngine::process( trimspace(key); lastpos = thispos + 1; // strlen(">") } - const vector forParams = parameters.getParameterCollection(key.c_str()); - unsigned int forend = forParams.size(); - if (forend==0) { // have to go through at least once to match end tags + const vector& forParams = parameters.getParameterCollection(key.c_str()); + vector::size_type forend = forParams.size(); + if (forend == 0) { // have to go through at least once to match end tags cond = false; forend = 1; } const char *savlastpos = lastpos; - for (unsigned int i=0; i0? static_cast(&forParams[i]): &nullp; + for (vector::size_type i=0; i0 ? forParams[i] : nullp), e); } } diff --git a/xmltooling/util/TemplateEngine.h b/xmltooling/util/TemplateEngine.h index ad4027b..4023b52 100644 --- a/xmltooling/util/TemplateEngine.h +++ b/xmltooling/util/TemplateEngine.h @@ -1,5 +1,5 @@ /* - * Copyright 2001-2007 Internet2 + * Copyright 2001-2009 Internet2 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -100,7 +100,7 @@ namespace xmltooling { * @param name name of parameter collection * @return vector of parameters */ - virtual const std::vector getParameterCollection(const char* name) const { + virtual const std::vector& getParameterCollection(const char* name) const { std::map >::const_iterator i=m_collectionMap.find(name); return (i->second); } -- 2.1.4