Apache Log4cxx  Version 1.7.0
Loading...
Searching...
No Matches
file.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_FILE_H
19#define _LOG4CXX_FILE_H
20
21#include <log4cxx/logger.h>
22#include <log4cxx/logstring.h>
23
24extern "C" {
25 struct apr_file_t;
26 struct apr_finfo_t;
27}
28
29namespace LOG4CXX_NS
30{
31namespace helpers
32{
33class Transcoder;
34class Pool;
35}
36
40class LOG4CXX_EXPORT File
41{
42 public:
51 File(const char* path);
56 File(const std::string& path);
57#if LOG4CXX_WCHAR_T_API
62 File(const wchar_t* path);
67 File(const std::wstring& path);
68#endif
69#if LOG4CXX_UNICHAR_API || LOG4CXX_LOGCHAR_IS_UNICHAR
74 File(const UniChar* path);
79 File(const std::basic_string<UniChar>& path);
80#endif
81#if LOG4CXX_CFSTRING_API
86 File(const CFStringRef& path);
87#endif
91 File(const File& src);
95 File& operator=(const File& src);
100
105 bool exists() const;
110 size_t length() const;
115 log4cxx_time_t lastModified() const;
130 const char* getAPRPath() const;
134 File& setPath(const LogString& newVAlue);
135
136#if LOG4CXX_ABI_VERSION <= 15
146 [[ deprecated( "open is no longer supported" ) ]]
147 log4cxx_status_t open(apr_file_t** file, int flags, int perm, helpers::Pool& p) const;
148#endif
149
154 std::vector<LogString> list() const;
155
160 bool deleteFile() const;
166 bool renameTo(const File& dest) const;
167
177 bool mkdirs() const;
178
183 void setAutoDelete(bool newValue);
184
191 bool getAutoDelete() const;
192
193#if LOG4CXX_ABI_VERSION <= 15
195 [[ deprecated( "Pool is no longer required" ) ]]
196 bool exists(helpers::Pool& p) const;
198 [[ deprecated( "Pool is no longer required" ) ]]
199 size_t length(helpers::Pool& p) const;
201 [[ deprecated( "Pool is no longer required" ) ]]
202 log4cxx_time_t lastModified(helpers::Pool& p) const;
204 [[ deprecated( "Pool is no longer required" ) ]]
205 std::vector<LogString> list(helpers::Pool& p) const;
207 [[ deprecated( "Pool is no longer required" ) ]]
208 bool deleteFile(helpers::Pool& p) const;
210 [[ deprecated( "Pool is no longer required" ) ]]
211 bool renameTo(const File& dest, helpers::Pool& p) const;
213 [[ deprecated( "Pool is no longer required" ) ]]
216 [[ deprecated( "Pool is no longer required" ) ]]
217 bool mkdirs(helpers::Pool& p) const;
218#endif
219 private:
220 LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(FilePrivate, m_priv)
221};
222} // namespace log4cxx
223
224#define LOG4CXX_FILE(name) File(name)
225
226#endif // _LOG4CXX_FILE_H
bool renameTo(const File &dest, helpers::Pool &1) const
File(const wchar_t *path)
Construct a new instance.
bool getAutoDelete() const
Provides the value of the autodelete setting.
LogString getParent(helpers::Pool &1) const
File(const std::basic_string< UniChar > &path)
Construct a new instance.
bool deleteFile() const
Delete this file.
LogString getName() const
Provides the final portion of file path.
bool mkdirs(helpers::Pool &1) const
std::vector< LogString > list() const
List files if current file is a directory.
File & operator=(const File &src)
Assignment operator.
LogString getParent() const
Provides the path of parent directory.
bool mkdirs() const
Create the directories required for this file path.
File & setPath(const LogString &newVAlue)
Use newValue as the file path.
size_t length(helpers::Pool &1) const
log4cxx_status_t open(apr_file_t **file, int flags, int perm, helpers::Pool &1) const
Open this file.
~File()
Destructor.
File(const CFStringRef &path)
Construct a new instance.
File(const std::wstring &path)
Construct a new instance.
std::vector< LogString > list(helpers::Pool &1) const
const char * getAPRPath() const
Provides the file path.
bool deleteFile(helpers::Pool &1) const
bool exists() const
Determines if file exists.
log4cxx_time_t lastModified(helpers::Pool &1) const
File(const File &src)
Copy constructor.
bool exists(helpers::Pool &1) const
File()
Construct a new instance.
bool renameTo(const File &dest) const
Rename this file.
File(const std::string &path)
Construct a new instance.
log4cxx_time_t lastModified() const
Provides the last modification date.
size_t length() const
Provides the length of the file.
File(const char *path)
Construct a new instance.
LogString getPath() const
Provides the file path.
void setAutoDelete(bool newValue)
Use newValue for whether the file is to be deleted when this object is destroyed.
File(const UniChar *path)
Construct a new instance.
Definition pool.h:33
const struct __CFString * CFStringRef
Definition logstring.h:30
std::basic_string< logchar > LogString
Definition logstring.h:60
unsigned short UniChar
Definition logstring.h:38