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_HELPERS_POOL_H
|
---|
19 | #define _LOG4CXX_HELPERS_POOL_H
|
---|
20 |
|
---|
21 | #include <log4cxx/log4cxx.h>
|
---|
22 | #include <string>
|
---|
23 |
|
---|
24 | extern "C" {
|
---|
25 | struct apr_pool_t;
|
---|
26 | }
|
---|
27 |
|
---|
28 | namespace log4cxx
|
---|
29 | {
|
---|
30 | namespace helpers
|
---|
31 | {
|
---|
32 | class LOG4CXX_EXPORT Pool
|
---|
33 | {
|
---|
34 | public:
|
---|
35 | Pool();
|
---|
36 | Pool(apr_pool_t* pool, bool release);
|
---|
37 | ~Pool();
|
---|
38 |
|
---|
39 | apr_pool_t* getAPRPool();
|
---|
40 | apr_pool_t* create();
|
---|
41 | void* palloc(size_t length);
|
---|
42 | char* pstralloc(size_t length);
|
---|
43 | char* itoa(int n);
|
---|
44 | char* pstrndup(const char* s, size_t len);
|
---|
45 | char* pstrdup(const char*s);
|
---|
46 | char* pstrdup(const std::string&);
|
---|
47 |
|
---|
48 | protected:
|
---|
49 | apr_pool_t* pool;
|
---|
50 | const bool release;
|
---|
51 |
|
---|
52 | private:
|
---|
53 | Pool(const log4cxx::helpers::Pool&);
|
---|
54 | Pool& operator=(const Pool&);
|
---|
55 | };
|
---|
56 | } // namespace helpers
|
---|
57 | } // namespace log4cxx
|
---|
58 |
|
---|
59 | #endif //_LOG4CXX_HELPERS_POOL_H
|
---|