/src/logging-log4cxx/src/main/cpp/loader.cpp
Line | Count | Source (jump to first uncovered 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 | | #include <log4cxx/logstring.h> |
19 | | #include <log4cxx/helpers/loader.h> |
20 | | #include <log4cxx/appender.h> |
21 | | #include <log4cxx/spi/filter.h> |
22 | | #include <log4cxx/helpers/loglog.h> |
23 | | #include <log4cxx/spi/loggerfactory.h> |
24 | | #include <log4cxx/spi/loggerrepository.h> |
25 | | #include <log4cxx/helpers/object.h> |
26 | | #include <log4cxx/spi/errorhandler.h> |
27 | | #include <log4cxx/filter/denyallfilter.h> |
28 | | #include <log4cxx/spi/repositoryselector.h> |
29 | | #include <log4cxx/spi/appenderattachable.h> |
30 | | #include <log4cxx/helpers/xml.h> |
31 | | #include <log4cxx/spi/triggeringeventevaluator.h> |
32 | | #include <fstream> |
33 | | #include <log4cxx/helpers/transcoder.h> |
34 | | #include <log4cxx/helpers/fileinputstream.h> |
35 | | |
36 | | using namespace LOG4CXX_NS; |
37 | | using namespace LOG4CXX_NS::helpers; |
38 | | using namespace LOG4CXX_NS::spi; |
39 | | using namespace LOG4CXX_NS::filter; |
40 | | |
41 | | IMPLEMENT_LOG4CXX_OBJECT(Object) |
42 | | IMPLEMENT_LOG4CXX_OBJECT(OptionHandler) |
43 | | IMPLEMENT_LOG4CXX_OBJECT(ErrorHandler) |
44 | | IMPLEMENT_LOG4CXX_OBJECT(Appender) |
45 | | IMPLEMENT_LOG4CXX_OBJECT(Filter) |
46 | | IMPLEMENT_LOG4CXX_OBJECT(AppenderAttachable) |
47 | | IMPLEMENT_LOG4CXX_OBJECT(LoggerFactory) |
48 | | IMPLEMENT_LOG4CXX_OBJECT(LoggerRepository) |
49 | | IMPLEMENT_LOG4CXX_OBJECT(DenyAllFilter) |
50 | | IMPLEMENT_LOG4CXX_OBJECT(RepositorySelector) |
51 | | IMPLEMENT_LOG4CXX_OBJECT(XMLDOMNode) |
52 | | IMPLEMENT_LOG4CXX_OBJECT(XMLDOMDocument) |
53 | | IMPLEMENT_LOG4CXX_OBJECT(XMLDOMElement) |
54 | | IMPLEMENT_LOG4CXX_OBJECT(XMLDOMNodeList) |
55 | | IMPLEMENT_LOG4CXX_OBJECT(TriggeringEventEvaluator) |
56 | | |
57 | | const Class& Loader::loadClass(const LogString& clazz) |
58 | 2 | { |
59 | 2 | return Class::forName(clazz); |
60 | 2 | } |
61 | | |
62 | | |
63 | | InputStreamPtr Loader::getResourceAsStream(const LogString& name) |
64 | 0 | { |
65 | |
|
66 | 0 | try |
67 | 0 | { |
68 | 0 | return std::make_shared<FileInputStream>(name); |
69 | 0 | } |
70 | 0 | catch (const IOException&) |
71 | 0 | { |
72 | 0 | } |
73 | | |
74 | 0 | return 0; |
75 | 0 | } |