Apache Log4cxx
Version 1.7.0
Toggle main menu visibility
Loading...
Searching...
No Matches
patternparser.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
19
#ifndef _LOG4CXX_HELPER_PATTERN_CONVERTER_H
20
#define _LOG4CXX_HELPER_PATTERN_CONVERTER_H
21
22
#include <map>
23
#include <vector>
24
#include <functional>
25
#include <
log4cxx/helpers/class.h
>
26
#include <
log4cxx/pattern/patternconverter.h
>
27
#include <
log4cxx/pattern/formattinginfo.h
>
28
29
namespace
LOG4CXX_NS
30
{
31
namespace
pattern
32
{
33
34
typedef
std::function<PatternConverterPtr(
const
std::vector<LogString>& options)>
PatternConstructor
;
35
typedef
std::map<LogString, PatternConstructor>
PatternMap
;
36
LOG4CXX_LIST_DEF
(PatternConverterList, PatternConverterPtr);
37
38
// Contributors: Nelson Minar <(nelson@monkey.org>
39
// Igor E. Poteryaev <jah@mail.ru>
40
// Reinhard Deschler <reinhard.deschler@web.de>
41
50
class
LOG4CXX_EXPORT PatternParser
51
{
55
static
const
logchar ESCAPE_CHAR;
56
57
enum
58
{
59
LITERAL_STATE = 0,
60
CONVERTER_STATE = 1,
61
DOT_STATE = 3,
62
MIN_STATE = 4,
63
MAX_STATE = 5
64
};
65
69
PatternParser();
70
71
private
:
87
static
size_t
extractConverter(
88
logchar lastChar,
const
LogString
&
pattern
,
89
LogString::size_type i,
LogString
& convBuf,
90
LogString
& currentLiteral);
91
99
static
size_t
extractOptions(
const
LogString
&
pattern
, LogString::size_type i,
100
std::vector<LogString>& options);
101
102
public
:
103
#if LOG4CXX_ABI_VERSION <= 15
112
[[ deprecated(
"Parsing into two vectors is longer supported"
) ]]
113
static
void
parse
(
114
const
LogString
&
pattern
,
115
std::vector<PatternConverterPtr>& patternConverters,
116
std::vector<FormattingInfoPtr>& formattingInfos,
117
const
PatternMap
& rules);
118
#endif
124
static
PatternConverterList
parse
125
(
const
LogString
&
pattern
126
,
const
PatternMap
& rules
127
);
128
129
private
:
141
static
PatternConverterPtr createConverter(
142
const
LogString
& converterId,
143
LogString
& currentLiteral,
144
const
PatternMap
& rules,
145
std::vector<LogString>& options);
146
160
static
size_t
finalizeConverter(
161
logchar c,
const
LogString
&
pattern
,
size_t
i,
162
LogString
& currentLiteral,
const
FormattingInfoPtr
& formattingInfo,
163
const
PatternMap
& rules,
164
PatternConverterList& patternConverter
165
);
166
167
static
bool
isUnicodeIdentifierStart(logchar c);
168
static
bool
isUnicodeIdentifierPart(logchar c);
169
170
171
};
172
173
}
174
}
175
176
177
#endif
class.h
log4cxx::pattern::PatternParser::parse
static void parse(const LogString &pattern, std::vector< PatternConverterPtr > &patternConverters, std::vector< FormattingInfoPtr > &formattingInfos, const PatternMap &rules)
Parse a format specifier.
log4cxx::pattern::PatternParser::parse
static PatternConverterList parse(const LogString &pattern, const PatternMap &rules)
Convert pattern to converters using rules.
formattinginfo.h
log4cxx::pattern
Definition
cacheddateformat.h:26
log4cxx::pattern::PatternConstructor
std::function< PatternConverterPtr(const std::vector< LogString > &options)> PatternConstructor
Definition
patternparser.h:34
log4cxx::pattern::PatternMap
std::map< LogString, PatternConstructor > PatternMap
Definition
patternparser.h:35
log4cxx::pattern::FormattingInfoPtr
std::shared_ptr< FormattingInfo > FormattingInfoPtr
Definition
formattinginfo.h:32
log4cxx::pattern::LOG4CXX_LIST_DEF
LOG4CXX_LIST_DEF(PatternConverterList, PatternConverterPtr)
log4cxx::LogString
std::basic_string< logchar > LogString
Definition
logstring.h:60
patternconverter.h
src
main
include
log4cxx
pattern
patternparser.h
Generated by
1.17.0 on
SITE_PUBLISHED_DATE
Copyright © 2017-2026
Apache Software Foundation
. Apache, Chainsaw, log4cxx, Log4j, Log4net, log4php and the Apache logo are
trademarks or registered trademarks
of The Apache Software Foundation.
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.
Privacy Policy
.