法律出的なちんこ

守矢諏訪子 <suwako@076.moe>、2026-06-26 08:16
コミット dea5906aa9761fda40b929373cf010bd7cd49bf2 ・親 6957179 ・ファイルを見る

47個のファイル、+761 -463

変更 LICENSE.md
@@ -1,3 +1,5 @@
1+# 076 License
2+
13 Copyright (c) テクニカル諏訪子
24
35 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+*/
137 #pragma once
238
339 #include <database/setup.hh>
@@ -1,4 +1,6 @@
11 /*
2+# 076 License
3+
24 Copyright (c) テクニカル諏訪子
35
46 Permission is hereby granted to any person obtaining a copy of the software
@@ -34,9 +36,9 @@
3436 */
3537 #pragma once
3638
37-namespace sqlite {
39+namespace sqlitepp {
3840 class Instance;
39-} // namespace sqlite
41+} // namespace sqlitepp
4042
4143 namespace db {
4244 enum class ShaderCodeType {
@@ -48,5 +50,5 @@
4850
4951 // 初期設定。
5052 // 既に存在したら、見逃す。
51- void Initialize(sqlite::Instance &db);
53+ void Initialize(sqlitepp::Instance &db);
5254 } // namespace db
@@ -1,4 +1,6 @@
11 /*
2+# 076 License
3+
24 Copyright (c) テクニカル諏訪子
35
46 Permission is hereby granted to any person obtaining a copy of the software
@@ -37,9 +39,9 @@
3739 #include <util/types.hh>
3840 #include <database/setup.hh>
3941
40-namespace sqlite {
42+namespace sqlitepp {
4143 class Instance;
42-} // namespace sqlite
44+} // namespace sqlitepp
4345
4446 namespace db {
4547 struct CodeData {
@@ -58,6 +60,6 @@
5860 CodeData luaCode = {};
5961 };
6062
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);
6365 } // 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+*/
137 #pragma once
238
339 #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+*/
137 #pragma once
238
339 #include <util/types.hh>
@@ -1,4 +1,6 @@
11 /*
2+# 076 License
3+
24 Copyright (c) テクニカル諏訪子
35
46 Permission is hereby granted to any person obtaining a copy of the software
@@ -1,4 +1,6 @@
11 /*
2+# 076 License
3+
24 Copyright (c) テクニカル諏訪子
35
46 Permission is hereby granted to any person obtaining a copy of the software
@@ -1,4 +1,6 @@
11 /*
2+# 076 License
3+
24 Copyright (c) テクニカル諏訪子
35
46 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+*/
137 #pragma once
238
339 #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+*/
137 #pragma once
238
339 #include <util/types.hh>
@@ -1,4 +1,6 @@
11 /*
2+# 076 License
3+
24 Copyright (c) テクニカル諏訪子
35
46 Permission is hereby granted to any person obtaining a copy of the software
@@ -1,4 +1,6 @@
11 /*
2+# 076 License
3+
24 Copyright (c) テクニカル諏訪子
35
46 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+*/
137 #pragma once
238
339 #include <lua/luaengine.hh>
@@ -1,4 +1,6 @@
11 /*
2+# 076 License
3+
24 Copyright (c) テクニカル諏訪子
35
46 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+*/
137 #pragma once
238
339 #include <shader/shader.hh>
@@ -1,4 +1,6 @@
11 /*
2+# 076 License
3+
24 Copyright (c) テクニカル諏訪子
35
46 Permission is hereby granted to any person obtaining a copy of the software
@@ -1,4 +1,6 @@
11 /*
2+# 076 License
3+
24 Copyright (c) テクニカル諏訪子
35
46 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+*/
137 #pragma once
238
339 #include <util/glfwpp.hh>
440 #include <util/types.hh>
541 #include <util/vector.hh>
6-#include <util/sqlite.hh>
42+#include <util/sqlitepp.hh>
743 #include <util/structs.hh>
844 #include <util/random.hh>
945 // #include <util/file.hh>
@@ -1,27 +1,16 @@
11 /*
2+# 076 Free License
3+
24 Copyright (c) テクニカル諏訪子
35
46 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,
68 sublicense, and/or sell copies of the Software, subject to the following conditions:
79
810 1. **Origin Attribution**:
911 - You must not misrepresent the origin of the Software; you must not claim
1012 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**:
2514 - This license and the above copyright notice must remain intact in all copies
2615 of the source code.
2716
@@ -1,27 +1,16 @@
11 /*
2+# 076 Free License
3+
24 Copyright (c) テクニカル諏訪子
35
46 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,
68 sublicense, and/or sell copies of the Software, subject to the following conditions:
79
810 1. **Origin Attribution**:
911 - You must not misrepresent the origin of the Software; you must not claim
1012 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**:
2514 - This license and the above copyright notice must remain intact in all copies
2615 of the source code.
2716
@@ -1,27 +1,16 @@
11 /*
2+# 076 Free License
3+
24 Copyright (c) テクニカル諏訪子
35
46 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,
68 sublicense, and/or sell copies of the Software, subject to the following conditions:
79
810 1. **Origin Attribution**:
911 - You must not misrepresent the origin of the Software; you must not claim
1012 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**:
2514 - This license and the above copyright notice must remain intact in all copies
2615 of the source code.
2716
削除 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 @@
11 /*
2+# 076 License
3+
24 Copyright (c) テクニカル諏訪子
35
46 Permission is hereby granted to any person obtaining a copy of the software
@@ -1,27 +1,16 @@
11 /*
2+# 076 Free License
3+
24 Copyright (c) テクニカル諏訪子
35
46 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,
68 sublicense, and/or sell copies of the Software, subject to the following conditions:
79
810 1. **Origin Attribution**:
911 - You must not misrepresent the origin of the Software; you must not claim
1012 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**:
2514 - This license and the above copyright notice must remain intact in all copies
2615 of the source code.
2716
@@ -1,27 +1,16 @@
11 /*
2+# 076 Free License
3+
24 Copyright (c) テクニカル諏訪子
35
46 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,
68 sublicense, and/or sell copies of the Software, subject to the following conditions:
79
810 1. **Origin Attribution**:
911 - You must not misrepresent the origin of the Software; you must not claim
1012 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**:
2514 - This license and the above copyright notice must remain intact in all copies
2615 of the source code.
2716
@@ -277,4 +266,4 @@
277266 RGBA rgba;
278267 };
279268
280-#endif
269+#endif // VECTOR_HH
@@ -1,4 +1,6 @@
11 /*
2+# 076 License
3+
24 Copyright (c) テクニカル諏訪子
35
46 Permission is hereby granted to any person obtaining a copy of the software
変更 main.cc
@@ -1,4 +1,6 @@
11 /*
2+# 076 License
3+
24 Copyright (c) テクニカル諏訪子
35
46 Permission is hereby granted to any person obtaining a copy of the software
@@ -92,7 +94,7 @@
9294 window.SetFramebufferSizeCallback();
9395
9496 // データベースが未だ存在しなければ、初期設定
95- sqlite::Instance db;
97+ sqlitepp::Instance db;
9698 try {
9799 db::Initialize(db);
98100 } catch (const std::exception &e) {
@@ -1,4 +1,6 @@
11 /*
2+# 076 License
3+
24 Copyright (c) テクニカル諏訪子
35
46 Permission is hereby granted to any person obtaining a copy of the software
@@ -34,14 +36,14 @@
3436 */
3537 #include <database/setup.hh>
3638 #include <shader/shader.hh>
37-#include <util/sqlite.hh>
39+#include <util/sqlitepp.hh>
3840 #include <sqlite3.h>
3941 #include <version.hh>
4042 #include <cassert>
4143 #include <iostream>
4244
4345 namespace db {
44- void Initialize(sqlite::Instance &db) {
46+ void Initialize(sqlitepp::Instance &db) {
4547 cstr sql = R"(CREATE TABLE IF NOT EXISTS version (
4648 id INTEGER PRIMARY KEY,
4749 major INTEGER NOT NULL,
@@ -100,7 +102,7 @@
100102 db.Exec(sql);
101103
102104 {
103- sqlite::Stmt stmt(db.GetDB());
105+ sqlitepp::Stmt stmt(db.GetDB());
104106 stmt.Prepare("SELECT COUNT(*) FROM version;");
105107 if (stmt.Step() == SQLITE_ROW) {
106108 int count = stmt.ColumnInt(0);
@@ -109,7 +111,7 @@
109111 }
110112
111113 {
112- sqlite::Stmt stmt(db.GetDB());
114+ sqlitepp::Stmt stmt(db.GetDB());
113115 stmt.Prepare("INSERT INTO version (major, minor, revision) VALUES (?, ?, ?);");
114116 stmt.BindInt(1, version::major);
115117 stmt.BindInt(2, version::minor);
@@ -121,7 +123,7 @@
121123 i64 shaderId = 0;
122124
123125 {
124- sqlite::Stmt stmt(db.GetDB());
126+ sqlitepp::Stmt stmt(db.GetDB());
125127 stmt.Prepare("INSERT INTO shaders (name, description) VALUES (?, ?);");
126128 stmt.BindText(1, "default");
127129 stmt.BindText(2, "");
@@ -130,7 +132,7 @@
130132 }
131133
132134 {
133- sqlite::Stmt stmt(db.GetDB());
135+ sqlitepp::Stmt stmt(db.GetDB());
134136 stmt.Prepare("INSERT INTO shader_code (shader_id, code_type, code, filename) VALUES (?, ?, ?, ?);");
135137 stmt.BindInt(1, shaderId);
136138 stmt.BindInt(2, static_cast<int>(db::ShaderCodeType::GlslVertex));
@@ -141,7 +143,7 @@
141143 }
142144
143145 {
144- sqlite::Stmt stmt(db.GetDB());
146+ sqlitepp::Stmt stmt(db.GetDB());
145147 stmt.Prepare("INSERT INTO shader_code (shader_id, code_type, code, filename) VALUES (?, ?, ?, ?);");
146148 stmt.BindInt(1, shaderId);
147149 stmt.BindInt(2, static_cast<int>(db::ShaderCodeType::GlslFragment));
@@ -152,7 +154,7 @@
152154 }
153155
154156 {
155- sqlite::Stmt stmt(db.GetDB());
157+ sqlitepp::Stmt stmt(db.GetDB());
156158 stmt.Prepare("INSERT INTO shader_code (shader_id, code_type, code, filename) VALUES (?, ?, ?, ?);");
157159 stmt.BindInt(1, shaderId);
158160 stmt.BindInt(2, static_cast<int>(db::ShaderCodeType::Lua));
@@ -1,4 +1,6 @@
11 /*
2+# 076 License
3+
24 Copyright (c) テクニカル諏訪子
35
46 Permission is hereby granted to any person obtaining a copy of the software
@@ -33,16 +35,16 @@
3335 OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
3436 */
3537 #include <database/shaderdata.hh>
36-#include <util/sqlite.hh>
38+#include <util/sqlitepp.hh>
3739 #include <sqlite3.h>
3840 #include <iostream>
3941 #include <cassert>
4042
4143 namespace db {
42- vector<ShaderData> GetAllShaders(sqlite::Instance &db) {
44+ vector<ShaderData> GetAllShaders(sqlitepp::Instance &db) {
4345 vector<ShaderData> out;
4446
45- sqlite::Stmt stmt(db.GetDB());
47+ sqlitepp::Stmt stmt(db.GetDB());
4648 stmt.Prepare("SELECT id, name, description FROM shaders ORDER BY updated_at DESC;");
4749
4850 while (stmt.Step() == SQLITE_ROW) {
@@ -52,7 +54,7 @@
5254 data.description = stmt.ColumnText(2);
5355
5456 {
55- sqlite::Stmt codeStmt(db.GetDB());
57+ sqlitepp::Stmt codeStmt(db.GetDB());
5658 codeStmt.Prepare("SELECT id, code_type, code, filename FROM shader_code WHERE shader_id = ?;");
5759 codeStmt.BindInt(1, data.id);
5860
@@ -89,8 +91,8 @@
8991 return out;
9092 }
9193
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());
9496 stmt.Prepare("UPDATE shader_code SET code = ?, filename = ? WHERE id = ?;");
9597
9698 stmt.BindText(1, data.code);
@@ -1,4 +1,6 @@
11 /*
2+# 076 License
3+
24 Copyright (c) テクニカル諏訪子
35
46 Permission is hereby granted to any person obtaining a copy of the software
@@ -1,4 +1,6 @@
11 /*
2+# 076 License
3+
24 Copyright (c) テクニカル諏訪子
35
46 Permission is hereby granted to any person obtaining a copy of the software
@@ -1,4 +1,6 @@
11 /*
2+# 076 License
3+
24 Copyright (c) テクニカル諏訪子
35
46 Permission is hereby granted to any person obtaining a copy of the software
@@ -1,4 +1,6 @@
11 /*
2+# 076 License
3+
24 Copyright (c) テクニカル諏訪子
35
46 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+*/
137 #include <gui/manual.hh>
238 #include <imgui.h>
339
@@ -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+*/
137 #include <gui/settings.hh>
238
339 namespace gui {
@@ -1,4 +1,6 @@
11 /*
2+# 076 License
3+
24 Copyright (c) テクニカル諏訪子
35
46 Permission is hereby granted to any person obtaining a copy of the software
@@ -1,4 +1,6 @@
11 /*
2+# 076 License
3+
24 Copyright (c) テクニカル諏訪子
35
46 Permission is hereby granted to any person obtaining a copy of the software
@@ -1,4 +1,6 @@
11 /*
2+# 076 License
3+
24 Copyright (c) テクニカル諏訪子
35
46 Permission is hereby granted to any person obtaining a copy of the software
@@ -1,4 +1,6 @@
11 /*
2+# 076 License
3+
24 Copyright (c) テクニカル諏訪子
35
46 Permission is hereby granted to any person obtaining a copy of the software
@@ -1,4 +1,6 @@
11 /*
2+# 076 License
3+
24 Copyright (c) テクニカル諏訪子
35
46 Permission is hereby granted to any person obtaining a copy of the software
@@ -1,27 +1,16 @@
11 /*
2+# 076 Free License
3+
24 Copyright (c) テクニカル諏訪子
35
46 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,
68 sublicense, and/or sell copies of the Software, subject to the following conditions:
79
810 1. **Origin Attribution**:
911 - You must not misrepresent the origin of the Software; you must not claim
1012 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**:
2514 - This license and the above copyright notice must remain intact in all copies
2615 of the source code.
2716
@@ -1,27 +1,16 @@
11 /*
2+# 076 Free License
3+
24 Copyright (c) テクニカル諏訪子
35
46 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,
68 sublicense, and/or sell copies of the Software, subject to the following conditions:
79
810 1. **Origin Attribution**:
911 - You must not misrepresent the origin of the Software; you must not claim
1012 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**:
2514 - This license and the above copyright notice must remain intact in all copies
2615 of the source code.
2716
@@ -1,27 +1,16 @@
11 /*
2+# 076 Free License
3+
24 Copyright (c) テクニカル諏訪子
35
46 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,
68 sublicense, and/or sell copies of the Software, subject to the following conditions:
79
810 1. **Origin Attribution**:
911 - You must not misrepresent the origin of the Software; you must not claim
1012 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**:
2514 - This license and the above copyright notice must remain intact in all copies
2615 of the source code.
2716
削除 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