1 /* This file is part of Metaproxy.
2 Copyright (C) 2005-2011 Index Data
4 Metaproxy is free software; you can redistribute it and/or modify it under
5 the terms of the GNU General Public License as published by the Free
6 Software Foundation; either version 2, or (at your option) any later
9 Metaproxy is distributed in the hope that it will be useful, but WITHOUT ANY
10 WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 #include <metaproxy/xmlutil.hpp>
23 namespace mp = metaproxy_1;
24 // Doxygen doesn't like mp::xml, so we use this instead
25 namespace mp_xml = metaproxy_1::xml;
27 void mp_xml::url_recipe_handle(xmlDoc *doc, std::string recipe)
29 if (recipe.length() == 0)
33 size_t p0 = 0, p1 = 0;
36 p1 = recipe.find_first_of("${", p0);
37 if (p1 == std::string::npos)
39 result += recipe.substr(p0);
42 result += recipe.substr(p0, p1 - p0);
44 int step = 0; // 0=variable, 1=pattern, 2=replacement, 3=mode
47 std::string replacement;
50 while (p0 < recipe.length() && step < 5)
85 if (variable.length())
96 * c-file-style: "Stroustrup"
97 * indent-tabs-mode: nil
99 * vim: shiftwidth=4 tabstop=8 expandtab