nomlib
Loading...
Searching...
No Matches
RocketFileInterface.hpp
1/******************************************************************************
2
3 nomlib - C++11 cross-platform game engine
4
5Copyright (c) 2013, 2014 Jeffrey Carpenter <i8degrees@gmail.com>
6All rights reserved.
7
8Redistribution and use in source and binary forms, with or without
9modification, are permitted provided that the following conditions are met:
10
111. Redistributions of source code must retain the above copyright notice, this
12 list of conditions and the following disclaimer.
132. Redistributions in binary form must reproduce the above copyright notice,
14 this list of conditions and the following disclaimer in the documentation
15 and/or other materials provided with the distribution.
16
17THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
21ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28******************************************************************************/
29#ifndef NOMLIB_GUI_ROCKET_FILE_INTERFACE_HPP
30#define NOMLIB_GUI_ROCKET_FILE_INTERFACE_HPP
31
32#include <string>
33
34#include "nomlib/config.hpp"
35
36#include <Rocket/Core/String.h>
37#include <Rocket/Core/FileInterface.h>
38
39namespace nom {
40
41/* Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
42 *
43 * Permission is hereby granted, free of charge, to any person obtaining a copy
44 * of this software and associated documentation files (the "Software"), to deal
45 * in the Software without restriction, including without limitation the rights
46 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
47 * copies of the Software, and to permit persons to whom the Software is
48 * furnished to do so, subject to the following conditions:
49 *
50 * The above copyright notice and this permission notice shall be included in
51 * all copies or substantial portions of the Software.
52 *
53 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
54 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
55 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
56 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
57 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
58 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
59 * THE SOFTWARE.
60 *
61 */
62
67
69class RocketFileInterface: public Rocket::Core::FileInterface
70{
71 public:
72 RocketFileInterface( const std::string& root );
73
74 virtual ~RocketFileInterface();
75
79 virtual void Release();
80
82 virtual Rocket::Core::FileHandle Open(const Rocket::Core::String& path);
83
85 virtual void Close(Rocket::Core::FileHandle file);
86
88 virtual nom::size_type Read(void* buffer, nom::size_type size, Rocket::Core::FileHandle file);
89
91 virtual bool Seek(Rocket::Core::FileHandle file, long offset, int origin);
92
94 virtual nom::size_type Tell(Rocket::Core::FileHandle file);
95
100 std::string root() const;
101
102 private:
103 Rocket::Core::String root_;
104};
105
106} // namespace nom
107
108#endif // include guard defined
virtual void Close(Rocket::Core::FileHandle file)
Closes a previously opened file.
virtual nom::size_type Read(void *buffer, nom::size_type size, Rocket::Core::FileHandle file)
Reads data from a previously opened file.
virtual Rocket::Core::FileHandle Open(const Rocket::Core::String &path)
Opens a file.
virtual bool Seek(Rocket::Core::FileHandle file, long offset, int origin)
Seeks to a point in a previously opened file.
virtual void Release()
Implements Rocket::Core::FileInterface::Release.
std::string root() const
Get the root directory path.
virtual nom::size_type Tell(Rocket::Core::FileHandle file)
Returns the current position of the file pointer.