| 1 | /* Copyright(C) 2011-2015 Brazil |
| 2 | |
| 3 | This library is free software; you can redistribute it and/or |
| 4 | modify it under the terms of the GNU Lesser General Public |
| 5 | License as published by the Free Software Foundation; either |
| 6 | version 2.1 of the License, or (at your option) any later version. |
| 7 | |
| 8 | This library is distributed in the hope that it will be useful, |
| 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 11 | Lesser General Public License for more details. |
| 12 | |
| 13 | You should have received a copy of the GNU Lesser General Public |
| 14 | License along with this library; if not, write to the Free Software |
| 15 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 16 | */ |
| 17 | |
| 18 | #include "file.hpp"cxx . . $ `<file>/lib/dat/file.hpp`/ |
| 19 | #include "file-impl.hpp"cxx . . $ `<file>/lib/dat/file-impl.hpp`/ |
| 20 | |
| 21 | #include <new> |
| 22 | |
| 23 | namespace grncxx . . $ grn/ { |
| 24 | namespace datcxx . . $ grn/dat/ { |
| 25 | |
| 26 | Filecxx . . $ grn/dat/File#::Filecxx . . $ grn/dat/File#File(49f6e7a06ebc5aa8).() : impl_cxx . . $ grn/dat/File#impl_.(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!) {} |
| 27 | |
| 28 | Filecxx . . $ grn/dat/File#::~cxx . . $ grn/dat/File#`~File`(ced63f7c635d850d).Filecxx . . $ grn/dat/File#() { |
| 29 | delete impl_cxx . . $ grn/dat/File#impl_.; |
| 30 | } |
| 31 | |
| 32 | void Filecxx . . $ grn/dat/File#::createcxx . . $ grn/dat/File#create(7cafb6e0818eff3b).(const char *path, UInt64cxx . . $ grn/dat/UInt64# size) { |
| 33 | Filecxx . . $ grn/dat/File# new_filecxx . . $ grn/dat/File#File(49f6e7a06ebc5aa8).; |
| 34 | new_file.impl_cxx . . $ grn/dat/File#impl_. = new (std::nothrowcxx . . $ std/nothrow.) FileImplcxx . . $ grn/dat/FileImpl#FileImpl(49f6e7a06ebc5aa8).; |
| 35 | GRN_DAT_THROW_IFcxx . . $ `lib/dat/dat.hpp:232:9`!(MEMORY_ERROR, new_file.impl_ == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!); |
| 36 | new_file.impl_cxx . . $ grn/dat/File#impl_.->createcxx . . $ grn/dat/FileImpl#create(7cafb6e0818eff3b).(path, size); |
| 37 | new_file.swapcxx . . $ grn/dat/File#swap(13ac73f2af8264d0).(this); |
| 38 | } |
| 39 | |
| 40 | void Filecxx . . $ grn/dat/File#::opencxx . . $ grn/dat/File#open(85c52e162fed56f9).(const char *path) { |
| 41 | Filecxx . . $ grn/dat/File# new_filecxx . . $ grn/dat/File#File(49f6e7a06ebc5aa8).; |
| 42 | new_file.impl_cxx . . $ grn/dat/File#impl_. = new (std::nothrowcxx . . $ std/nothrow.) FileImplcxx . . $ grn/dat/FileImpl#FileImpl(49f6e7a06ebc5aa8).; |
| 43 | GRN_DAT_THROW_IFcxx . . $ `lib/dat/dat.hpp:232:9`!(MEMORY_ERROR, new_file.impl_ == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!); |
| 44 | new_file.impl_cxx . . $ grn/dat/File#impl_.->opencxx . . $ grn/dat/FileImpl#open(85c52e162fed56f9).(path); |
| 45 | new_file.swapcxx . . $ grn/dat/File#swap(13ac73f2af8264d0).(this); |
| 46 | } |
| 47 | |
| 48 | void Filecxx . . $ grn/dat/File#::closecxx . . $ grn/dat/File#close(49f6e7a06ebc5aa8).() { |
| 49 | Filecxx . . $ grn/dat/File#File(49f6e7a06ebc5aa8).().swapcxx . . $ grn/dat/File#swap(13ac73f2af8264d0).(this); |
| 50 | } |
| 51 | |
| 52 | void *Filecxx . . $ grn/dat/File#::ptrcxx . . $ grn/dat/File#ptr(45a5c5ac6be858a8).() const { |
| 53 | return (impl_cxx . . $ grn/dat/File#impl_. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!) ? impl_cxx . . $ grn/dat/File#impl_.->ptrcxx . . $ grn/dat/FileImpl#ptr(45a5c5ac6be858a8).() : NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!; |
| 54 | } |
| 55 | |
| 56 | UInt64cxx . . $ grn/dat/UInt64# Filecxx . . $ grn/dat/File#::sizecxx . . $ grn/dat/File#size(fe4d2d262d4164a8).() const { |
| 57 | return (impl_cxx . . $ grn/dat/File#impl_. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!) ? impl_cxx . . $ grn/dat/File#impl_.->sizecxx . . $ grn/dat/FileImpl#size(fe4d2d262d4164a8).() : 0; |
| 58 | } |
| 59 | |
| 60 | void Filecxx . . $ grn/dat/File#::swapcxx . . $ grn/dat/File#swap(13ac73f2af8264d0).(Filecxx . . $ grn/dat/File# *rhs) { |
| 61 | FileImplcxx . . $ grn/dat/FileImpl# * const temp = impl_cxx . . $ grn/dat/File#impl_.; |
| 62 | impl_cxx . . $ grn/dat/File#impl_. = rhs->impl_cxx . . $ grn/dat/File#impl_.; |
| 63 | rhs->impl_cxx . . $ grn/dat/File#impl_. = temp; |
| 64 | } |
| 65 | |
| 66 | void Filecxx . . $ grn/dat/File#::flushcxx . . $ grn/dat/File#flush(49f6e7a06ebc5aa8).() { |
| 67 | if (impl_cxx . . $ grn/dat/File#impl_.) { |
| 68 | impl_cxx . . $ grn/dat/File#impl_.->flushcxx . . $ grn/dat/FileImpl#flush(49f6e7a06ebc5aa8).(); |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | } // namespace dat |
| 73 | } // namespace grn |