Apache Log4cxx  Version 2.0.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;
34}
35
39class LOG4CXX_EXPORT File
40{
41 public:
49 File(const char* path);
53 File(const std::string& path);
54#if LOG4CXX_WCHAR_T_API
58 File(const wchar_t* path);
62 File(const std::wstring& path);
63#endif
64#if LOG4CXX_CFSTRING_API
68 File(const CFStringRef& path);
69#endif
73 File(const File& other);
77 File& operator=(const File& other);
82
87 bool hasPath() const;
91 bool exists() const;
96 size_t length() const;
100 log4cxx_time_t lastModified() const;
112 const char* getAPRPath() const;
116 File& setPath(const LogString& newValue);
117
118
122 std::vector<LogString> list() const;
123
128 bool deleteFile() const;
133 bool renameTo(const File& newValue) const;
134
144 bool mkdirs() const;
145
150 void setAutoDelete(bool newValue);
151
158 bool getAutoDelete() const;
159
160 private:
161 LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(FilePrivate, m_priv)
162};
163} // namespace log4cxx
164
165#define LOG4CXX_FILE(name) File(name)
166
167#endif // _LOG4CXX_FILE_H
File(const wchar_t *path)
The file or directory at path.
bool getAutoDelete() const
The value of the autodelete setting.
bool renameTo(const File &newValue) const
Move this file or directory to the path in newValue.
File & setPath(const LogString &newValue)
Use newValue as the file path.
bool deleteFile() const
Attempt to remove this file or directory from persistent storage.
LogString getName() const
The final portion of the file or directory path.
std::vector< LogString > list() const
A list of files if this is a directory, otherwise an empty list.
LogString getParent() const
The path without the final portion.
bool mkdirs() const
Create the directories required for this file path.
~File()
Release resouces used by this.
File(const CFStringRef &path)
The file or directory at path.
File(const std::wstring &path)
The file or directory at path.
const char * getAPRPath() const
The full file or directory path encoded for APR use.
bool exists() const
Is this a path to an existing file or directory?
File & operator=(const File &other)
Replace this with other.
File(const File &other)
A copy of other.
File()
An empty path.
File(const std::string &path)
The file or directory at path.
log4cxx_time_t lastModified() const
The microseconds since 1970-01-01 when the file indicated by this was last modified.
size_t length() const
The size in bytes of the file indicated by this.
File(const char *path)
The file or directory at path.
LogString getPath() const
The full file or directory path.
bool hasPath() const
Has a path been set?
void setAutoDelete(bool newValue)
Use newValue for whether the file is to be deleted when this object is destroyed.
const struct __CFString * CFStringRef
Definition logstring.h:30
std::basic_string< logchar > LogString
Definition logstring.h:51