法律出的なちんこ
守矢諏訪子 <suwako@076.moe>、2026-06-26 08:16
コミット dea5906aa9761fda40b929373cf010bd7cd49bf2
・親 6957179
・ファイルを見る
47個のファイル、+761 -463
変更
LICENSE.md
| @@ -1,3 +1,5 @@ | ||
| 1 | +# 076 License | |
| 2 | + | |
| 1 | 3 | Copyright (c) テクニカル諏訪子 |
| 2 | 4 | |
| 3 | 5 | Permission is hereby granted to any person obtaining a copy of the software |
| @@ -1,3 +1,39 @@ | ||
| 1 | +/* | |
| 2 | +# 076 License | |
| 3 | + | |
| 4 | +Copyright (c) テクニカル諏訪子 | |
| 5 | + | |
| 6 | +Permission is hereby granted to any person obtaining a copy of the software | |
| 7 | +Shader Playground (the "Software") to use, modify, merge, copy, publish, distribute, | |
| 8 | +sublicense, and/or sell copies of the Software, subject to the following conditions: | |
| 9 | + | |
| 10 | + 1. **Origin Attribution**: | |
| 11 | + - You must not misrepresent the origin of the Software; you must not claim | |
| 12 | + you created the original Software. | |
| 13 | + - If the Software is used in a product, you must either: | |
| 14 | + a. Provide clear attribution in the product's documentation, user interface, | |
| 15 | + or other visible areas, **OR** | |
| 16 | + b. Pay the original developers a fee they specify in writing. | |
| 17 | + 2. **Usage Restriction**: | |
| 18 | + - The Software, or any derivative works, dependencies, or libraries | |
| 19 | + incorporating it, must not be used for censorship or to suppress freedom of | |
| 20 | + speech, expression, or creativity. Prohibited uses include, but are not | |
| 21 | + limited to: | |
| 22 | + - Censorship of so-called "hate speech", visuals, non-mainstream opinions, | |
| 23 | + ideas, or objective reality. | |
| 24 | + - Tools or systems designed to restrict access to information or | |
| 25 | + artistic works. | |
| 26 | + 3. **Notice Preservation**: | |
| 27 | + - This license and the above copyright notice must remain intact in all copies | |
| 28 | + of the source code. | |
| 29 | + | |
| 30 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, | |
| 31 | +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A | |
| 32 | +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | |
| 33 | +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF | |
| 34 | +CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE | |
| 35 | +OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
| 36 | +*/ | |
| 1 | 37 | #pragma once |
| 2 | 38 | |
| 3 | 39 | #include <database/setup.hh> |
| @@ -1,4 +1,6 @@ | ||
| 1 | 1 | /* |
| 2 | +# 076 License | |
| 3 | + | |
| 2 | 4 | Copyright (c) テクニカル諏訪子 |
| 3 | 5 | |
| 4 | 6 | Permission is hereby granted to any person obtaining a copy of the software |
| @@ -34,9 +36,9 @@ | ||
| 34 | 36 | */ |
| 35 | 37 | #pragma once |
| 36 | 38 | |
| 37 | -namespace sqlite { | |
| 39 | +namespace sqlitepp { | |
| 38 | 40 | class Instance; |
| 39 | -} // namespace sqlite | |
| 41 | +} // namespace sqlitepp | |
| 40 | 42 | |
| 41 | 43 | namespace db { |
| 42 | 44 | enum class ShaderCodeType { |
| @@ -48,5 +50,5 @@ | ||
| 48 | 50 | |
| 49 | 51 | // 初期設定。 |
| 50 | 52 | // 既に存在したら、見逃す。 |
| 51 | - void Initialize(sqlite::Instance &db); | |
| 53 | + void Initialize(sqlitepp::Instance &db); | |
| 52 | 54 | } // namespace db |
| @@ -1,4 +1,6 @@ | ||
| 1 | 1 | /* |
| 2 | +# 076 License | |
| 3 | + | |
| 2 | 4 | Copyright (c) テクニカル諏訪子 |
| 3 | 5 | |
| 4 | 6 | Permission is hereby granted to any person obtaining a copy of the software |
| @@ -37,9 +39,9 @@ | ||
| 37 | 39 | #include <util/types.hh> |
| 38 | 40 | #include <database/setup.hh> |
| 39 | 41 | |
| 40 | -namespace sqlite { | |
| 42 | +namespace sqlitepp { | |
| 41 | 43 | class Instance; |
| 42 | -} // namespace sqlite | |
| 44 | +} // namespace sqlitepp | |
| 43 | 45 | |
| 44 | 46 | namespace db { |
| 45 | 47 | struct CodeData { |
| @@ -58,6 +60,6 @@ | ||
| 58 | 60 | CodeData luaCode = {}; |
| 59 | 61 | }; |
| 60 | 62 | |
| 61 | - vector<ShaderData> GetAllShaders(sqlite::Instance &db); | |
| 62 | - void SaveCode(sqlite::Instance &db, const CodeData &data); | |
| 63 | + vector<ShaderData> GetAllShaders(sqlitepp::Instance &db); | |
| 64 | + void SaveCode(sqlitepp::Instance &db, const CodeData &data); | |
| 63 | 65 | } // namespace db |
| @@ -1,3 +1,39 @@ | ||
| 1 | +/* | |
| 2 | +# 076 License | |
| 3 | + | |
| 4 | +Copyright (c) テクニカル諏訪子 | |
| 5 | + | |
| 6 | +Permission is hereby granted to any person obtaining a copy of the software | |
| 7 | +Shader Playground (the "Software") to use, modify, merge, copy, publish, distribute, | |
| 8 | +sublicense, and/or sell copies of the Software, subject to the following conditions: | |
| 9 | + | |
| 10 | + 1. **Origin Attribution**: | |
| 11 | + - You must not misrepresent the origin of the Software; you must not claim | |
| 12 | + you created the original Software. | |
| 13 | + - If the Software is used in a product, you must either: | |
| 14 | + a. Provide clear attribution in the product's documentation, user interface, | |
| 15 | + or other visible areas, **OR** | |
| 16 | + b. Pay the original developers a fee they specify in writing. | |
| 17 | + 2. **Usage Restriction**: | |
| 18 | + - The Software, or any derivative works, dependencies, or libraries | |
| 19 | + incorporating it, must not be used for censorship or to suppress freedom of | |
| 20 | + speech, expression, or creativity. Prohibited uses include, but are not | |
| 21 | + limited to: | |
| 22 | + - Censorship of so-called "hate speech", visuals, non-mainstream opinions, | |
| 23 | + ideas, or objective reality. | |
| 24 | + - Tools or systems designed to restrict access to information or | |
| 25 | + artistic works. | |
| 26 | + 3. **Notice Preservation**: | |
| 27 | + - This license and the above copyright notice must remain intact in all copies | |
| 28 | + of the source code. | |
| 29 | + | |
| 30 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, | |
| 31 | +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A | |
| 32 | +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | |
| 33 | +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF | |
| 34 | +CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE | |
| 35 | +OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
| 36 | +*/ | |
| 1 | 37 | #pragma once |
| 2 | 38 | |
| 3 | 39 | #include <gui/guiengine.hh> |
| @@ -1,3 +1,39 @@ | ||
| 1 | +/* | |
| 2 | +# 076 License | |
| 3 | + | |
| 4 | +Copyright (c) テクニカル諏訪子 | |
| 5 | + | |
| 6 | +Permission is hereby granted to any person obtaining a copy of the software | |
| 7 | +Shader Playground (the "Software") to use, modify, merge, copy, publish, distribute, | |
| 8 | +sublicense, and/or sell copies of the Software, subject to the following conditions: | |
| 9 | + | |
| 10 | + 1. **Origin Attribution**: | |
| 11 | + - You must not misrepresent the origin of the Software; you must not claim | |
| 12 | + you created the original Software. | |
| 13 | + - If the Software is used in a product, you must either: | |
| 14 | + a. Provide clear attribution in the product's documentation, user interface, | |
| 15 | + or other visible areas, **OR** | |
| 16 | + b. Pay the original developers a fee they specify in writing. | |
| 17 | + 2. **Usage Restriction**: | |
| 18 | + - The Software, or any derivative works, dependencies, or libraries | |
| 19 | + incorporating it, must not be used for censorship or to suppress freedom of | |
| 20 | + speech, expression, or creativity. Prohibited uses include, but are not | |
| 21 | + limited to: | |
| 22 | + - Censorship of so-called "hate speech", visuals, non-mainstream opinions, | |
| 23 | + ideas, or objective reality. | |
| 24 | + - Tools or systems designed to restrict access to information or | |
| 25 | + artistic works. | |
| 26 | + 3. **Notice Preservation**: | |
| 27 | + - This license and the above copyright notice must remain intact in all copies | |
| 28 | + of the source code. | |
| 29 | + | |
| 30 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, | |
| 31 | +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A | |
| 32 | +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | |
| 33 | +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF | |
| 34 | +CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE | |
| 35 | +OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
| 36 | +*/ | |
| 1 | 37 | #pragma once |
| 2 | 38 | |
| 3 | 39 | #include <util/types.hh> |
| @@ -1,4 +1,6 @@ | ||
| 1 | 1 | /* |
| 2 | +# 076 License | |
| 3 | + | |
| 2 | 4 | Copyright (c) テクニカル諏訪子 |
| 3 | 5 | |
| 4 | 6 | Permission is hereby granted to any person obtaining a copy of the software |
| @@ -1,4 +1,6 @@ | ||
| 1 | 1 | /* |
| 2 | +# 076 License | |
| 3 | + | |
| 2 | 4 | Copyright (c) テクニカル諏訪子 |
| 3 | 5 | |
| 4 | 6 | Permission is hereby granted to any person obtaining a copy of the software |
| @@ -1,4 +1,6 @@ | ||
| 1 | 1 | /* |
| 2 | +# 076 License | |
| 3 | + | |
| 2 | 4 | Copyright (c) テクニカル諏訪子 |
| 3 | 5 | |
| 4 | 6 | Permission is hereby granted to any person obtaining a copy of the software |
| @@ -1,3 +1,39 @@ | ||
| 1 | +/* | |
| 2 | +# 076 License | |
| 3 | + | |
| 4 | +Copyright (c) テクニカル諏訪子 | |
| 5 | + | |
| 6 | +Permission is hereby granted to any person obtaining a copy of the software | |
| 7 | +Shader Playground (the "Software") to use, modify, merge, copy, publish, distribute, | |
| 8 | +sublicense, and/or sell copies of the Software, subject to the following conditions: | |
| 9 | + | |
| 10 | + 1. **Origin Attribution**: | |
| 11 | + - You must not misrepresent the origin of the Software; you must not claim | |
| 12 | + you created the original Software. | |
| 13 | + - If the Software is used in a product, you must either: | |
| 14 | + a. Provide clear attribution in the product's documentation, user interface, | |
| 15 | + or other visible areas, **OR** | |
| 16 | + b. Pay the original developers a fee they specify in writing. | |
| 17 | + 2. **Usage Restriction**: | |
| 18 | + - The Software, or any derivative works, dependencies, or libraries | |
| 19 | + incorporating it, must not be used for censorship or to suppress freedom of | |
| 20 | + speech, expression, or creativity. Prohibited uses include, but are not | |
| 21 | + limited to: | |
| 22 | + - Censorship of so-called "hate speech", visuals, non-mainstream opinions, | |
| 23 | + ideas, or objective reality. | |
| 24 | + - Tools or systems designed to restrict access to information or | |
| 25 | + artistic works. | |
| 26 | + 3. **Notice Preservation**: | |
| 27 | + - This license and the above copyright notice must remain intact in all copies | |
| 28 | + of the source code. | |
| 29 | + | |
| 30 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, | |
| 31 | +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A | |
| 32 | +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | |
| 33 | +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF | |
| 34 | +CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE | |
| 35 | +OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
| 36 | +*/ | |
| 1 | 37 | #pragma once |
| 2 | 38 | |
| 3 | 39 | #include <util/types.hh> |
| @@ -1,3 +1,39 @@ | ||
| 1 | +/* | |
| 2 | +# 076 License | |
| 3 | + | |
| 4 | +Copyright (c) テクニカル諏訪子 | |
| 5 | + | |
| 6 | +Permission is hereby granted to any person obtaining a copy of the software | |
| 7 | +Shader Playground (the "Software") to use, modify, merge, copy, publish, distribute, | |
| 8 | +sublicense, and/or sell copies of the Software, subject to the following conditions: | |
| 9 | + | |
| 10 | + 1. **Origin Attribution**: | |
| 11 | + - You must not misrepresent the origin of the Software; you must not claim | |
| 12 | + you created the original Software. | |
| 13 | + - If the Software is used in a product, you must either: | |
| 14 | + a. Provide clear attribution in the product's documentation, user interface, | |
| 15 | + or other visible areas, **OR** | |
| 16 | + b. Pay the original developers a fee they specify in writing. | |
| 17 | + 2. **Usage Restriction**: | |
| 18 | + - The Software, or any derivative works, dependencies, or libraries | |
| 19 | + incorporating it, must not be used for censorship or to suppress freedom of | |
| 20 | + speech, expression, or creativity. Prohibited uses include, but are not | |
| 21 | + limited to: | |
| 22 | + - Censorship of so-called "hate speech", visuals, non-mainstream opinions, | |
| 23 | + ideas, or objective reality. | |
| 24 | + - Tools or systems designed to restrict access to information or | |
| 25 | + artistic works. | |
| 26 | + 3. **Notice Preservation**: | |
| 27 | + - This license and the above copyright notice must remain intact in all copies | |
| 28 | + of the source code. | |
| 29 | + | |
| 30 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, | |
| 31 | +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A | |
| 32 | +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | |
| 33 | +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF | |
| 34 | +CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE | |
| 35 | +OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
| 36 | +*/ | |
| 1 | 37 | #pragma once |
| 2 | 38 | |
| 3 | 39 | #include <util/types.hh> |
| @@ -1,4 +1,6 @@ | ||
| 1 | 1 | /* |
| 2 | +# 076 License | |
| 3 | + | |
| 2 | 4 | Copyright (c) テクニカル諏訪子 |
| 3 | 5 | |
| 4 | 6 | Permission is hereby granted to any person obtaining a copy of the software |
| @@ -1,4 +1,6 @@ | ||
| 1 | 1 | /* |
| 2 | +# 076 License | |
| 3 | + | |
| 2 | 4 | Copyright (c) テクニカル諏訪子 |
| 3 | 5 | |
| 4 | 6 | Permission is hereby granted to any person obtaining a copy of the software |
| @@ -1,3 +1,39 @@ | ||
| 1 | +/* | |
| 2 | +# 076 License | |
| 3 | + | |
| 4 | +Copyright (c) テクニカル諏訪子 | |
| 5 | + | |
| 6 | +Permission is hereby granted to any person obtaining a copy of the software | |
| 7 | +Shader Playground (the "Software") to use, modify, merge, copy, publish, distribute, | |
| 8 | +sublicense, and/or sell copies of the Software, subject to the following conditions: | |
| 9 | + | |
| 10 | + 1. **Origin Attribution**: | |
| 11 | + - You must not misrepresent the origin of the Software; you must not claim | |
| 12 | + you created the original Software. | |
| 13 | + - If the Software is used in a product, you must either: | |
| 14 | + a. Provide clear attribution in the product's documentation, user interface, | |
| 15 | + or other visible areas, **OR** | |
| 16 | + b. Pay the original developers a fee they specify in writing. | |
| 17 | + 2. **Usage Restriction**: | |
| 18 | + - The Software, or any derivative works, dependencies, or libraries | |
| 19 | + incorporating it, must not be used for censorship or to suppress freedom of | |
| 20 | + speech, expression, or creativity. Prohibited uses include, but are not | |
| 21 | + limited to: | |
| 22 | + - Censorship of so-called "hate speech", visuals, non-mainstream opinions, | |
| 23 | + ideas, or objective reality. | |
| 24 | + - Tools or systems designed to restrict access to information or | |
| 25 | + artistic works. | |
| 26 | + 3. **Notice Preservation**: | |
| 27 | + - This license and the above copyright notice must remain intact in all copies | |
| 28 | + of the source code. | |
| 29 | + | |
| 30 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, | |
| 31 | +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A | |
| 32 | +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | |
| 33 | +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF | |
| 34 | +CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE | |
| 35 | +OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
| 36 | +*/ | |
| 1 | 37 | #pragma once |
| 2 | 38 | |
| 3 | 39 | #include <lua/luaengine.hh> |
| @@ -1,4 +1,6 @@ | ||
| 1 | 1 | /* |
| 2 | +# 076 License | |
| 3 | + | |
| 2 | 4 | Copyright (c) テクニカル諏訪子 |
| 3 | 5 | |
| 4 | 6 | Permission is hereby granted to any person obtaining a copy of the software |
| @@ -1,3 +1,39 @@ | ||
| 1 | +/* | |
| 2 | +# 076 License | |
| 3 | + | |
| 4 | +Copyright (c) テクニカル諏訪子 | |
| 5 | + | |
| 6 | +Permission is hereby granted to any person obtaining a copy of the software | |
| 7 | +Shader Playground (the "Software") to use, modify, merge, copy, publish, distribute, | |
| 8 | +sublicense, and/or sell copies of the Software, subject to the following conditions: | |
| 9 | + | |
| 10 | + 1. **Origin Attribution**: | |
| 11 | + - You must not misrepresent the origin of the Software; you must not claim | |
| 12 | + you created the original Software. | |
| 13 | + - If the Software is used in a product, you must either: | |
| 14 | + a. Provide clear attribution in the product's documentation, user interface, | |
| 15 | + or other visible areas, **OR** | |
| 16 | + b. Pay the original developers a fee they specify in writing. | |
| 17 | + 2. **Usage Restriction**: | |
| 18 | + - The Software, or any derivative works, dependencies, or libraries | |
| 19 | + incorporating it, must not be used for censorship or to suppress freedom of | |
| 20 | + speech, expression, or creativity. Prohibited uses include, but are not | |
| 21 | + limited to: | |
| 22 | + - Censorship of so-called "hate speech", visuals, non-mainstream opinions, | |
| 23 | + ideas, or objective reality. | |
| 24 | + - Tools or systems designed to restrict access to information or | |
| 25 | + artistic works. | |
| 26 | + 3. **Notice Preservation**: | |
| 27 | + - This license and the above copyright notice must remain intact in all copies | |
| 28 | + of the source code. | |
| 29 | + | |
| 30 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, | |
| 31 | +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A | |
| 32 | +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | |
| 33 | +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF | |
| 34 | +CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE | |
| 35 | +OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
| 36 | +*/ | |
| 1 | 37 | #pragma once |
| 2 | 38 | |
| 3 | 39 | #include <shader/shader.hh> |
| @@ -1,4 +1,6 @@ | ||
| 1 | 1 | /* |
| 2 | +# 076 License | |
| 3 | + | |
| 2 | 4 | Copyright (c) テクニカル諏訪子 |
| 3 | 5 | |
| 4 | 6 | Permission is hereby granted to any person obtaining a copy of the software |
| @@ -1,4 +1,6 @@ | ||
| 1 | 1 | /* |
| 2 | +# 076 License | |
| 3 | + | |
| 2 | 4 | Copyright (c) テクニカル諏訪子 |
| 3 | 5 | |
| 4 | 6 | Permission is hereby granted to any person obtaining a copy of the software |
| @@ -1,9 +1,45 @@ | ||
| 1 | +/* | |
| 2 | +# 076 License | |
| 3 | + | |
| 4 | +Copyright (c) テクニカル諏訪子 | |
| 5 | + | |
| 6 | +Permission is hereby granted to any person obtaining a copy of the software | |
| 7 | +Shader Playground (the "Software") to use, modify, merge, copy, publish, distribute, | |
| 8 | +sublicense, and/or sell copies of the Software, subject to the following conditions: | |
| 9 | + | |
| 10 | + 1. **Origin Attribution**: | |
| 11 | + - You must not misrepresent the origin of the Software; you must not claim | |
| 12 | + you created the original Software. | |
| 13 | + - If the Software is used in a product, you must either: | |
| 14 | + a. Provide clear attribution in the product's documentation, user interface, | |
| 15 | + or other visible areas, **OR** | |
| 16 | + b. Pay the original developers a fee they specify in writing. | |
| 17 | + 2. **Usage Restriction**: | |
| 18 | + - The Software, or any derivative works, dependencies, or libraries | |
| 19 | + incorporating it, must not be used for censorship or to suppress freedom of | |
| 20 | + speech, expression, or creativity. Prohibited uses include, but are not | |
| 21 | + limited to: | |
| 22 | + - Censorship of so-called "hate speech", visuals, non-mainstream opinions, | |
| 23 | + ideas, or objective reality. | |
| 24 | + - Tools or systems designed to restrict access to information or | |
| 25 | + artistic works. | |
| 26 | + 3. **Notice Preservation**: | |
| 27 | + - This license and the above copyright notice must remain intact in all copies | |
| 28 | + of the source code. | |
| 29 | + | |
| 30 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, | |
| 31 | +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A | |
| 32 | +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | |
| 33 | +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF | |
| 34 | +CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE | |
| 35 | +OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
| 36 | +*/ | |
| 1 | 37 | #pragma once |
| 2 | 38 | |
| 3 | 39 | #include <util/glfwpp.hh> |
| 4 | 40 | #include <util/types.hh> |
| 5 | 41 | #include <util/vector.hh> |
| 6 | -#include <util/sqlite.hh> | |
| 42 | +#include <util/sqlitepp.hh> | |
| 7 | 43 | #include <util/structs.hh> |
| 8 | 44 | #include <util/random.hh> |
| 9 | 45 | // #include <util/file.hh> |
| @@ -1,27 +1,16 @@ | ||
| 1 | 1 | /* |
| 2 | +# 076 Free License | |
| 3 | + | |
| 2 | 4 | Copyright (c) テクニカル諏訪子 |
| 3 | 5 | |
| 4 | 6 | Permission is hereby granted to any person obtaining a copy of the software |
| 5 | -Shader Playground (the "Software") to use, modify, merge, copy, publish, distribute, | |
| 7 | +C++ Utils (the "Software") to use, modify, merge, copy, publish, distribute, | |
| 6 | 8 | sublicense, and/or sell copies of the Software, subject to the following conditions: |
| 7 | 9 | |
| 8 | 10 | 1. **Origin Attribution**: |
| 9 | 11 | - You must not misrepresent the origin of the Software; you must not claim |
| 10 | 12 | you created the original Software. |
| 11 | - - If the Software is used in a product, you must either: | |
| 12 | - a. Provide clear attribution in the product's documentation, user interface, | |
| 13 | - or other visible areas, **OR** | |
| 14 | - b. Pay the original developers a fee they specify in writing. | |
| 15 | - 2. **Usage Restriction**: | |
| 16 | - - The Software, or any derivative works, dependencies, or libraries | |
| 17 | - incorporating it, must not be used for censorship or to suppress freedom of | |
| 18 | - speech, expression, or creativity. Prohibited uses include, but are not | |
| 19 | - limited to: | |
| 20 | - - Censorship of so-called "hate speech", visuals, non-mainstream opinions, | |
| 21 | - ideas, or objective reality. | |
| 22 | - - Tools or systems designed to restrict access to information or | |
| 23 | - artistic works. | |
| 24 | - 3. **Notice Preservation**: | |
| 13 | + 2. **Notice Preservation**: | |
| 25 | 14 | - This license and the above copyright notice must remain intact in all copies |
| 26 | 15 | of the source code. |
| 27 | 16 |
| @@ -1,27 +1,16 @@ | ||
| 1 | 1 | /* |
| 2 | +# 076 Free License | |
| 3 | + | |
| 2 | 4 | Copyright (c) テクニカル諏訪子 |
| 3 | 5 | |
| 4 | 6 | Permission is hereby granted to any person obtaining a copy of the software |
| 5 | -Shader Playground (the "Software") to use, modify, merge, copy, publish, distribute, | |
| 7 | +C++ Utils (the "Software") to use, modify, merge, copy, publish, distribute, | |
| 6 | 8 | sublicense, and/or sell copies of the Software, subject to the following conditions: |
| 7 | 9 | |
| 8 | 10 | 1. **Origin Attribution**: |
| 9 | 11 | - You must not misrepresent the origin of the Software; you must not claim |
| 10 | 12 | you created the original Software. |
| 11 | - - If the Software is used in a product, you must either: | |
| 12 | - a. Provide clear attribution in the product's documentation, user interface, | |
| 13 | - or other visible areas, **OR** | |
| 14 | - b. Pay the original developers a fee they specify in writing. | |
| 15 | - 2. **Usage Restriction**: | |
| 16 | - - The Software, or any derivative works, dependencies, or libraries | |
| 17 | - incorporating it, must not be used for censorship or to suppress freedom of | |
| 18 | - speech, expression, or creativity. Prohibited uses include, but are not | |
| 19 | - limited to: | |
| 20 | - - Censorship of so-called "hate speech", visuals, non-mainstream opinions, | |
| 21 | - ideas, or objective reality. | |
| 22 | - - Tools or systems designed to restrict access to information or | |
| 23 | - artistic works. | |
| 24 | - 3. **Notice Preservation**: | |
| 13 | + 2. **Notice Preservation**: | |
| 25 | 14 | - This license and the above copyright notice must remain intact in all copies |
| 26 | 15 | of the source code. |
| 27 | 16 |
| @@ -1,27 +1,16 @@ | ||
| 1 | 1 | /* |
| 2 | +# 076 Free License | |
| 3 | + | |
| 2 | 4 | Copyright (c) テクニカル諏訪子 |
| 3 | 5 | |
| 4 | 6 | Permission is hereby granted to any person obtaining a copy of the software |
| 5 | -Shader Playground (the "Software") to use, modify, merge, copy, publish, distribute, | |
| 7 | +C++ Utils (the "Software") to use, modify, merge, copy, publish, distribute, | |
| 6 | 8 | sublicense, and/or sell copies of the Software, subject to the following conditions: |
| 7 | 9 | |
| 8 | 10 | 1. **Origin Attribution**: |
| 9 | 11 | - You must not misrepresent the origin of the Software; you must not claim |
| 10 | 12 | you created the original Software. |
| 11 | - - If the Software is used in a product, you must either: | |
| 12 | - a. Provide clear attribution in the product's documentation, user interface, | |
| 13 | - or other visible areas, **OR** | |
| 14 | - b. Pay the original developers a fee they specify in writing. | |
| 15 | - 2. **Usage Restriction**: | |
| 16 | - - The Software, or any derivative works, dependencies, or libraries | |
| 17 | - incorporating it, must not be used for censorship or to suppress freedom of | |
| 18 | - speech, expression, or creativity. Prohibited uses include, but are not | |
| 19 | - limited to: | |
| 20 | - - Censorship of so-called "hate speech", visuals, non-mainstream opinions, | |
| 21 | - ideas, or objective reality. | |
| 22 | - - Tools or systems designed to restrict access to information or | |
| 23 | - artistic works. | |
| 24 | - 3. **Notice Preservation**: | |
| 13 | + 2. **Notice Preservation**: | |
| 25 | 14 | - This license and the above copyright notice must remain intact in all copies |
| 26 | 15 | of the source code. |
| 27 | 16 |
削除
include/util/sqlite.hh
| @@ -1,92 +0,0 @@ | ||
| 1 | -/* | |
| 2 | -Copyright (c) テクニカル諏訪子 | |
| 3 | - | |
| 4 | -Permission is hereby granted to any person obtaining a copy of the software | |
| 5 | -Shader Playground (the "Software") to use, modify, merge, copy, publish, distribute, | |
| 6 | -sublicense, and/or sell copies of the Software, subject to the following conditions: | |
| 7 | - | |
| 8 | - 1. **Origin Attribution**: | |
| 9 | - - You must not misrepresent the origin of the Software; you must not claim | |
| 10 | - you created the original Software. | |
| 11 | - - If the Software is used in a product, you must either: | |
| 12 | - a. Provide clear attribution in the product's documentation, user interface, | |
| 13 | - or other visible areas, **OR** | |
| 14 | - b. Pay the original developers a fee they specify in writing. | |
| 15 | - 2. **Usage Restriction**: | |
| 16 | - - The Software, or any derivative works, dependencies, or libraries | |
| 17 | - incorporating it, must not be used for censorship or to suppress freedom of | |
| 18 | - speech, expression, or creativity. Prohibited uses include, but are not | |
| 19 | - limited to: | |
| 20 | - - Censorship of so-called "hate speech", visuals, non-mainstream opinions, | |
| 21 | - ideas, or objective reality. | |
| 22 | - - Tools or systems designed to restrict access to information or | |
| 23 | - artistic works. | |
| 24 | - 3. **Notice Preservation**: | |
| 25 | - - This license and the above copyright notice must remain intact in all copies | |
| 26 | - of the source code. | |
| 27 | - | |
| 28 | -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, | |
| 29 | -INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A | |
| 30 | -PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | |
| 31 | -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF | |
| 32 | -CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE | |
| 33 | -OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
| 34 | -*/ | |
| 35 | -#ifndef SQLITE_HH | |
| 36 | -#define SQLITE_HH | |
| 37 | - | |
| 38 | -#include <util/types.hh> | |
| 39 | - | |
| 40 | -struct sqlite3; | |
| 41 | -struct sqlite3_stmt; | |
| 42 | -struct sqlite3_value; | |
| 43 | - | |
| 44 | -namespace sqlite { | |
| 45 | - class Instance { | |
| 46 | - public: | |
| 47 | - Instance(); | |
| 48 | - ~Instance(); | |
| 49 | - | |
| 50 | - sqlite3 *GetDB() { return m_pDB; } | |
| 51 | - bool Exec(string sql); | |
| 52 | - i64 GetLastInsertId(); | |
| 53 | - | |
| 54 | - private: | |
| 55 | - sqlite3 *m_pDB; | |
| 56 | - }; // class Instance | |
| 57 | - | |
| 58 | - class Stmt { | |
| 59 | - public: | |
| 60 | - Stmt(sqlite3 *pDB); | |
| 61 | - ~Stmt(); | |
| 62 | - | |
| 63 | - bool Prepare(const std::string &sql); | |
| 64 | - bool BindBlob(int index, any data, u32 size); | |
| 65 | - bool BindBlob64(int index, any data, u64 size); | |
| 66 | - bool BindDouble(int index, f64 data); | |
| 67 | - bool BindInt(int index, i32 data); | |
| 68 | - bool BindInt64(int index, i64 data); | |
| 69 | - bool BindNull(int index); | |
| 70 | - bool BindText(int index, const string &data); | |
| 71 | - bool BindText16(int index, const string &data); | |
| 72 | - bool BindText64(int index, const string &data); | |
| 73 | - | |
| 74 | - const void *ColumnBlob(int col); | |
| 75 | - f64 ColumnDouble(int col); | |
| 76 | - int ColumnInt(int col); | |
| 77 | - i64 ColumnInt64(int col); | |
| 78 | - string ColumnText(int col); | |
| 79 | - //const any ColumnText16(int col); | |
| 80 | - sqlite3_value *ColumnValue(int col); | |
| 81 | - int ColumnBytes(int col); | |
| 82 | - int ColumnBytes16(int col); | |
| 83 | - int ColumnType(int col); | |
| 84 | - int Step(); | |
| 85 | - | |
| 86 | - private: | |
| 87 | - sqlite3 *m_pDB; | |
| 88 | - sqlite3_stmt *m_pSTMT = nullptr; | |
| 89 | - }; // class Stmt | |
| 90 | -} // namespace sqlite | |
| 91 | - | |
| 92 | -#endif |
| @@ -0,0 +1,81 @@ | ||
| 1 | +/* | |
| 2 | +# 076 Free License | |
| 3 | + | |
| 4 | +Copyright (c) テクニカル諏訪子 | |
| 5 | + | |
| 6 | +Permission is hereby granted to any person obtaining a copy of the software | |
| 7 | +C++ Utils (the "Software") to use, modify, merge, copy, publish, distribute, | |
| 8 | +sublicense, and/or sell copies of the Software, subject to the following conditions: | |
| 9 | + | |
| 10 | + 1. **Origin Attribution**: | |
| 11 | + - You must not misrepresent the origin of the Software; you must not claim | |
| 12 | + you created the original Software. | |
| 13 | + 2. **Notice Preservation**: | |
| 14 | + - This license and the above copyright notice must remain intact in all copies | |
| 15 | + of the source code. | |
| 16 | + | |
| 17 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, | |
| 18 | +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A | |
| 19 | +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | |
| 20 | +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF | |
| 21 | +CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE | |
| 22 | +OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
| 23 | +*/ | |
| 24 | +#ifndef SQLITEPP_HH | |
| 25 | +#define SQLITEPP_HH | |
| 26 | + | |
| 27 | +#include <util/types.hh> | |
| 28 | + | |
| 29 | +struct sqlite3; | |
| 30 | +struct sqlite3_stmt; | |
| 31 | +struct sqlite3_value; | |
| 32 | + | |
| 33 | +namespace sqlitepp { | |
| 34 | + class Instance { | |
| 35 | + public: | |
| 36 | + Instance(); | |
| 37 | + ~Instance(); | |
| 38 | + | |
| 39 | + sqlite3 *GetDB() { return m_pDB; } | |
| 40 | + bool Exec(string sql); | |
| 41 | + i64 GetLastInsertId(); | |
| 42 | + | |
| 43 | + private: | |
| 44 | + sqlite3 *m_pDB; | |
| 45 | + }; // class Instance | |
| 46 | + | |
| 47 | + class Stmt { | |
| 48 | + public: | |
| 49 | + Stmt(sqlite3 *pDB); | |
| 50 | + ~Stmt(); | |
| 51 | + | |
| 52 | + bool Prepare(const std::string &sql); | |
| 53 | + bool BindBlob(int index, any data, u32 size); | |
| 54 | + bool BindBlob64(int index, any data, u64 size); | |
| 55 | + bool BindDouble(int index, f64 data); | |
| 56 | + bool BindInt(int index, i32 data); | |
| 57 | + bool BindInt64(int index, i64 data); | |
| 58 | + bool BindNull(int index); | |
| 59 | + bool BindText(int index, const string &data); | |
| 60 | + bool BindText16(int index, const string &data); | |
| 61 | + bool BindText64(int index, const string &data); | |
| 62 | + | |
| 63 | + const void *ColumnBlob(int col); | |
| 64 | + f64 ColumnDouble(int col); | |
| 65 | + int ColumnInt(int col); | |
| 66 | + i64 ColumnInt64(int col); | |
| 67 | + string ColumnText(int col); | |
| 68 | + //const any ColumnText16(int col); | |
| 69 | + sqlite3_value *ColumnValue(int col); | |
| 70 | + int ColumnBytes(int col); | |
| 71 | + int ColumnBytes16(int col); | |
| 72 | + int ColumnType(int col); | |
| 73 | + int Step(); | |
| 74 | + | |
| 75 | + private: | |
| 76 | + sqlite3 *m_pDB; | |
| 77 | + sqlite3_stmt *m_pSTMT = nullptr; | |
| 78 | + }; // class Stmt | |
| 79 | +} // namespace sqlitepp | |
| 80 | + | |
| 81 | +#endif // SQLITEPP_HH |
| @@ -1,4 +1,6 @@ | ||
| 1 | 1 | /* |
| 2 | +# 076 License | |
| 3 | + | |
| 2 | 4 | Copyright (c) テクニカル諏訪子 |
| 3 | 5 | |
| 4 | 6 | Permission is hereby granted to any person obtaining a copy of the software |
| @@ -1,27 +1,16 @@ | ||
| 1 | 1 | /* |
| 2 | +# 076 Free License | |
| 3 | + | |
| 2 | 4 | Copyright (c) テクニカル諏訪子 |
| 3 | 5 | |
| 4 | 6 | Permission is hereby granted to any person obtaining a copy of the software |
| 5 | -Shader Playground (the "Software") to use, modify, merge, copy, publish, distribute, | |
| 7 | +C++ Utils (the "Software") to use, modify, merge, copy, publish, distribute, | |
| 6 | 8 | sublicense, and/or sell copies of the Software, subject to the following conditions: |
| 7 | 9 | |
| 8 | 10 | 1. **Origin Attribution**: |
| 9 | 11 | - You must not misrepresent the origin of the Software; you must not claim |
| 10 | 12 | you created the original Software. |
| 11 | - - If the Software is used in a product, you must either: | |
| 12 | - a. Provide clear attribution in the product's documentation, user interface, | |
| 13 | - or other visible areas, **OR** | |
| 14 | - b. Pay the original developers a fee they specify in writing. | |
| 15 | - 2. **Usage Restriction**: | |
| 16 | - - The Software, or any derivative works, dependencies, or libraries | |
| 17 | - incorporating it, must not be used for censorship or to suppress freedom of | |
| 18 | - speech, expression, or creativity. Prohibited uses include, but are not | |
| 19 | - limited to: | |
| 20 | - - Censorship of so-called "hate speech", visuals, non-mainstream opinions, | |
| 21 | - ideas, or objective reality. | |
| 22 | - - Tools or systems designed to restrict access to information or | |
| 23 | - artistic works. | |
| 24 | - 3. **Notice Preservation**: | |
| 13 | + 2. **Notice Preservation**: | |
| 25 | 14 | - This license and the above copyright notice must remain intact in all copies |
| 26 | 15 | of the source code. |
| 27 | 16 |
| @@ -1,27 +1,16 @@ | ||
| 1 | 1 | /* |
| 2 | +# 076 Free License | |
| 3 | + | |
| 2 | 4 | Copyright (c) テクニカル諏訪子 |
| 3 | 5 | |
| 4 | 6 | Permission is hereby granted to any person obtaining a copy of the software |
| 5 | -Shader Playground (the "Software") to use, modify, merge, copy, publish, distribute, | |
| 7 | +C++ Utils (the "Software") to use, modify, merge, copy, publish, distribute, | |
| 6 | 8 | sublicense, and/or sell copies of the Software, subject to the following conditions: |
| 7 | 9 | |
| 8 | 10 | 1. **Origin Attribution**: |
| 9 | 11 | - You must not misrepresent the origin of the Software; you must not claim |
| 10 | 12 | you created the original Software. |
| 11 | - - If the Software is used in a product, you must either: | |
| 12 | - a. Provide clear attribution in the product's documentation, user interface, | |
| 13 | - or other visible areas, **OR** | |
| 14 | - b. Pay the original developers a fee they specify in writing. | |
| 15 | - 2. **Usage Restriction**: | |
| 16 | - - The Software, or any derivative works, dependencies, or libraries | |
| 17 | - incorporating it, must not be used for censorship or to suppress freedom of | |
| 18 | - speech, expression, or creativity. Prohibited uses include, but are not | |
| 19 | - limited to: | |
| 20 | - - Censorship of so-called "hate speech", visuals, non-mainstream opinions, | |
| 21 | - ideas, or objective reality. | |
| 22 | - - Tools or systems designed to restrict access to information or | |
| 23 | - artistic works. | |
| 24 | - 3. **Notice Preservation**: | |
| 13 | + 2. **Notice Preservation**: | |
| 25 | 14 | - This license and the above copyright notice must remain intact in all copies |
| 26 | 15 | of the source code. |
| 27 | 16 | |
| @@ -277,4 +266,4 @@ | ||
| 277 | 266 | RGBA rgba; |
| 278 | 267 | }; |
| 279 | 268 | |
| 280 | -#endif | |
| 269 | +#endif // VECTOR_HH |
| @@ -1,4 +1,6 @@ | ||
| 1 | 1 | /* |
| 2 | +# 076 License | |
| 3 | + | |
| 2 | 4 | Copyright (c) テクニカル諏訪子 |
| 3 | 5 | |
| 4 | 6 | Permission is hereby granted to any person obtaining a copy of the software |
変更
main.cc
| @@ -1,4 +1,6 @@ | ||
| 1 | 1 | /* |
| 2 | +# 076 License | |
| 3 | + | |
| 2 | 4 | Copyright (c) テクニカル諏訪子 |
| 3 | 5 | |
| 4 | 6 | Permission is hereby granted to any person obtaining a copy of the software |
| @@ -92,7 +94,7 @@ | ||
| 92 | 94 | window.SetFramebufferSizeCallback(); |
| 93 | 95 | |
| 94 | 96 | // データベースが未だ存在しなければ、初期設定 |
| 95 | - sqlite::Instance db; | |
| 97 | + sqlitepp::Instance db; | |
| 96 | 98 | try { |
| 97 | 99 | db::Initialize(db); |
| 98 | 100 | } catch (const std::exception &e) { |
| @@ -1,4 +1,6 @@ | ||
| 1 | 1 | /* |
| 2 | +# 076 License | |
| 3 | + | |
| 2 | 4 | Copyright (c) テクニカル諏訪子 |
| 3 | 5 | |
| 4 | 6 | Permission is hereby granted to any person obtaining a copy of the software |
| @@ -34,14 +36,14 @@ | ||
| 34 | 36 | */ |
| 35 | 37 | #include <database/setup.hh> |
| 36 | 38 | #include <shader/shader.hh> |
| 37 | -#include <util/sqlite.hh> | |
| 39 | +#include <util/sqlitepp.hh> | |
| 38 | 40 | #include <sqlite3.h> |
| 39 | 41 | #include <version.hh> |
| 40 | 42 | #include <cassert> |
| 41 | 43 | #include <iostream> |
| 42 | 44 | |
| 43 | 45 | namespace db { |
| 44 | - void Initialize(sqlite::Instance &db) { | |
| 46 | + void Initialize(sqlitepp::Instance &db) { | |
| 45 | 47 | cstr sql = R"(CREATE TABLE IF NOT EXISTS version ( |
| 46 | 48 | id INTEGER PRIMARY KEY, |
| 47 | 49 | major INTEGER NOT NULL, |
| @@ -100,7 +102,7 @@ | ||
| 100 | 102 | db.Exec(sql); |
| 101 | 103 | |
| 102 | 104 | { |
| 103 | - sqlite::Stmt stmt(db.GetDB()); | |
| 105 | + sqlitepp::Stmt stmt(db.GetDB()); | |
| 104 | 106 | stmt.Prepare("SELECT COUNT(*) FROM version;"); |
| 105 | 107 | if (stmt.Step() == SQLITE_ROW) { |
| 106 | 108 | int count = stmt.ColumnInt(0); |
| @@ -109,7 +111,7 @@ | ||
| 109 | 111 | } |
| 110 | 112 | |
| 111 | 113 | { |
| 112 | - sqlite::Stmt stmt(db.GetDB()); | |
| 114 | + sqlitepp::Stmt stmt(db.GetDB()); | |
| 113 | 115 | stmt.Prepare("INSERT INTO version (major, minor, revision) VALUES (?, ?, ?);"); |
| 114 | 116 | stmt.BindInt(1, version::major); |
| 115 | 117 | stmt.BindInt(2, version::minor); |
| @@ -121,7 +123,7 @@ | ||
| 121 | 123 | i64 shaderId = 0; |
| 122 | 124 | |
| 123 | 125 | { |
| 124 | - sqlite::Stmt stmt(db.GetDB()); | |
| 126 | + sqlitepp::Stmt stmt(db.GetDB()); | |
| 125 | 127 | stmt.Prepare("INSERT INTO shaders (name, description) VALUES (?, ?);"); |
| 126 | 128 | stmt.BindText(1, "default"); |
| 127 | 129 | stmt.BindText(2, ""); |
| @@ -130,7 +132,7 @@ | ||
| 130 | 132 | } |
| 131 | 133 | |
| 132 | 134 | { |
| 133 | - sqlite::Stmt stmt(db.GetDB()); | |
| 135 | + sqlitepp::Stmt stmt(db.GetDB()); | |
| 134 | 136 | stmt.Prepare("INSERT INTO shader_code (shader_id, code_type, code, filename) VALUES (?, ?, ?, ?);"); |
| 135 | 137 | stmt.BindInt(1, shaderId); |
| 136 | 138 | stmt.BindInt(2, static_cast<int>(db::ShaderCodeType::GlslVertex)); |
| @@ -141,7 +143,7 @@ | ||
| 141 | 143 | } |
| 142 | 144 | |
| 143 | 145 | { |
| 144 | - sqlite::Stmt stmt(db.GetDB()); | |
| 146 | + sqlitepp::Stmt stmt(db.GetDB()); | |
| 145 | 147 | stmt.Prepare("INSERT INTO shader_code (shader_id, code_type, code, filename) VALUES (?, ?, ?, ?);"); |
| 146 | 148 | stmt.BindInt(1, shaderId); |
| 147 | 149 | stmt.BindInt(2, static_cast<int>(db::ShaderCodeType::GlslFragment)); |
| @@ -152,7 +154,7 @@ | ||
| 152 | 154 | } |
| 153 | 155 | |
| 154 | 156 | { |
| 155 | - sqlite::Stmt stmt(db.GetDB()); | |
| 157 | + sqlitepp::Stmt stmt(db.GetDB()); | |
| 156 | 158 | stmt.Prepare("INSERT INTO shader_code (shader_id, code_type, code, filename) VALUES (?, ?, ?, ?);"); |
| 157 | 159 | stmt.BindInt(1, shaderId); |
| 158 | 160 | stmt.BindInt(2, static_cast<int>(db::ShaderCodeType::Lua)); |
| @@ -1,4 +1,6 @@ | ||
| 1 | 1 | /* |
| 2 | +# 076 License | |
| 3 | + | |
| 2 | 4 | Copyright (c) テクニカル諏訪子 |
| 3 | 5 | |
| 4 | 6 | Permission is hereby granted to any person obtaining a copy of the software |
| @@ -33,16 +35,16 @@ | ||
| 33 | 35 | OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 34 | 36 | */ |
| 35 | 37 | #include <database/shaderdata.hh> |
| 36 | -#include <util/sqlite.hh> | |
| 38 | +#include <util/sqlitepp.hh> | |
| 37 | 39 | #include <sqlite3.h> |
| 38 | 40 | #include <iostream> |
| 39 | 41 | #include <cassert> |
| 40 | 42 | |
| 41 | 43 | namespace db { |
| 42 | - vector<ShaderData> GetAllShaders(sqlite::Instance &db) { | |
| 44 | + vector<ShaderData> GetAllShaders(sqlitepp::Instance &db) { | |
| 43 | 45 | vector<ShaderData> out; |
| 44 | 46 | |
| 45 | - sqlite::Stmt stmt(db.GetDB()); | |
| 47 | + sqlitepp::Stmt stmt(db.GetDB()); | |
| 46 | 48 | stmt.Prepare("SELECT id, name, description FROM shaders ORDER BY updated_at DESC;"); |
| 47 | 49 | |
| 48 | 50 | while (stmt.Step() == SQLITE_ROW) { |
| @@ -52,7 +54,7 @@ | ||
| 52 | 54 | data.description = stmt.ColumnText(2); |
| 53 | 55 | |
| 54 | 56 | { |
| 55 | - sqlite::Stmt codeStmt(db.GetDB()); | |
| 57 | + sqlitepp::Stmt codeStmt(db.GetDB()); | |
| 56 | 58 | codeStmt.Prepare("SELECT id, code_type, code, filename FROM shader_code WHERE shader_id = ?;"); |
| 57 | 59 | codeStmt.BindInt(1, data.id); |
| 58 | 60 | |
| @@ -89,8 +91,8 @@ | ||
| 89 | 91 | return out; |
| 90 | 92 | } |
| 91 | 93 | |
| 92 | - void SaveCode(sqlite::Instance &db, const CodeData &data) { | |
| 93 | - sqlite::Stmt stmt(db.GetDB()); | |
| 94 | + void SaveCode(sqlitepp::Instance &db, const CodeData &data) { | |
| 95 | + sqlitepp::Stmt stmt(db.GetDB()); | |
| 94 | 96 | stmt.Prepare("UPDATE shader_code SET code = ?, filename = ? WHERE id = ?;"); |
| 95 | 97 | |
| 96 | 98 | stmt.BindText(1, data.code); |
| @@ -1,4 +1,6 @@ | ||
| 1 | 1 | /* |
| 2 | +# 076 License | |
| 3 | + | |
| 2 | 4 | Copyright (c) テクニカル諏訪子 |
| 3 | 5 | |
| 4 | 6 | Permission is hereby granted to any person obtaining a copy of the software |
| @@ -1,4 +1,6 @@ | ||
| 1 | 1 | /* |
| 2 | +# 076 License | |
| 3 | + | |
| 2 | 4 | Copyright (c) テクニカル諏訪子 |
| 3 | 5 | |
| 4 | 6 | Permission is hereby granted to any person obtaining a copy of the software |
| @@ -1,4 +1,6 @@ | ||
| 1 | 1 | /* |
| 2 | +# 076 License | |
| 3 | + | |
| 2 | 4 | Copyright (c) テクニカル諏訪子 |
| 3 | 5 | |
| 4 | 6 | Permission is hereby granted to any person obtaining a copy of the software |
| @@ -1,4 +1,6 @@ | ||
| 1 | 1 | /* |
| 2 | +# 076 License | |
| 3 | + | |
| 2 | 4 | Copyright (c) テクニカル諏訪子 |
| 3 | 5 | |
| 4 | 6 | Permission is hereby granted to any person obtaining a copy of the software |
| @@ -1,3 +1,39 @@ | ||
| 1 | +/* | |
| 2 | +# 076 License | |
| 3 | + | |
| 4 | +Copyright (c) テクニカル諏訪子 | |
| 5 | + | |
| 6 | +Permission is hereby granted to any person obtaining a copy of the software | |
| 7 | +Shader Playground (the "Software") to use, modify, merge, copy, publish, distribute, | |
| 8 | +sublicense, and/or sell copies of the Software, subject to the following conditions: | |
| 9 | + | |
| 10 | + 1. **Origin Attribution**: | |
| 11 | + - You must not misrepresent the origin of the Software; you must not claim | |
| 12 | + you created the original Software. | |
| 13 | + - If the Software is used in a product, you must either: | |
| 14 | + a. Provide clear attribution in the product's documentation, user interface, | |
| 15 | + or other visible areas, **OR** | |
| 16 | + b. Pay the original developers a fee they specify in writing. | |
| 17 | + 2. **Usage Restriction**: | |
| 18 | + - The Software, or any derivative works, dependencies, or libraries | |
| 19 | + incorporating it, must not be used for censorship or to suppress freedom of | |
| 20 | + speech, expression, or creativity. Prohibited uses include, but are not | |
| 21 | + limited to: | |
| 22 | + - Censorship of so-called "hate speech", visuals, non-mainstream opinions, | |
| 23 | + ideas, or objective reality. | |
| 24 | + - Tools or systems designed to restrict access to information or | |
| 25 | + artistic works. | |
| 26 | + 3. **Notice Preservation**: | |
| 27 | + - This license and the above copyright notice must remain intact in all copies | |
| 28 | + of the source code. | |
| 29 | + | |
| 30 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, | |
| 31 | +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A | |
| 32 | +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | |
| 33 | +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF | |
| 34 | +CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE | |
| 35 | +OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
| 36 | +*/ | |
| 1 | 37 | #include <gui/manual.hh> |
| 2 | 38 | #include <imgui.h> |
| 3 | 39 |
| @@ -1,3 +1,39 @@ | ||
| 1 | +/* | |
| 2 | +# 076 License | |
| 3 | + | |
| 4 | +Copyright (c) テクニカル諏訪子 | |
| 5 | + | |
| 6 | +Permission is hereby granted to any person obtaining a copy of the software | |
| 7 | +Shader Playground (the "Software") to use, modify, merge, copy, publish, distribute, | |
| 8 | +sublicense, and/or sell copies of the Software, subject to the following conditions: | |
| 9 | + | |
| 10 | + 1. **Origin Attribution**: | |
| 11 | + - You must not misrepresent the origin of the Software; you must not claim | |
| 12 | + you created the original Software. | |
| 13 | + - If the Software is used in a product, you must either: | |
| 14 | + a. Provide clear attribution in the product's documentation, user interface, | |
| 15 | + or other visible areas, **OR** | |
| 16 | + b. Pay the original developers a fee they specify in writing. | |
| 17 | + 2. **Usage Restriction**: | |
| 18 | + - The Software, or any derivative works, dependencies, or libraries | |
| 19 | + incorporating it, must not be used for censorship or to suppress freedom of | |
| 20 | + speech, expression, or creativity. Prohibited uses include, but are not | |
| 21 | + limited to: | |
| 22 | + - Censorship of so-called "hate speech", visuals, non-mainstream opinions, | |
| 23 | + ideas, or objective reality. | |
| 24 | + - Tools or systems designed to restrict access to information or | |
| 25 | + artistic works. | |
| 26 | + 3. **Notice Preservation**: | |
| 27 | + - This license and the above copyright notice must remain intact in all copies | |
| 28 | + of the source code. | |
| 29 | + | |
| 30 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, | |
| 31 | +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A | |
| 32 | +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | |
| 33 | +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF | |
| 34 | +CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE | |
| 35 | +OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
| 36 | +*/ | |
| 1 | 37 | #include <gui/settings.hh> |
| 2 | 38 | |
| 3 | 39 | namespace gui { |
| @@ -1,4 +1,6 @@ | ||
| 1 | 1 | /* |
| 2 | +# 076 License | |
| 3 | + | |
| 2 | 4 | Copyright (c) テクニカル諏訪子 |
| 3 | 5 | |
| 4 | 6 | Permission is hereby granted to any person obtaining a copy of the software |
| @@ -1,4 +1,6 @@ | ||
| 1 | 1 | /* |
| 2 | +# 076 License | |
| 3 | + | |
| 2 | 4 | Copyright (c) テクニカル諏訪子 |
| 3 | 5 | |
| 4 | 6 | Permission is hereby granted to any person obtaining a copy of the software |
| @@ -1,4 +1,6 @@ | ||
| 1 | 1 | /* |
| 2 | +# 076 License | |
| 3 | + | |
| 2 | 4 | Copyright (c) テクニカル諏訪子 |
| 3 | 5 | |
| 4 | 6 | Permission is hereby granted to any person obtaining a copy of the software |
| @@ -1,4 +1,6 @@ | ||
| 1 | 1 | /* |
| 2 | +# 076 License | |
| 3 | + | |
| 2 | 4 | Copyright (c) テクニカル諏訪子 |
| 3 | 5 | |
| 4 | 6 | Permission is hereby granted to any person obtaining a copy of the software |
| @@ -1,4 +1,6 @@ | ||
| 1 | 1 | /* |
| 2 | +# 076 License | |
| 3 | + | |
| 2 | 4 | Copyright (c) テクニカル諏訪子 |
| 3 | 5 | |
| 4 | 6 | Permission is hereby granted to any person obtaining a copy of the software |
| @@ -1,27 +1,16 @@ | ||
| 1 | 1 | /* |
| 2 | +# 076 Free License | |
| 3 | + | |
| 2 | 4 | Copyright (c) テクニカル諏訪子 |
| 3 | 5 | |
| 4 | 6 | Permission is hereby granted to any person obtaining a copy of the software |
| 5 | -Shader Playground (the "Software") to use, modify, merge, copy, publish, distribute, | |
| 7 | +C++ Utils (the "Software") to use, modify, merge, copy, publish, distribute, | |
| 6 | 8 | sublicense, and/or sell copies of the Software, subject to the following conditions: |
| 7 | 9 | |
| 8 | 10 | 1. **Origin Attribution**: |
| 9 | 11 | - You must not misrepresent the origin of the Software; you must not claim |
| 10 | 12 | you created the original Software. |
| 11 | - - If the Software is used in a product, you must either: | |
| 12 | - a. Provide clear attribution in the product's documentation, user interface, | |
| 13 | - or other visible areas, **OR** | |
| 14 | - b. Pay the original developers a fee they specify in writing. | |
| 15 | - 2. **Usage Restriction**: | |
| 16 | - - The Software, or any derivative works, dependencies, or libraries | |
| 17 | - incorporating it, must not be used for censorship or to suppress freedom of | |
| 18 | - speech, expression, or creativity. Prohibited uses include, but are not | |
| 19 | - limited to: | |
| 20 | - - Censorship of so-called "hate speech", visuals, non-mainstream opinions, | |
| 21 | - ideas, or objective reality. | |
| 22 | - - Tools or systems designed to restrict access to information or | |
| 23 | - artistic works. | |
| 24 | - 3. **Notice Preservation**: | |
| 13 | + 2. **Notice Preservation**: | |
| 25 | 14 | - This license and the above copyright notice must remain intact in all copies |
| 26 | 15 | of the source code. |
| 27 | 16 |
| @@ -1,27 +1,16 @@ | ||
| 1 | 1 | /* |
| 2 | +# 076 Free License | |
| 3 | + | |
| 2 | 4 | Copyright (c) テクニカル諏訪子 |
| 3 | 5 | |
| 4 | 6 | Permission is hereby granted to any person obtaining a copy of the software |
| 5 | -Shader Playground (the "Software") to use, modify, merge, copy, publish, distribute, | |
| 7 | +C++ Utils (the "Software") to use, modify, merge, copy, publish, distribute, | |
| 6 | 8 | sublicense, and/or sell copies of the Software, subject to the following conditions: |
| 7 | 9 | |
| 8 | 10 | 1. **Origin Attribution**: |
| 9 | 11 | - You must not misrepresent the origin of the Software; you must not claim |
| 10 | 12 | you created the original Software. |
| 11 | - - If the Software is used in a product, you must either: | |
| 12 | - a. Provide clear attribution in the product's documentation, user interface, | |
| 13 | - or other visible areas, **OR** | |
| 14 | - b. Pay the original developers a fee they specify in writing. | |
| 15 | - 2. **Usage Restriction**: | |
| 16 | - - The Software, or any derivative works, dependencies, or libraries | |
| 17 | - incorporating it, must not be used for censorship or to suppress freedom of | |
| 18 | - speech, expression, or creativity. Prohibited uses include, but are not | |
| 19 | - limited to: | |
| 20 | - - Censorship of so-called "hate speech", visuals, non-mainstream opinions, | |
| 21 | - ideas, or objective reality. | |
| 22 | - - Tools or systems designed to restrict access to information or | |
| 23 | - artistic works. | |
| 24 | - 3. **Notice Preservation**: | |
| 13 | + 2. **Notice Preservation**: | |
| 25 | 14 | - This license and the above copyright notice must remain intact in all copies |
| 26 | 15 | of the source code. |
| 27 | 16 |
| @@ -1,27 +1,16 @@ | ||
| 1 | 1 | /* |
| 2 | +# 076 Free License | |
| 3 | + | |
| 2 | 4 | Copyright (c) テクニカル諏訪子 |
| 3 | 5 | |
| 4 | 6 | Permission is hereby granted to any person obtaining a copy of the software |
| 5 | -Shader Playground (the "Software") to use, modify, merge, copy, publish, distribute, | |
| 7 | +C++ Utils (the "Software") to use, modify, merge, copy, publish, distribute, | |
| 6 | 8 | sublicense, and/or sell copies of the Software, subject to the following conditions: |
| 7 | 9 | |
| 8 | 10 | 1. **Origin Attribution**: |
| 9 | 11 | - You must not misrepresent the origin of the Software; you must not claim |
| 10 | 12 | you created the original Software. |
| 11 | - - If the Software is used in a product, you must either: | |
| 12 | - a. Provide clear attribution in the product's documentation, user interface, | |
| 13 | - or other visible areas, **OR** | |
| 14 | - b. Pay the original developers a fee they specify in writing. | |
| 15 | - 2. **Usage Restriction**: | |
| 16 | - - The Software, or any derivative works, dependencies, or libraries | |
| 17 | - incorporating it, must not be used for censorship or to suppress freedom of | |
| 18 | - speech, expression, or creativity. Prohibited uses include, but are not | |
| 19 | - limited to: | |
| 20 | - - Censorship of so-called "hate speech", visuals, non-mainstream opinions, | |
| 21 | - ideas, or objective reality. | |
| 22 | - - Tools or systems designed to restrict access to information or | |
| 23 | - artistic works. | |
| 24 | - 3. **Notice Preservation**: | |
| 13 | + 2. **Notice Preservation**: | |
| 25 | 14 | - This license and the above copyright notice must remain intact in all copies |
| 26 | 15 | of the source code. |
| 27 | 16 |
削除
src/util/sqlite.cc
| @@ -1,227 +0,0 @@ | ||
| 1 | -/* | |
| 2 | -Copyright (c) テクニカル諏訪子 | |
| 3 | - | |
| 4 | -Permission is hereby granted to any person obtaining a copy of the software | |
| 5 | -Shader Playground (the "Software") to use, modify, merge, copy, publish, distribute, | |
| 6 | -sublicense, and/or sell copies of the Software, subject to the following conditions: | |
| 7 | - | |
| 8 | - 1. **Origin Attribution**: | |
| 9 | - - You must not misrepresent the origin of the Software; you must not claim | |
| 10 | - you created the original Software. | |
| 11 | - - If the Software is used in a product, you must either: | |
| 12 | - a. Provide clear attribution in the product's documentation, user interface, | |
| 13 | - or other visible areas, **OR** | |
| 14 | - b. Pay the original developers a fee they specify in writing. | |
| 15 | - 2. **Usage Restriction**: | |
| 16 | - - The Software, or any derivative works, dependencies, or libraries | |
| 17 | - incorporating it, must not be used for censorship or to suppress freedom of | |
| 18 | - speech, expression, or creativity. Prohibited uses include, but are not | |
| 19 | - limited to: | |
| 20 | - - Censorship of so-called "hate speech", visuals, non-mainstream opinions, | |
| 21 | - ideas, or objective reality. | |
| 22 | - - Tools or systems designed to restrict access to information or | |
| 23 | - artistic works. | |
| 24 | - 3. **Notice Preservation**: | |
| 25 | - - This license and the above copyright notice must remain intact in all copies | |
| 26 | - of the source code. | |
| 27 | - | |
| 28 | -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, | |
| 29 | -INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A | |
| 30 | -PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | |
| 31 | -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF | |
| 32 | -CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE | |
| 33 | -OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
| 34 | -*/ | |
| 35 | -#include <util/sqlite.hh> | |
| 36 | -#include <shader/shader.hh> | |
| 37 | -#include <sqlite3.h> | |
| 38 | -#include <iostream> | |
| 39 | -#include <stdexcept> | |
| 40 | -#include <filesystem> | |
| 41 | -#include <version.hh> | |
| 42 | - | |
| 43 | -#if defined(WIN32) || defined(WIN64) | |
| 44 | -#ifndef WIN32_LEAN_AND_MEAN | |
| 45 | -#define WIN32_LEAN_AND_MEAN | |
| 46 | -#endif | |
| 47 | -#include <windows.h> | |
| 48 | -#include <shlobj.h> | |
| 49 | - | |
| 50 | -std::filesystem::path GetLocalAppDataPath() { | |
| 51 | - PWSTR path = nullptr; | |
| 52 | - HRESULT hr = SHGetKnownFolderPath(FOLDERID_LocalAppData, 0, nullptr, &path); | |
| 53 | - if (FAILED(hr)) throw std::runtime_error("LocalAppDataパスの受取の失敗。"); | |
| 54 | - | |
| 55 | - std::filesystem::path p(path); | |
| 56 | - CoTaskMemFree(path); | |
| 57 | - | |
| 58 | - return p; | |
| 59 | -} | |
| 60 | -#endif | |
| 61 | - | |
| 62 | -std::filesystem::path GetUserDataPath() { | |
| 63 | -#if defined(WIN32) || defined(WIN64) | |
| 64 | - return GetLocalAppDataPath() / "076Studio" / "ShaderPlayground"; | |
| 65 | -#elif defined(__APPLE__) | |
| 66 | - cstr home = std::getenv("HOME"); | |
| 67 | - if (!home) throw std::runtime_error("HOME環境変数がありません。"); | |
| 68 | - | |
| 69 | - return std::filesystem::path(home) / "Library" / "Application Support" / "ShaderPlayground"; | |
| 70 | -#else | |
| 71 | - cstr xdg = std::getenv("XDG_DATA_HOME"); | |
| 72 | - if (xdg) return std::filesystem::path(xdg) / "shaderplayground"; | |
| 73 | - | |
| 74 | - cstr home = std::getenv("HOME"); | |
| 75 | - if (!home) throw std::runtime_error("HOME環境変数がありません。"); | |
| 76 | - | |
| 77 | - return std::filesystem::path(home) / ".local" / "share" / "shaderplayground"; | |
| 78 | -#endif | |
| 79 | -} | |
| 80 | - | |
| 81 | -namespace sqlite { | |
| 82 | - Instance::Instance() { | |
| 83 | - m_pDB = nullptr; | |
| 84 | -#ifdef PRODUCTION_BUILD | |
| 85 | - std::filesystem::path dbPath = GetUserDataPath() / "shaderplayground.db"; | |
| 86 | - if (!std::filesystem::exists(std::filesystem::path(dbPath).parent_path())) { | |
| 87 | - std::filesystem::create_directories(std::filesystem::path(dbPath).parent_path()); | |
| 88 | - } | |
| 89 | - | |
| 90 | - if (sqlite3_open(dbPath.string().c_str(), &m_pDB) != SQLITE_OK) { | |
| 91 | -#else | |
| 92 | - constexpr std::string_view DB_PATH = DB_NAME; | |
| 93 | - if (sqlite3_open(DB_PATH.data(), &m_pDB) != SQLITE_OK) { | |
| 94 | -#endif | |
| 95 | - throw std::runtime_error("SQLiteデータベースを開けられません。"); | |
| 96 | - } | |
| 97 | - } | |
| 98 | - | |
| 99 | - Instance::~Instance() { | |
| 100 | - sqlite3_close(m_pDB); | |
| 101 | - } | |
| 102 | - | |
| 103 | - bool Instance::Exec(string sql) { | |
| 104 | - char *err = nullptr; | |
| 105 | - bool suc = sqlite3_exec(m_pDB, sql.c_str(), nullptr, nullptr, &err); | |
| 106 | - if (suc != SQLITE_OK) { | |
| 107 | - std::cerr << "データ実行に失敗:" << err << std::endl; | |
| 108 | - sqlite3_free(err); | |
| 109 | - return false; | |
| 110 | - } | |
| 111 | - | |
| 112 | - return true; | |
| 113 | - } | |
| 114 | - | |
| 115 | - i64 Instance::GetLastInsertId() { | |
| 116 | - return sqlite3_last_insert_rowid(m_pDB); | |
| 117 | - } | |
| 118 | - | |
| 119 | - /////////////////// | |
| 120 | - | |
| 121 | - Stmt::Stmt(sqlite3 *pDB) { | |
| 122 | - m_pDB = pDB; | |
| 123 | - } | |
| 124 | - | |
| 125 | - Stmt::~Stmt() { | |
| 126 | - sqlite3_finalize(m_pSTMT); | |
| 127 | - } | |
| 128 | - | |
| 129 | - bool Stmt::Prepare(const std::string &sql) { | |
| 130 | - if (sqlite3_prepare_v2(m_pDB, sql.c_str(), static_cast<int>(sql.size() + 1), &m_pSTMT, nullptr) != SQLITE_OK) { | |
| 131 | - throw std::runtime_error("SQLの準備に失敗: " + std::string(sqlite3_errmsg(m_pDB))); | |
| 132 | - } | |
| 133 | - | |
| 134 | - return true; | |
| 135 | - } | |
| 136 | - | |
| 137 | - | |
| 138 | - bool Stmt::BindBlob(int index, any data, u32 size) { | |
| 139 | - return sqlite3_bind_blob(m_pSTMT, index, data, size, SQLITE_TRANSIENT); | |
| 140 | - } | |
| 141 | - | |
| 142 | - bool Stmt::BindBlob64(int index, any data, u64 size) { | |
| 143 | - return sqlite3_bind_blob64(m_pSTMT, index, data, size, SQLITE_TRANSIENT); | |
| 144 | - } | |
| 145 | - | |
| 146 | - bool Stmt::BindDouble(int index, f64 data) { | |
| 147 | - return sqlite3_bind_double(m_pSTMT, index, data); | |
| 148 | - } | |
| 149 | - | |
| 150 | - bool Stmt::BindInt(int index, i32 data) { | |
| 151 | - return sqlite3_bind_int(m_pSTMT, index, data); | |
| 152 | - } | |
| 153 | - | |
| 154 | - bool Stmt::BindInt64(int index, i64 data) { | |
| 155 | - return sqlite3_bind_int64(m_pSTMT, index, data); | |
| 156 | - } | |
| 157 | - | |
| 158 | - bool Stmt::BindNull(int index) { | |
| 159 | - return sqlite3_bind_null(m_pSTMT, index); | |
| 160 | - } | |
| 161 | - | |
| 162 | - bool Stmt::BindText(int index, const string &data) { | |
| 163 | - if (data.empty()) { | |
| 164 | - return sqlite3_bind_text(m_pSTMT, index, "", 0, SQLITE_TRANSIENT) == SQLITE_OK; | |
| 165 | - } | |
| 166 | - return sqlite3_bind_text(m_pSTMT, index, | |
| 167 | - data.c_str(), | |
| 168 | - static_cast<int>(data.size()), | |
| 169 | - SQLITE_TRANSIENT) == SQLITE_OK; | |
| 170 | - } | |
| 171 | - | |
| 172 | - bool Stmt::BindText16(int index, const string &data) { | |
| 173 | - return sqlite3_bind_text16(m_pSTMT, index, data.c_str(), -1, SQLITE_TRANSIENT) == SQLITE_OK; | |
| 174 | - } | |
| 175 | - | |
| 176 | - bool Stmt::BindText64(int index, const string &data) { | |
| 177 | - return sqlite3_bind_text64(m_pSTMT, index, data.c_str(), data.size(), SQLITE_TRANSIENT, SQLITE_UTF8) == SQLITE_OK; | |
| 178 | - } | |
| 179 | - | |
| 180 | - const void *Stmt::ColumnBlob(int col) { | |
| 181 | - return sqlite3_column_blob(m_pSTMT, col); | |
| 182 | - } | |
| 183 | - | |
| 184 | - f64 Stmt::ColumnDouble(int col) { | |
| 185 | - return sqlite3_column_double(m_pSTMT, col); | |
| 186 | - } | |
| 187 | - | |
| 188 | - int Stmt::ColumnInt(int col) { | |
| 189 | - return sqlite3_column_int(m_pSTMT, col);; | |
| 190 | - } | |
| 191 | - | |
| 192 | - i64 Stmt::ColumnInt64(int col) { | |
| 193 | - return sqlite3_column_int64(m_pSTMT, col); | |
| 194 | - } | |
| 195 | - | |
| 196 | - string Stmt::ColumnText(int col) { | |
| 197 | - const unsigned char *text = sqlite3_column_text(m_pSTMT, col); | |
| 198 | - if (text == nullptr) return ""; | |
| 199 | - int len = sqlite3_column_bytes(m_pSTMT, col); | |
| 200 | - return std::string(reinterpret_cast<const char *>(text), len); | |
| 201 | - } | |
| 202 | - | |
| 203 | - //const any Stmt::ColumnText16(int col) { | |
| 204 | - // return sqlite3_column_text16(m_pSTMT, col); | |
| 205 | - //} | |
| 206 | - | |
| 207 | - sqlite3_value *Stmt::ColumnValue(int col) { | |
| 208 | - return sqlite3_column_value(m_pSTMT, col); | |
| 209 | - } | |
| 210 | - | |
| 211 | - int Stmt::ColumnBytes(int col) { | |
| 212 | - return sqlite3_column_bytes(m_pSTMT, col); | |
| 213 | - } | |
| 214 | - | |
| 215 | - int Stmt::ColumnBytes16(int col) { | |
| 216 | - return sqlite3_column_bytes16(m_pSTMT, col); | |
| 217 | - } | |
| 218 | - | |
| 219 | - int Stmt::ColumnType(int col) { | |
| 220 | - return sqlite3_column_type(m_pSTMT, col); | |
| 221 | - } | |
| 222 | - | |
| 223 | - | |
| 224 | - int Stmt::Step() { | |
| 225 | - return sqlite3_step(m_pSTMT); | |
| 226 | - } | |
| 227 | -} // namespace sqlite |
| @@ -0,0 +1,214 @@ | ||
| 1 | +/* | |
| 2 | +# 076 Free License | |
| 3 | + | |
| 4 | +Copyright (c) テクニカル諏訪子 | |
| 5 | + | |
| 6 | +Permission is hereby granted to any person obtaining a copy of the software | |
| 7 | +C++ Utils (the "Software") to use, modify, merge, copy, publish, distribute, | |
| 8 | +sublicense, and/or sell copies of the Software, subject to the following conditions: | |
| 9 | + | |
| 10 | + 1. **Origin Attribution**: | |
| 11 | + - You must not misrepresent the origin of the Software; you must not claim | |
| 12 | + you created the original Software. | |
| 13 | + 2. **Notice Preservation**: | |
| 14 | + - This license and the above copyright notice must remain intact in all copies | |
| 15 | + of the source code. | |
| 16 | + | |
| 17 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, | |
| 18 | +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A | |
| 19 | +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | |
| 20 | +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF | |
| 21 | +CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE | |
| 22 | +OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
| 23 | +*/ | |
| 24 | +#include <util/sqlitepp.hh> | |
| 25 | +#include <sqlite3.h> | |
| 26 | +#include <iostream> | |
| 27 | +#include <stdexcept> | |
| 28 | +#include <filesystem> | |
| 29 | + | |
| 30 | +#if defined(WIN32) || defined(WIN64) | |
| 31 | +#ifndef WIN32_LEAN_AND_MEAN | |
| 32 | +#define WIN32_LEAN_AND_MEAN | |
| 33 | +#endif | |
| 34 | +#include <windows.h> | |
| 35 | +#include <shlobj.h> | |
| 36 | + | |
| 37 | +std::filesystem::path GetLocalAppDataPath() { | |
| 38 | + PWSTR path = nullptr; | |
| 39 | + HRESULT hr = SHGetKnownFolderPath(FOLDERID_LocalAppData, 0, nullptr, &path); | |
| 40 | + if (FAILED(hr)) throw std::runtime_error("LocalAppDataパスの受取の失敗。"); | |
| 41 | + | |
| 42 | + std::filesystem::path p(path); | |
| 43 | + CoTaskMemFree(path); | |
| 44 | + | |
| 45 | + return p; | |
| 46 | +} | |
| 47 | +#endif | |
| 48 | + | |
| 49 | +std::filesystem::path GetUserDataPath() { | |
| 50 | +#if defined(WIN32) || defined(WIN64) | |
| 51 | + return GetLocalAppDataPath() / "076Studio" / "ShaderPlayground"; | |
| 52 | +#elif defined(__APPLE__) | |
| 53 | + cstr home = std::getenv("HOME"); | |
| 54 | + if (!home) throw std::runtime_error("HOME環境変数がありません。"); | |
| 55 | + | |
| 56 | + return std::filesystem::path(home) / "Library" / "Application Support" / "ShaderPlayground"; | |
| 57 | +#else | |
| 58 | + cstr xdg = std::getenv("XDG_DATA_HOME"); | |
| 59 | + if (xdg) return std::filesystem::path(xdg) / "shaderplayground"; | |
| 60 | + | |
| 61 | + cstr home = std::getenv("HOME"); | |
| 62 | + if (!home) throw std::runtime_error("HOME環境変数がありません。"); | |
| 63 | + | |
| 64 | + return std::filesystem::path(home) / ".local" / "share" / "shaderplayground"; | |
| 65 | +#endif | |
| 66 | +} | |
| 67 | + | |
| 68 | +namespace sqlitepp { | |
| 69 | + Instance::Instance() { | |
| 70 | + m_pDB = nullptr; | |
| 71 | +#ifdef PRODUCTION_BUILD | |
| 72 | + std::filesystem::path dbPath = GetUserDataPath() / "shaderplayground.db"; | |
| 73 | + if (!std::filesystem::exists(std::filesystem::path(dbPath).parent_path())) { | |
| 74 | + std::filesystem::create_directories(std::filesystem::path(dbPath).parent_path()); | |
| 75 | + } | |
| 76 | + | |
| 77 | + if (sqlite3_open(dbPath.string().c_str(), &m_pDB) != SQLITE_OK) { | |
| 78 | +#else | |
| 79 | + constexpr std::string_view DB_PATH = DB_NAME; | |
| 80 | + if (sqlite3_open(DB_PATH.data(), &m_pDB) != SQLITE_OK) { | |
| 81 | +#endif | |
| 82 | + throw std::runtime_error("SQLiteデータベースを開けられません。"); | |
| 83 | + } | |
| 84 | + } | |
| 85 | + | |
| 86 | + Instance::~Instance() { | |
| 87 | + sqlite3_close(m_pDB); | |
| 88 | + } | |
| 89 | + | |
| 90 | + bool Instance::Exec(string sql) { | |
| 91 | + char *err = nullptr; | |
| 92 | + bool suc = sqlite3_exec(m_pDB, sql.c_str(), nullptr, nullptr, &err); | |
| 93 | + if (suc != SQLITE_OK) { | |
| 94 | + std::cerr << "データ実行に失敗:" << err << std::endl; | |
| 95 | + sqlite3_free(err); | |
| 96 | + return false; | |
| 97 | + } | |
| 98 | + | |
| 99 | + return true; | |
| 100 | + } | |
| 101 | + | |
| 102 | + i64 Instance::GetLastInsertId() { | |
| 103 | + return sqlite3_last_insert_rowid(m_pDB); | |
| 104 | + } | |
| 105 | + | |
| 106 | + /////////////////// | |
| 107 | + | |
| 108 | + Stmt::Stmt(sqlite3 *pDB) { | |
| 109 | + m_pDB = pDB; | |
| 110 | + } | |
| 111 | + | |
| 112 | + Stmt::~Stmt() { | |
| 113 | + sqlite3_finalize(m_pSTMT); | |
| 114 | + } | |
| 115 | + | |
| 116 | + bool Stmt::Prepare(const std::string &sql) { | |
| 117 | + if (sqlite3_prepare_v2(m_pDB, sql.c_str(), static_cast<int>(sql.size() + 1), &m_pSTMT, nullptr) != SQLITE_OK) { | |
| 118 | + throw std::runtime_error("SQLの準備に失敗: " + std::string(sqlite3_errmsg(m_pDB))); | |
| 119 | + } | |
| 120 | + | |
| 121 | + return true; | |
| 122 | + } | |
| 123 | + | |
| 124 | + | |
| 125 | + bool Stmt::BindBlob(int index, any data, u32 size) { | |
| 126 | + return sqlite3_bind_blob(m_pSTMT, index, data, size, SQLITE_TRANSIENT); | |
| 127 | + } | |
| 128 | + | |
| 129 | + bool Stmt::BindBlob64(int index, any data, u64 size) { | |
| 130 | + return sqlite3_bind_blob64(m_pSTMT, index, data, size, SQLITE_TRANSIENT); | |
| 131 | + } | |
| 132 | + | |
| 133 | + bool Stmt::BindDouble(int index, f64 data) { | |
| 134 | + return sqlite3_bind_double(m_pSTMT, index, data); | |
| 135 | + } | |
| 136 | + | |
| 137 | + bool Stmt::BindInt(int index, i32 data) { | |
| 138 | + return sqlite3_bind_int(m_pSTMT, index, data); | |
| 139 | + } | |
| 140 | + | |
| 141 | + bool Stmt::BindInt64(int index, i64 data) { | |
| 142 | + return sqlite3_bind_int64(m_pSTMT, index, data); | |
| 143 | + } | |
| 144 | + | |
| 145 | + bool Stmt::BindNull(int index) { | |
| 146 | + return sqlite3_bind_null(m_pSTMT, index); | |
| 147 | + } | |
| 148 | + | |
| 149 | + bool Stmt::BindText(int index, const string &data) { | |
| 150 | + if (data.empty()) { | |
| 151 | + return sqlite3_bind_text(m_pSTMT, index, "", 0, SQLITE_TRANSIENT) == SQLITE_OK; | |
| 152 | + } | |
| 153 | + return sqlite3_bind_text(m_pSTMT, index, | |
| 154 | + data.c_str(), | |
| 155 | + static_cast<int>(data.size()), | |
| 156 | + SQLITE_TRANSIENT) == SQLITE_OK; | |
| 157 | + } | |
| 158 | + | |
| 159 | + bool Stmt::BindText16(int index, const string &data) { | |
| 160 | + return sqlite3_bind_text16(m_pSTMT, index, data.c_str(), -1, SQLITE_TRANSIENT) == SQLITE_OK; | |
| 161 | + } | |
| 162 | + | |
| 163 | + bool Stmt::BindText64(int index, const string &data) { | |
| 164 | + return sqlite3_bind_text64(m_pSTMT, index, data.c_str(), data.size(), SQLITE_TRANSIENT, SQLITE_UTF8) == SQLITE_OK; | |
| 165 | + } | |
| 166 | + | |
| 167 | + const void *Stmt::ColumnBlob(int col) { | |
| 168 | + return sqlite3_column_blob(m_pSTMT, col); | |
| 169 | + } | |
| 170 | + | |
| 171 | + f64 Stmt::ColumnDouble(int col) { | |
| 172 | + return sqlite3_column_double(m_pSTMT, col); | |
| 173 | + } | |
| 174 | + | |
| 175 | + int Stmt::ColumnInt(int col) { | |
| 176 | + return sqlite3_column_int(m_pSTMT, col);; | |
| 177 | + } | |
| 178 | + | |
| 179 | + i64 Stmt::ColumnInt64(int col) { | |
| 180 | + return sqlite3_column_int64(m_pSTMT, col); | |
| 181 | + } | |
| 182 | + | |
| 183 | + string Stmt::ColumnText(int col) { | |
| 184 | + const unsigned char *text = sqlite3_column_text(m_pSTMT, col); | |
| 185 | + if (text == nullptr) return ""; | |
| 186 | + int len = sqlite3_column_bytes(m_pSTMT, col); | |
| 187 | + return std::string(reinterpret_cast<const char *>(text), len); | |
| 188 | + } | |
| 189 | + | |
| 190 | + //const any Stmt::ColumnText16(int col) { | |
| 191 | + // return sqlite3_column_text16(m_pSTMT, col); | |
| 192 | + //} | |
| 193 | + | |
| 194 | + sqlite3_value *Stmt::ColumnValue(int col) { | |
| 195 | + return sqlite3_column_value(m_pSTMT, col); | |
| 196 | + } | |
| 197 | + | |
| 198 | + int Stmt::ColumnBytes(int col) { | |
| 199 | + return sqlite3_column_bytes(m_pSTMT, col); | |
| 200 | + } | |
| 201 | + | |
| 202 | + int Stmt::ColumnBytes16(int col) { | |
| 203 | + return sqlite3_column_bytes16(m_pSTMT, col); | |
| 204 | + } | |
| 205 | + | |
| 206 | + int Stmt::ColumnType(int col) { | |
| 207 | + return sqlite3_column_type(m_pSTMT, col); | |
| 208 | + } | |
| 209 | + | |
| 210 | + | |
| 211 | + int Stmt::Step() { | |
| 212 | + return sqlite3_step(m_pSTMT); | |
| 213 | + } | |
| 214 | +} // namespace sqlitepp |