From c73caa1867f5ec6f04cc7aa265f874ebdae6ea8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AB=8F=E8=A8=AA=E5=AD=90?= Date: Mon, 4 May 2026 22:58:23 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB=E3=81=AE?= =?UTF-8?q?=E8=AA=AD=E3=81=BF=E8=BE=BC=E3=81=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LICENSE.md | 21 +++++++++++++++++++++ file.cc | 22 ++++++++++++++++++++++ file.hh | 8 ++++++++ 3 files changed, 51 insertions(+) create mode 100755 LICENSE.md create mode 100755 file.cc create mode 100755 file.hh diff --git a/LICENSE.md b/LICENSE.md new file mode 100755 index 0000000..7438fdf --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,21 @@ +# 076 Free License + +Copyright (c) テクニカル諏訪子 + +Permission is hereby granted to any person obtaining a copy of the software +LibJpeg (the "Software") to use, modify, merge, copy, publish, distribute, +sublicense, and/or sell copies of the Software, subject to the following conditions: + + 1. **Origin Attribution**: + - You must not misrepresent the origin of the Software; you must not claim + you created the original Software. + 2. **Notice Preservation**: + - This license and the above copyright notice must remain intact in all copies + of the source code. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE +OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/file.cc b/file.cc new file mode 100755 index 0000000..c3a6bf1 --- /dev/null +++ b/file.cc @@ -0,0 +1,22 @@ +#include "file.hh" + +#include +#include + +vector read_file(const string &filename) { + std::ifstream file(filename, std::ios::binary | std::ios::ate); + if (!file) { + throw std::runtime_error("t@CJɎsF " + filename); + } + + const auto size = file.tellg(); + file.seekg(0); + vector data(static_cast(size)); + if (!file.read(reinterpret_cast(data.data()), size)) { + throw std::runtime_error("t@C̓ǂݍ݂ɎsB"); + } + + file.close(); + + return data; +} \ No newline at end of file diff --git a/file.hh b/file.hh new file mode 100755 index 0000000..b090c35 --- /dev/null +++ b/file.hh @@ -0,0 +1,8 @@ +#ifndef FILE_HH +#define FILE_HH + +#include "types.hh" + +vector read_file(const string &filename); + +#endif // FILE_HH \ No newline at end of file