diff options
| author | Julien Nabet <serval2412@yahoo.fr> | 2026-04-19 16:26:28 +0200 |
|---|---|---|
| committer | Julien Nabet <serval2412@yahoo.fr> | 2026-04-19 21:35:17 +0200 |
| commit | 05f7513a5fec87296cfac298f5fd3bfd0e0fc4bb (patch) | |
| tree | bc6d794deec818116355781c7a106052a49cb90d /icon-themes/oxygen/starmath/res/al21825.png | |
| parent | 793fd70ad62306ace8048918f954515a3158270e (diff) | |
Related tdf#164685: Cleanup class SfxItemSetFixed (sw remnants part1)HEADmaster
Python script used:
import re
from pathlib import Path
def transform(content: str) -> str:
i = 0
out = []
n = len(content)
while i < n:
if content.startswith("SfxItemSetFixed<", i):
i += len("SfxItemSetFixed<")
# --- parse template <...> avec équilibrage ---
depth = 1
start = i
while i < n and depth > 0:
if content[i] == '<':
depth += 1
elif content[i] == '>':
depth -= 1
i += 1
template = content[start:i-1]
# --- skip espaces ---
while i < n and content[i].isspace():
i += 1
# --- variable ---
m = re.match(r'[A-Za-z_]\w*', content[i:])
if not m:
out.append("SfxItemSetFixed<" + template + ">")
continue
var = m.group(0)
i += len(var)
# --- skip espaces ---
while i < n and content[i].isspace():
i += 1
# --- arguments (...) ---
if i >= n or content[i] != '(':
out.append("SfxItemSetFixed<" + template + ">" + var)
continue
i += 1
depth = 1
start = i
while i < n and depth > 0:
if content[i] == '(':
depth += 1
elif content[i] == ')':
depth -= 1
i += 1
args = content[start:i-1]
# --- remplacement ---
out.append(f"SfxItemSet {var}(SfxItemSet::makeFixedSfxItemSet<{template}>({args}))")
else:
out.append(content[i])
i += 1
return ''.join(out)
def process_file(path: Path):
text = path.read_text(encoding="utf-8")
new_text = transform(text)
if new_text != text:
backup = path.with_suffix(path.suffix + ".bak")
backup.write_text(text, encoding="utf-8")
path.write_text(new_text, encoding="utf-8")
print(f"Updated: {path}")
# --- scan files ---
for ext in ("*.cxx", "*.hxx"):
for file in Path(".").rglob(ext):
process_file(file)
Change-Id: I6b90d403777422d0d7aaa7b49bc117e653441eb7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/203935
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins
Diffstat (limited to 'icon-themes/oxygen/starmath/res/al21825.png')
0 files changed, 0 insertions, 0 deletions
