log4cplus
2.0.5
include
log4cplus
internal
env.h
Go to the documentation of this file.
1
// -*- C++ -*-
2
// Module: Log4CPLUS
3
// File: env.h
4
// Created: 7/2010
5
// Author: Vaclav Haisman
6
//
7
//
8
// Copyright (C) 2010-2017, Vaclav Haisman. All rights reserved.
9
//
10
// Redistribution and use in source and binary forms, with or without modifica-
11
// tion, are permitted provided that the following conditions are met:
12
//
13
// 1. Redistributions of source code must retain the above copyright notice,
14
// this list of conditions and the following disclaimer.
15
//
16
// 2. Redistributions in binary form must reproduce the above copyright notice,
17
// this list of conditions and the following disclaimer in the documentation
18
// and/or other materials provided with the distribution.
19
//
20
// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
21
// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
22
// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23
// APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
25
// DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
26
// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
27
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
31
#ifndef LOG4CPLUS_INTERNAL_ENV_H
32
#define LOG4CPLUS_INTERNAL_ENV_H
33
34
#include <
log4cplus/config.hxx
>
35
36
#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
37
#pragma once
38
#endif
39
40
#include <vector>
41
#include <
log4cplus/tstring.h
>
42
43
#if defined (_WIN32)
44
#include <
log4cplus/config/windowsh-inc.h
>
45
#endif
46
#ifdef LOG4CPLUS_HAVE_SYS_TYPES_H
47
#include <sys/types.h>
48
#endif
49
#ifdef LOG4CPLUS_HAVE_UNISTD_H
50
#include <unistd.h>
51
#endif
52
53
54
namespace
log4cplus
{
namespace
internal {
55
56
58
bool
get_env_var
(
tstring
& value,
tstring
const
& name);
59
61
bool
parse_bool
(
bool
& val,
tstring
const
& str);
62
64
bool
split_path
(std::vector<tstring> & components, std::size_t & special,
65
tstring
const
& path);
66
68
void
make_dirs
(
tstring
const
& file_path);
69
70
inline
71
#if defined (_WIN32)
72
DWORD
73
get_process_id
()
74
{
75
return
GetCurrentProcessId ();
76
}
77
78
#elif defined (LOG4CPLUS_HAVE_GETPID)
79
pid_t
80
get_process_id
()
81
{
82
return
getpid ();
83
}
84
85
#else
86
int
87
get_process_id
()
88
{
89
return
0;
90
}
91
92
#endif
93
94
95
} }
// namespace log4cplus { namespace internal {
96
97
98
#endif // LOG4CPLUS_INTERNAL_ENV_H
tstring.h
windowsh-inc.h
log4cplus
Definition:
appender.h:46
log4cplus::tstring
std::basic_string< tchar > tstring
Definition:
tstring.h:39
log4cplus::internal::make_dirs
void make_dirs(tstring const &file_path)
Makes directories leading to file.
log4cplus::internal::parse_bool
bool parse_bool(bool &val, tstring const &str)
Parse a string as a boolean value.
config.hxx
log4cplus::internal::split_path
bool split_path(std::vector< tstring > &components, std::size_t &special, tstring const &path)
Parse a path into path components.
log4cplus::internal::get_env_var
bool get_env_var(tstring &value, tstring const &name)
Get environment variable value.
log4cplus::internal::get_process_id
DWORD get_process_id()
Definition:
env.h:73
Generated on Tue Nov 3 2020 17:38:12 for log4cplus by
1.8.20