Apache Log4cxx Version 1.0.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
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
46class LOG4CXX_EXPORT OptionConverter
47{
49 private:
51
52 public:
54
63 static bool toBoolean(const LogString& value, bool dEfault);
64 static int toInt(const LogString& value, int dEfault);
65 static long toFileSize(const LogString& value, long dEfault);
66 static LevelPtr toLevel(const LogString& value,
67 const LevelPtr& defaultValue);
68
74 static LogString findAndSubst(const LogString& key, Properties& props);
75
110 static LogString substVars(const LogString& val, Properties& props);
111
119 static LogString getSystemProperty(const LogString& key, const LogString& def);
120
132 const Class& superClass, const ObjectPtr& defaultValue);
133
135 const LogString& key, const Class& superClass,
136 const ObjectPtr& defaultValue);
137
160 static void selectAndConfigure(const File& configFileName,
161 const LogString& clazz, spi::LoggerRepositoryPtr hierarchy, int delay = 0);
162};
163} // namespace helpers
164} // namespace log4cxx
165
166#endif //_LOG4CXX_HELPER_OPTION_CONVERTER_H
167
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 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)
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 bool toBoolean(const LogString &value, bool dEfault)
If value is "true", then true is returned.
static int toInt(const LogString &value, int dEfault)
static long toFileSize(const LogString &value, long dEfault)
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.
Definition: properties.h:33
std::shared_ptr< Object > ObjectPtr
Definition: optionconverter.h:41
std::shared_ptr< LoggerRepository > LoggerRepositoryPtr
Definition: optionconverter.h:33
Definition: configuration.h:25
std::basic_string< logchar > LogString
Definition: logstring.h:60
std::shared_ptr< Level > LevelPtr
Definition: optionconverter.h:28