source: pacpusframework/trunk/3rd/apache-log4cxx/include/log4cxx/helpers/datelayout.h@ 51

Last change on this file since 51 was 2, checked in by sgosseli, 12 years ago

Add 3rd party libraries (log4cxx).

File size: 3.7 KB
Line 
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#ifndef _LOG4CXX_HELPERS_DATE_LAYOUT_H
19#define _LOG4CXX_HELPERS_DATE_LAYOUT_H
20
21#include <log4cxx/layout.h>
22#include <log4cxx/helpers/dateformat.h>
23#include <log4cxx/helpers/timezone.h>
24
25namespace log4cxx
26{
27 namespace helpers
28 {
29 /**
30 This abstract layout takes care of all the date related options and
31 formatting work.
32 */
33 class LOG4CXX_EXPORT DateLayout : public Layout
34 {
35 private:
36 LogString timeZoneID;
37 LogString dateFormatOption;
38
39 protected:
40 DateFormatPtr dateFormat;
41
42 public:
43 DateLayout(const LogString& dateLayoutOption);
44 virtual ~DateLayout();
45
46 virtual void activateOptions(log4cxx::helpers::Pool& p);
47 virtual void setOption(const LogString& option, const LogString& value);
48
49 /**
50 The value of the <b>DateFormat</b> option should be either an
51 argument to the constructor of helpers::DateFormat or one of
52 the strings <b>"NULL"</b>, <b>"RELATIVE"</b>, <b>"ABSOLUTE"</b>,
53 <b>"DATE"</b> or <b>"ISO8601</b>.
54 */
55 inline void setDateFormat(const LogString& dateFormat1)
56 { this->dateFormatOption.assign(dateFormat1); }
57
58 /**
59 Returns value of the <b>DateFormat</b> option.
60 */
61 inline const LogString& getDateFormat() const
62 { return dateFormatOption; }
63
64 /**
65 The <b>TimeZoneID</b> option is a time zone ID string in the format
66 expected by the <code>locale</code> C++ standard class.
67 */
68 inline void setTimeZone(const LogString& timeZone)
69 { this->timeZoneID.assign(timeZone); }
70
71 /**
72 Returns value of the <b>TimeZone</b> option.
73 */
74 inline const LogString& getTimeZone() const
75 { return timeZoneID; }
76
77 void formatDate(LogString &s,
78 const spi::LoggingEventPtr& event,
79 log4cxx::helpers::Pool& p) const;
80
81 private:
82 //
83 // prevent copy and assignment
84 DateLayout(const DateLayout&);
85 DateLayout& operator=(const DateLayout&);
86
87 };
88 } // namespace helpers
89} // namespace log4cxx
90
91#endif // _LOG4CXX_HELPERS_DATE_LAYOUT_H
Note: See TracBrowser for help on using the repository browser.