/home/martin/workspace/OpenStreetNav/src/sqllib/strings/CompositeSqlCreator.cpp
Go to the documentation of this file.
00001 /*
00002  * CompositeSqlCreator.cpp
00003  *
00004  *  Created on: Dec 5, 2011
00005  *      Author: martin
00006  */
00007 
00008 #include "CompositeSqlCreator.h"
00009 
00010 namespace sqllib
00011 {
00012 
00013 sqllib::CompositeSqlCreator::CompositeSqlCreator(std::string const& composite_operator, std::vector<std::shared_ptr<SqlCreator> > children, std::string const& ending):
00014     op(composite_operator),
00015     children(children),
00016     end(ending)
00017 {
00018 }
00019 
00020 std::string sqllib::CompositeSqlCreator::create_sql()
00021 {
00022     std::string ret;
00023     bool fst = true;
00024     for (unsigned int i = 0; i < children.size(); ++i)
00025     {
00026         if (!fst)
00027             ret += op + " ";
00028         fst = false;
00029         ret += "(" + children[i]->create_sql() + ") ";
00030     }
00031     if (children.size() != 0)
00032         ret += end;
00033     return ret;
00034 }
00035 
00036 } /* namespace sqllib */
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines