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