Apache Log4cxx  Version 2.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_NS
25{
26class Level;
27class File;
28typedef std::shared_ptr<Level> LevelPtr;
29
30
31namespace helpers
32{
33class Properties;
34
35class Class;
36
38class LOG4CXX_EXPORT OptionConverter
39{
41 private:
42 OptionConverter() {}
43
44 public:
46
56 static bool toBoolean(const LogString& value, bool defaultValue);
62 static int toInt(const LogString& value, int defaultValue);
70 static long toFileSize(const LogString& value, long defaultValue);
79 static LevelPtr toLevel(const LogString& value,
80 const LevelPtr& defaultValue);
81
87 static LogString findAndSubst(const LogString& key, Properties& props);
88
123 static LogString substVars(const LogString& val, Properties& props);
124
132 static LogString getSystemProperty(const LogString& key, const LogString& def);
133
144 static ObjectPtr instantiateByClassName(const LogString& className,
145 const Class& superClass, const ObjectPtr& defaultValue);
146
147 static ObjectPtr instantiateByKey(Properties& props,
148 const LogString& key, const Class& superClass,
149 const ObjectPtr& defaultValue);
150
166 ( const File& configFileName
167 , const LogString& className = {}
168 , const spi::LoggerRepositoryPtr& target = {}
169 , int millisecondDelay = 0
170 );
171};
172} // namespace helpers
173} // namespace log4cxx
174
175#endif //_LOG4CXX_HELPER_OPTION_CONVERTER_H
176
An abstract representation of file and directory path names.
Definition file.h:41
Definition class.h:32
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 spi::ConfigurationStatus selectAndConfigure(const File &configFileName, const LogString &className={}, const spi::LoggerRepositoryPtr &target={}, int millisecondDelay=0)
Use the information in configFileName to configure Log4cxx.
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 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
Definition propertysetter.h:27
std::shared_ptr< LoggerRepository > LoggerRepositoryPtr
Definition repositoryselector.h:28
ConfigurationStatus
Definition configurator.h:31
std::basic_string< logchar > LogString
Definition logstring.h:51
std::shared_ptr< Level > LevelPtr
Definition optionconverter.h:28