|
| 1 | +// |
| 2 | +// ApacheCodeWriter.cpp |
| 3 | +// |
| 4 | +// $Id: //poco/Main/PageCompiler/src/ApacheCodeWriter.cpp#1 $ |
| 5 | +// |
| 6 | +// Copyright (c) 2008, Applied Informatics Software Engineering GmbH. |
| 7 | +// and Contributors. |
| 8 | +// |
| 9 | +// Permission is hereby granted, free of charge, to any person or organization |
| 10 | +// obtaining a copy of the software and accompanying documentation covered by |
| 11 | +// this license (the "Software") to use, reproduce, display, distribute, |
| 12 | +// execute, and transmit the Software, and to prepare derivative works of the |
| 13 | +// Software, and to permit third-parties to whom the Software is furnished to |
| 14 | +// do so, all subject to the following: |
| 15 | +// |
| 16 | +// The copyright notices in the Software and this entire statement, including |
| 17 | +// the above license grant, this restriction and the following disclaimer, |
| 18 | +// must be included in all copies of the Software, in whole or in part, and |
| 19 | +// all derivative works of the Software, unless such copies or derivative |
| 20 | +// works are solely in the form of machine-executable object code generated by |
| 21 | +// a source language processor. |
| 22 | +// |
| 23 | +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 24 | +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 25 | +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT |
| 26 | +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE |
| 27 | +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, |
| 28 | +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 29 | +// DEALINGS IN THE SOFTWARE. |
| 30 | +// |
| 31 | + |
| 32 | + |
| 33 | +#include "ApacheCodeWriter.h" |
| 34 | +#include "Page.h" |
| 35 | + |
| 36 | + |
| 37 | +ApacheCodeWriter::ApacheCodeWriter(const Page& page, const std::string& clazz): |
| 38 | + CodeWriter(page, clazz) |
| 39 | +{ |
| 40 | +} |
| 41 | + |
| 42 | + |
| 43 | +ApacheCodeWriter::~ApacheCodeWriter() |
| 44 | +{ |
| 45 | +} |
| 46 | + |
| 47 | + |
| 48 | +void ApacheCodeWriter::writeHeaderIncludes(std::ostream& ostr) |
| 49 | +{ |
| 50 | + CodeWriter::writeHeaderIncludes(ostr); |
| 51 | + ostr << "#include \"Poco/Net/HTTPRequestHandlerFactory.h\"\n"; |
| 52 | +} |
| 53 | + |
| 54 | + |
| 55 | +void ApacheCodeWriter::writeFactoryClass(std::ostream& ostr) |
| 56 | +{ |
| 57 | + ostr << "\n\n"; |
| 58 | + factoryClass(ostr, "Poco::Net::HTTPRequestHandlerFactory"); |
| 59 | +} |
| 60 | + |
| 61 | + |
| 62 | +void ApacheCodeWriter::writeImplIncludes(std::ostream& ostr) |
| 63 | +{ |
| 64 | + CodeWriter::writeImplIncludes(ostr); |
| 65 | + ostr << "#include \"Poco/ClassLibrary.h\"\n"; |
| 66 | +} |
| 67 | + |
| 68 | + |
| 69 | +void ApacheCodeWriter::writeFactory(std::ostream& ostr) |
| 70 | +{ |
| 71 | + ostr << "\n\n"; |
| 72 | + factoryImpl(ostr, ""); |
| 73 | +} |
| 74 | + |
| 75 | + |
| 76 | +void ApacheCodeWriter::writeManifest(std::ostream& ostr) |
| 77 | +{ |
| 78 | + std::string ns = page().get("page.namespace", ""); |
| 79 | + if (!ns.empty()) ns += "::"; |
| 80 | + ostr << "\n\n"; |
| 81 | + ostr << "POCO_BEGIN_MANIFEST(Poco::Net::HTTPRequestHandlerFactory)\n"; |
| 82 | + ostr << "\tPOCO_EXPORT_CLASS(" << ns << clazz() << "Factory)\n"; |
| 83 | + ostr << "POCO_END_MANIFEST\n"; |
| 84 | +} |
0 commit comments