blocxx
FileSystemMockObject.cpp
Go to the documentation of this file.
1/*******************************************************************************
2* Copyright (C) 2005, Quest Software, Inc. All rights reserved.
3* Copyright (C) 2006, Novell, Inc. All rights reserved.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7*
8* * Redistributions of source code must retain the above copyright notice,
9* this list of conditions and the following disclaimer.
10* * Redistributions in binary form must reproduce the above copyright
11* notice, this list of conditions and the following disclaimer in the
12* documentation and/or other materials provided with the distribution.
13* * Neither the name of
14* Quest Software, Inc.,
15* nor Novell, Inc.,
16* nor the names of its contributors or employees may be used to
17* endorse or promote products derived from this software without
18* specific prior written permission.
19*
20* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30* POSSIBILITY OF SUCH DAMAGE.
31*******************************************************************************/
32
33
38#include "blocxx/BLOCXX_config.h"
40#include "blocxx/Exception.hpp"
41#include "blocxx/File.hpp"
42#include "blocxx/String.hpp"
43#include "blocxx/Array.hpp"
44
45namespace BLOCXX_NAMESPACE
46{
47
48BLOCXX_DECLARE_EXCEPTION(FileSystemMockObjectUnimplemented);
49BLOCXX_DEFINE_EXCEPTION(FileSystemMockObjectUnimplemented);
50
52{
53}
54
55File
57{
59}
60File
62{
64}
65File
67{
69}
70File
72{
73 BLOCXX_THROW(FileSystemMockObjectUnimplementedException, "openForAppendOrCreateFile");
74}
75File
77{
79}
80File
82{
84}
85int
87{
89}
90bool
92{
94}
95#ifndef BLOCXX_WIN32
96bool
98{
100}
101#endif
102bool
104{
106}
107bool
109{
111}
112#ifndef BLOCXX_WIN32
113bool
115{
117}
118#endif
119bool
121{
123}
124bool
126{
128}
129bool
131{
133}
134bool
136{
138}
139UInt64
141{
143}
144bool
146{
148}
149bool
151{
153}
154bool
156{
158}
159bool
160FileSystemMockObject::renameFile(const String& oldFileName, const String& newFileName)
161{
163}
164size_t
165FileSystemMockObject::read(const FileHandle& hdl, void* bfr, size_t numberOfBytes, Int64 offset)
166{
168}
169size_t
170FileSystemMockObject::write(FileHandle hdl, const void* bfr, size_t numberOfBytes, Int64 offset)
171{
173}
174Int64
175FileSystemMockObject::seek(const FileHandle& hdl, Int64 offset, int whence)
176{
178}
179Int64
181{
183}
184void
186{
188}
189int
191{
193}
194int
196{
198}
199String
201{
203}
206{
208}
209String
211{
213}
214String
216{
218}
219
220std::pair<FileSystem::Path::ESecurity, String>
222{
224}
225
226std::pair<FileSystem::Path::ESecurity, String>
228{
230}
231
232std::pair<FileSystem::Path::ESecurity, String>
233FileSystemMockObject::security(String const & base_dir, String const & rel_path, UserId uid)
234{
236}
237
238std::pair<FileSystem::Path::ESecurity, String>
239FileSystemMockObject::security(String const & base_dir, String const & rel_path)
240{
242}
243
244String
246{
248}
249
250String
252{
254}
255
256String
258{
259 BLOCXX_THROW(FileSystemMockObjectUnimplementedException, "getCurrentWorkingDirectory");
260}
261
262
263} // end namespace BLOCXX_NAMESPACE
264
265
266
267
#define BLOCXX_DEFINE_EXCEPTION(NAME)
Define a new exception class named <NAME>Exception that derives from Exception.
Definition: Exception.hpp:439
#define BLOCXX_DECLARE_EXCEPTION(NAME)
Declare a new exception class named <NAME>Exception that derives from Exception This macro is typical...
Definition: Exception.hpp:386
#define BLOCXX_THROW(exType, msg)
Throw an exception using FILE and LINE.
Definition: Exception.hpp:263
The purpose of the File class is to provide an abstraction layer over the platform dependant function...
Definition: File.hpp:55
virtual int changeFileOwner(const String &filename, const UserId &userId)
virtual String readSymbolicLink(const String &path)
virtual bool removeFile(const String &path)
virtual bool renameFile(const String &oldFileName, const String &newFileName)
virtual bool getDirectoryContents(const String &path, StringArray &dirEntries)
virtual File openFile(const String &path)
virtual bool changeDirectory(const String &path)
virtual File openOrCreateFile(const String &path)
virtual bool makeDirectory(const String &path, int mode=0777)
virtual File openForAppendOrCreateFile(const String &path)
virtual String basename(const String &filename)
virtual String dirname(const String &filename)
virtual String realPath(const String &path)
virtual bool canRead(const String &path)
virtual bool exists(const String &path)
virtual size_t read(const FileHandle &hdl, void *bfr, size_t numberOfBytes, Int64 offset=-1L)
virtual void rewind(const FileHandle &hdl)
virtual bool isDirectory(const String &path)
virtual Int64 seek(const FileHandle &hdl, Int64 offset, int whence)
virtual bool isLink(const String &path)
virtual bool getFileSize(const String &path, Int64 &size)
virtual String getFileContents(const String &filename)
virtual std::pair< FileSystem::Path::ESecurity, String > security(String const &path, UserId uid)
virtual File createFile(const String &path)
virtual int close(const FileHandle &hdl)
virtual size_t write(FileHandle hdl, const void *bfr, size_t numberOfBytes, Int64 offset=-1L)
virtual bool removeDirectory(const String &path)
virtual bool isExecutable(const String &path)
virtual File createTempFile(const String &dir)
virtual bool canWrite(const String &path)
virtual StringArray getFileLines(const String &filename)
virtual Int64 tell(const FileHandle &hdl)
This String class is an abstract data type that represents as NULL terminated string of characters.
Definition: String.hpp:67
Taken from RFC 1321.