BCBvcl4pyAPI 0.1.5__tar.gz → 0.1.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2025 James Lin
2
+
3
+ All rights reserved.
4
+
5
+ Permission is granted for **personal, educational, or non-commercial use only**.
6
+ You **may NOT**:
7
+
8
+ 1. Sell or otherwise commercially exploit this software or any part of it.
9
+ 2. Reproduce, distribute, or sublicense this software for commercial purposes.
10
+ 3. Modify or create derivative works for commercial purposes without explicit written permission from the copyright holder.
11
+
12
+ You **may**:
13
+
14
+ - Use the software for personal learning, research, or internal company evaluation (non-commercial).
15
+ - Share the software with attribution to the original author, as long as it is not for commercial gain.
16
+
17
+ **Disclaimer:**
18
+ This software is provided "AS IS", without any warranty of any kind, either expressed or implied,
19
+ including but not limited to the warranties of merchantability, fitness for a particular purpose, or non-infringement.
20
+ In no event shall the author be liable for any claim, damages, or other liability arising from, out of, or in connection with the software or its use.
@@ -0,0 +1,43 @@
1
+ Metadata-Version: 2.4
2
+ Name: BCBvcl4pyAPI
3
+ Version: 0.1.6
4
+ Summary: BCBvcl4pyAPI Python package
5
+ Author-email: James Lin <tylin123@ms27.hinet.net>
6
+ License: Copyright (c) 2025 James Lin
7
+
8
+ All rights reserved.
9
+
10
+ Permission is granted for **personal, educational, or non-commercial use only**.
11
+ You **may NOT**:
12
+
13
+ 1. Sell or otherwise commercially exploit this software or any part of it.
14
+ 2. Reproduce, distribute, or sublicense this software for commercial purposes.
15
+ 3. Modify or create derivative works for commercial purposes without explicit written permission from the copyright holder.
16
+
17
+ You **may**:
18
+
19
+ - Use the software for personal learning, research, or internal company evaluation (non-commercial).
20
+ - Share the software with attribution to the original author, as long as it is not for commercial gain.
21
+
22
+ **Disclaimer:**
23
+ This software is provided "AS IS", without any warranty of any kind, either expressed or implied,
24
+ including but not limited to the warranties of merchantability, fitness for a particular purpose, or non-infringement.
25
+ In no event shall the author be liable for any claim, damages, or other liability arising from, out of, or in connection with the software or its use.
26
+
27
+ Project-URL: Homepage, https://mis.gotech.biz
28
+ Description-Content-Type: text/markdown
29
+ License-File: LICENSE
30
+ Requires-Dist: pymysql
31
+ Dynamic: license-file
32
+
33
+ #BCBvcl4pyAPI
34
+
35
+ ## History of version
36
+ Version 0.1.3: 2025/09/19<BR>
37
+ Mainly fixed the issue where Packages could not be found after an update.<BR>
38
+
39
+ Version 0.1.5: 2025/09/20<BR>
40
+ Add the HyperDynamicArray class to provide large memory access functionality.<BR>
41
+
42
+ Version 0.1.6: 2025/10/08<BR>
43
+ Add the AnsiString class
@@ -0,0 +1,11 @@
1
+ #BCBvcl4pyAPI
2
+
3
+ ## History of version
4
+ Version 0.1.3: 2025/09/19<BR>
5
+ Mainly fixed the issue where Packages could not be found after an update.<BR>
6
+
7
+ Version 0.1.5: 2025/09/20<BR>
8
+ Add the HyperDynamicArray class to provide large memory access functionality.<BR>
9
+
10
+ Version 0.1.6: 2025/10/08<BR>
11
+ Add the AnsiString class
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "BCBvcl4pyAPI"
7
- version = "0.1.5"
7
+ version = "0.1.6"
8
8
  description = "BCBvcl4pyAPI Python package"
9
9
  authors = [
10
10
  { name="James Lin", email="tylin123@ms27.hinet.net" }
@@ -17,3 +17,6 @@ dependencies = [
17
17
 
18
18
  [project.urls]
19
19
  Homepage = "https://mis.gotech.biz"
20
+
21
+ [tools.setuptools.packages.find]
22
+ where = ["src"]
@@ -0,0 +1,174 @@
1
+ class AnsiString:
2
+ def __init__(self, Pms_str: str = '', encoding: str = 'byte'):
3
+ """
4
+ encoding:
5
+ 'byte' -> BCB5 byte模式(中文佔兩個byte)
6
+ 'unicode' -> Unicode 字元模式
7
+ """
8
+ self.encoding = encoding
9
+ self.set(Pms_str)
10
+
11
+ # ---------------------------------------------
12
+ # 改變內容
13
+ # ---------------------------------------------
14
+ def set(self, Pms_str: str):
15
+ if self.encoding == 'byte':
16
+ self._data = Pms_str.encode('big5', errors='replace')
17
+ else:
18
+ self._data = Pms_str.encode('utf-8')
19
+ return self # 支援連鎖呼叫
20
+
21
+ # ---------------------------------------------
22
+ # 轉成 Python str
23
+ # ---------------------------------------------
24
+ def str(self):
25
+ if self.encoding == 'byte':
26
+ return self._data.decode('big5', errors='replace')
27
+ else:
28
+ return self._data.decode('utf-8')
29
+
30
+ def __str__(self):
31
+ return self.str()
32
+
33
+ # ---------------------------------------------
34
+ # 取 C 字串 bytes
35
+ # ---------------------------------------------
36
+ def c_str(self):
37
+ return self._data
38
+
39
+ # ---------------------------------------------
40
+ # 支援索引取單 byte
41
+ # ---------------------------------------------
42
+ def __getitem__(self, index):
43
+ return self._data[index]
44
+
45
+ # ---------------------------------------------
46
+ # SubString
47
+ # mode='byte' / 'unicode'
48
+ # ---------------------------------------------
49
+ def SubString(self, start: int, length: int = None, mode: str = None):
50
+ mode = mode or self.encoding
51
+ if mode == 'unicode':
52
+ s = self.str()
53
+ start -= 1
54
+ if length is None:
55
+ return AnsiString(s[start:], encoding=self.encoding)
56
+ else:
57
+ return AnsiString(s[start:start+length], encoding=self.encoding)
58
+ elif mode == 'byte':
59
+ start -= 1
60
+ if length is None:
61
+ return AnsiString(self._data[start:].decode('big5', errors='replace'), encoding=self.encoding)
62
+ else:
63
+ return AnsiString(self._data[start:start+length].decode('big5', errors='replace'), encoding=self.encoding)
64
+ else:
65
+ raise ValueError("mode must be 'byte' or 'unicode'")
66
+
67
+ # ---------------------------------------------
68
+ # 長度
69
+ # ---------------------------------------------
70
+ def Length(self, mode: str = None):
71
+ mode = mode or self.encoding
72
+ if mode == 'unicode':
73
+ return len(self.str())
74
+ elif mode == 'byte':
75
+ return len(self._data)
76
+ else:
77
+ raise ValueError("mode must be 'byte' or 'unicode'")
78
+
79
+ @staticmethod
80
+ def strlen(Pms_str: str, encoding: str = 'byte'):
81
+ if encoding == 'unicode':
82
+ return len(Pms_str)
83
+ elif encoding == 'byte':
84
+ return len(Pms_str.encode('big5', errors='replace'))
85
+ else:
86
+ raise ValueError("encoding must be 'byte' or 'unicode'")
87
+
88
+ # ---------------------------------------------
89
+ # 常用方法
90
+ # ---------------------------------------------
91
+ def Trim(self):
92
+ return AnsiString(self.str().strip(), encoding=self.encoding)
93
+
94
+ def UpperCase(self):
95
+ return AnsiString(self.str().upper(), encoding=self.encoding)
96
+
97
+ def LowerCase(self):
98
+ return AnsiString(self.str().lower(), encoding=self.encoding)
99
+
100
+ def Pos(self, sub: str):
101
+ idx = self.str().find(sub)
102
+ return idx + 1 if idx >= 0 else 0
103
+
104
+ @staticmethod
105
+ def StringOfChar(char: str, count: int, encoding='byte'):
106
+ return AnsiString(char * count, encoding=encoding)
107
+
108
+ @staticmethod
109
+ def sprintf(fmt: str, *args, encoding='byte'):
110
+ return AnsiString(fmt % args, encoding=encoding)
111
+
112
+ # ---------------------------------------------
113
+ # + 運算子
114
+ # ---------------------------------------------
115
+ def __add__(self, other):
116
+ if isinstance(other, AnsiString):
117
+ combined_str = self.str() + other.str()
118
+ elif isinstance(other, str):
119
+ combined_str = self.str() + other
120
+ else:
121
+ raise TypeError("Can only add AnsiString or str")
122
+ return AnsiString(combined_str, encoding=self.encoding)
123
+
124
+ # ---------------------------------------------
125
+ # += 原地累加
126
+ # ---------------------------------------------
127
+ def __iadd__(self, other):
128
+ if isinstance(other, AnsiString):
129
+ new_str = self.str() + other.str()
130
+ elif isinstance(other, str):
131
+ new_str = self.str() + other
132
+ else:
133
+ raise TypeError("Can only add AnsiString or str")
134
+ if self.encoding == 'byte':
135
+ self._data = new_str.encode('big5', errors='replace')
136
+ else:
137
+ self._data = new_str.encode('utf-8')
138
+ return self
139
+
140
+ # ================================================================================
141
+ if(__name__=="__main__"):
142
+ s = AnsiString(" test--測試1234 ")
143
+
144
+ # 連鎖呼叫
145
+ result = s.Trim().UpperCase().SubString(3,5)
146
+ print(str(result)) # 結果: "ST--測試1"
147
+
148
+ # 改變內容也可以連鎖
149
+ s.set("abc 中文").UpperCase().Trim()
150
+ print(str(s)) # "ABC 中文"
151
+
152
+ # 取長度
153
+ print(s.Length()) # byte 長度
154
+ print(s.Length(mode='unicode')) # 字元長度
155
+
156
+ # 靜態 strlen
157
+ ms_MyStr = "test--測試1234"
158
+ mi_Len = AnsiString.strlen(ms_MyStr, encoding="unicode")
159
+ print("mi_Len unicode:", mi_Len)
160
+ mi_Len_byte = AnsiString.strlen(ms_MyStr, encoding="byte")
161
+ print("mi_Len byte:", mi_Len_byte)
162
+
163
+ # SubString byte/unicode
164
+ print(str(s.SubString(2,3))) # byte模式
165
+ print(str(s.SubString(2,3, mode='unicode'))) # unicode模式
166
+
167
+
168
+ s.set(str(ms_MyStr))
169
+ print(s.str()) # "新的字串" -> 大寫 "新的字串"
170
+ print(s.Pos("測"))
171
+
172
+ print(f"[{s}] ----> len1={s.Length()}");
173
+ s+="-->增加字";
174
+ print(f"[{s}] ----> len2={s.Length()}");
@@ -0,0 +1,5 @@
1
+ from .BCBvcl4pyAPI import TStringList, TList, DynamicArray
2
+ from .HyperDynamicArrayAPI import HyperDynamicArray
3
+ from .AnsiStringAPI import AnsiString
4
+
5
+ __all__ = ["TStringList", "TList", "DynamicArray", "HyperDynamicArray", "AnsiString"]
@@ -0,0 +1,43 @@
1
+ Metadata-Version: 2.4
2
+ Name: BCBvcl4pyAPI
3
+ Version: 0.1.6
4
+ Summary: BCBvcl4pyAPI Python package
5
+ Author-email: James Lin <tylin123@ms27.hinet.net>
6
+ License: Copyright (c) 2025 James Lin
7
+
8
+ All rights reserved.
9
+
10
+ Permission is granted for **personal, educational, or non-commercial use only**.
11
+ You **may NOT**:
12
+
13
+ 1. Sell or otherwise commercially exploit this software or any part of it.
14
+ 2. Reproduce, distribute, or sublicense this software for commercial purposes.
15
+ 3. Modify or create derivative works for commercial purposes without explicit written permission from the copyright holder.
16
+
17
+ You **may**:
18
+
19
+ - Use the software for personal learning, research, or internal company evaluation (non-commercial).
20
+ - Share the software with attribution to the original author, as long as it is not for commercial gain.
21
+
22
+ **Disclaimer:**
23
+ This software is provided "AS IS", without any warranty of any kind, either expressed or implied,
24
+ including but not limited to the warranties of merchantability, fitness for a particular purpose, or non-infringement.
25
+ In no event shall the author be liable for any claim, damages, or other liability arising from, out of, or in connection with the software or its use.
26
+
27
+ Project-URL: Homepage, https://mis.gotech.biz
28
+ Description-Content-Type: text/markdown
29
+ License-File: LICENSE
30
+ Requires-Dist: pymysql
31
+ Dynamic: license-file
32
+
33
+ #BCBvcl4pyAPI
34
+
35
+ ## History of version
36
+ Version 0.1.3: 2025/09/19<BR>
37
+ Mainly fixed the issue where Packages could not be found after an update.<BR>
38
+
39
+ Version 0.1.5: 2025/09/20<BR>
40
+ Add the HyperDynamicArray class to provide large memory access functionality.<BR>
41
+
42
+ Version 0.1.6: 2025/10/08<BR>
43
+ Add the AnsiString class
@@ -0,0 +1,16 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ setup.cfg
5
+ src/BCBvcl4pyAPI/AnsiStringAPI.py
6
+ src/BCBvcl4pyAPI/BCBvcl4pyAPI.py
7
+ src/BCBvcl4pyAPI/HyperDynamicArrayAPI.py
8
+ src/BCBvcl4pyAPI/__init__.py
9
+ src/BCBvcl4pyAPI.egg-info/PKG-INFO
10
+ src/BCBvcl4pyAPI.egg-info/SOURCES.txt
11
+ src/BCBvcl4pyAPI.egg-info/dependency_links.txt
12
+ src/BCBvcl4pyAPI.egg-info/requires.txt
13
+ src/BCBvcl4pyAPI.egg-info/top_level.txt
14
+ src/Example/PyListTest.py
15
+ src/Example/PyListTest2.py
16
+ src/Example/TestHyperList.py
@@ -0,0 +1,25 @@
1
+ from BCBvcl4pyAPI import TStringList
2
+ from BCBvcl4pyAPI import DynamicArray
3
+
4
+ mi_c : int = 0;
5
+
6
+ obj_StrList = TStringList();
7
+
8
+ obj_StrList.Add("Str--1");
9
+ obj_StrList.Add("Str--2");
10
+
11
+ print();
12
+ for mi_c in range(0, obj_StrList.Count()):
13
+ print(f"data {mi_c}: {obj_StrList[mi_c]}");
14
+
15
+
16
+ mda_Values = DynamicArray[float]();
17
+
18
+ mda_Values.Add(1.2);
19
+ mda_Values.Add(2.2);
20
+ mda_Values.Add(3.2);
21
+ mda_Values.Add(4.2);
22
+ mda_Values.Add(5.2);
23
+
24
+ for mi_c in range(0, mda_Values.Length()):
25
+ print(f"data_float = {mda_Values[mi_c]}");
@@ -0,0 +1,19 @@
1
+ from BCBvcl4pyAPI import TStringList
2
+ from BCBvcl4pyAPI import DynamicArray
3
+
4
+ obj_MyList : TStringList;
5
+ mda_MyValues : DynamicArray;
6
+ mi_c : int = 0;
7
+
8
+ mda_MyValues = DynamicArray();
9
+
10
+ mda_MyValues.Add(0.319);
11
+ mda_MyValues.Add(4.123);
12
+ mda_MyValues.Add(3.621);
13
+
14
+ for mi_c in range(0, mda_MyValues.Length()):
15
+ print(mda_MyValues[mi_c]);
16
+
17
+
18
+ obj_MyList = TStringList();
19
+ obj_MyList.Add("OKOK");
@@ -0,0 +1,38 @@
1
+ from BCBvcl4pyAPI import HyperDynamicArray
2
+ from dataclasses import dataclass
3
+
4
+ @dataclass
5
+ class TPerson:
6
+ name: str
7
+ age: int
8
+
9
+ # 建立記憶體 table 模式
10
+ arr = HyperDynamicArray[TPerson](
11
+ mysql_host="mis.gotech.biz",
12
+ mysql_port= 3300,
13
+ mysql_user="root",
14
+ mysql_password="gotechdf8000sys",
15
+ mysql_db="df8000",
16
+ table_name="_mem_dataset",
17
+ table_type="memory"
18
+ )
19
+
20
+ arr.Clear();
21
+
22
+ # 加入元素
23
+ for i in range(500):
24
+ arr.Add(TPerson(f"Person{i}", 20+i))
25
+
26
+ print("元素總數:", arr.Count())
27
+
28
+ # 讀取
29
+ for i in range(arr.Count()):
30
+ print(arr[i])
31
+
32
+ print(arr[106].name);
33
+
34
+ # 清空 table
35
+ #arr.Clear()
36
+ #print("清空後元素總數:", arr.Count())
37
+
38
+ arr.Close()
@@ -1,4 +0,0 @@
1
- from .BCBvcl4pyAPI import TStringList, TList, DynamicArray
2
- from .HyperDynamicArrayAPI import HyperDynamicArray
3
-
4
- __all__ = ["TStringList", "TList", "DynamicArray", "HyperDynamicArray"]
@@ -1,13 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: BCBvcl4pyAPI
3
- Version: 0.1.5
4
- Summary: BCBvcl4pyAPI Python package
5
- Author-email: James Lin <tylin123@ms27.hinet.net>
6
- Project-URL: Homepage, https://mis.gotech.biz
7
- Description-Content-Type: text/markdown
8
- Requires-Dist: pymysql
9
-
10
- Version 0.1.3: 2025/09/19
11
- Mainly fixed the issue where Packages could not be found after an update.
12
- Version 0.1.5: 2025/09/20
13
- Add the HyperDynamicArray class to provide large memory access functionality.
@@ -1,11 +0,0 @@
1
- README.md
2
- pyproject.toml
3
- setup.cfg
4
- BCBvcl4pyAPI/BCBvcl4pyAPI.py
5
- BCBvcl4pyAPI/HyperDynamicArrayAPI.py
6
- BCBvcl4pyAPI/__init__.py
7
- BCBvcl4pyAPI.egg-info/PKG-INFO
8
- BCBvcl4pyAPI.egg-info/SOURCES.txt
9
- BCBvcl4pyAPI.egg-info/dependency_links.txt
10
- BCBvcl4pyAPI.egg-info/requires.txt
11
- BCBvcl4pyAPI.egg-info/top_level.txt
@@ -1,13 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: BCBvcl4pyAPI
3
- Version: 0.1.5
4
- Summary: BCBvcl4pyAPI Python package
5
- Author-email: James Lin <tylin123@ms27.hinet.net>
6
- Project-URL: Homepage, https://mis.gotech.biz
7
- Description-Content-Type: text/markdown
8
- Requires-Dist: pymysql
9
-
10
- Version 0.1.3: 2025/09/19
11
- Mainly fixed the issue where Packages could not be found after an update.
12
- Version 0.1.5: 2025/09/20
13
- Add the HyperDynamicArray class to provide large memory access functionality.
@@ -1,4 +0,0 @@
1
- Version 0.1.3: 2025/09/19
2
- Mainly fixed the issue where Packages could not be found after an update.
3
- Version 0.1.5: 2025/09/20
4
- Add the HyperDynamicArray class to provide large memory access functionality.
File without changes