00001 /* 00002 * LayoutAppender.cpp 00003 * 00004 * Copyright 2000, LifeLine Networks BV (www.lifeline.nl). All rights reserved. 00005 * Copyright 2000, Bastiaan Bakker. All rights reserved. 00006 * 00007 * See the COPYING file for the terms of usage and distribution. 00008 */ 00009 00010 #include "PortabilityImpl.hh" 00011 #include <log4cpp/LayoutAppender.hh> 00012 00013 namespace log4cpp { 00014 00015 LayoutAppender::LayoutAppender(const std::string& name) : 00016 AppenderSkeleton(name), 00017 _layout(new DefaultLayoutType()) { 00018 } 00019 00020 LayoutAppender::~LayoutAppender() { 00021 delete _layout; 00022 } 00023 00024 bool LayoutAppender::requiresLayout() const { 00025 return true; 00026 } 00027 00028 void LayoutAppender::setLayout(Layout* layout) { 00029 if (layout != _layout) { 00030 Layout *oldLayout = _layout; 00031 _layout = (layout == NULL) ? new DefaultLayoutType() : layout; 00032 delete oldLayout; 00033 } 00034 } 00035 00036 Layout& LayoutAppender::_getLayout() { 00037 return *_layout; 00038 } 00039 }