Apache Log4cxx  Version 1.3.0
Loading...
Searching...
No Matches
optionconverter.h
Go to the documentation of this file.
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_HELPER_OPTION_CONVERTER_H
19#define _LOG4CXX_HELPER_OPTION_CONVERTER_H
20
21#include <log4cxx/logstring.h>
23
24namespace LOG4CXX_NS
25{
26class Level;
27class File;
28typedef std::shared_ptr<Level> LevelPtr;
29
30namespace spi
31{
32class LoggerRepository;
33typedef std::shared_ptr<LoggerRepository> LoggerRepositoryPtr;
34}
35
36namespace helpers
37{
38class Properties;
39
40class Object;
41typedef std::shared_ptr<Object> ObjectPtr;
42
43class Class;
44
47{
49 private:
51
52 public:
54
64 static bool toBoolean(const LogString& value, bool defaultValue);
70 static int toInt(const LogString& value, int defaultValue);
78 static long toFileSize(const LogString& value, long defaultValue);
87 static LevelPtr toLevel(const LogString& value,
88 const LevelPtr& defaultValue);
89
95 static LogString findAndSubst(const LogString& key, Properties& props);
96
131 static LogString substVars(const LogString& val, Properties& props);
132
140 static LogString getSystemProperty(const LogString& key, const LogString& def);
141
153 const Class& superClass, const ObjectPtr& defaultValue);
154
156 const LogString& key, const Class& superClass,
157 const ObjectPtr& defaultValue);
158
181 static void selectAndConfigure(const File& configFileName,
182 const LogString& clazz, spi::LoggerRepositoryPtr hierarchy, int delay = 0);
183};
184} // namespace helpers
185} // namespace log4cxx
186
187#endif //_LOG4CXX_HELPER_OPTION_CONVERTER_H
188
An abstract representation of file and directory path names.
Definition: file.h:41
Definition: class.h:32
A convenience class to convert property values to specific types.
Definition: optionconverter.h:47
static LogString getSystemProperty(const LogString &key, const LogString &def)
static long toFileSize(const LogString &value, long defaultValue)
The numeric equivalent of value if it is not empty, otherwise defaultValue.
static LogString convertSpecialChars(const LogString &s)
static ObjectPtr instantiateByKey(Properties &props, const LogString &key, const Class &superClass, const ObjectPtr &defaultValue)
static LevelPtr toLevel(const LogString &value, const LevelPtr &defaultValue)
The Level indicated by value if recognised otherwise defaultValue.
static bool toBoolean(const LogString &value, bool defaultValue)
The boolean equivalent of value if it is not empty, otherwise defaultValue.
static LogString findAndSubst(const LogString &key, Properties &props)
Find the value corresponding to key in props.
static LogString substVars(const LogString &val, Properties &props)
Perform variable substitution in string val from the values of keys found in the system propeties.
static void selectAndConfigure(const File &configFileName, const LogString &clazz, spi::LoggerRepositoryPtr hierarchy, int delay=0)
Configure log4cxx given a configFileName.
static ObjectPtr instantiateByClassName(const LogString &className, const Class &superClass, const ObjectPtr &defaultValue)
Instantiate an object given a class name.
static int toInt(const LogString &value, int defaultValue)
The numeric equivalent of value if it is not empty, otherwise defaultValue.
Definition: properties.h:33
#define LOG4CXX_EXPORT
Definition: log4cxx.h:101
#define LOG4CXX_NS
Definition: log4cxx.h:104
std::shared_ptr< Object > ObjectPtr
Definition: optionconverter.h:41
std::shared_ptr< LoggerRepository > LoggerRepositoryPtr
Definition: optionconverter.h:33
std::basic_string< logchar > LogString
Definition: logstring.h:60
std::shared_ptr< Level > LevelPtr
Definition: optionconverter.h:28