author | unc0rr |
Tue, 28 Apr 2015 11:49:48 +0300 | |
branch | qmlfrontend |
changeset 10902 | 29519fe63fdd |
parent 10757 | f71275973737 |
permissions | -rw-r--r-- |
10434
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff
changeset
|
1 |
unit uFLUtils; |
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff
changeset
|
2 |
interface |
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff
changeset
|
3 |
|
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff
changeset
|
4 |
function str2PChar(const s: shortstring): PChar; |
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff
changeset
|
5 |
function intToStr(n: LongInt): shortstring; |
10616 | 6 |
function strToInt(s: shortstring): LongInt; |
10440 | 7 |
function midStr(s: shortstring; pos: byte): shortstring; |
10517 | 8 |
procedure underScore2Space(var s: shortstring); |
10757 | 9 |
function readInt(name, input: shortstring; var value: LongInt): boolean; |
10 |
function readBool(name, input: shortstring; var value: boolean): boolean; |
|
10434
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff
changeset
|
11 |
|
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff
changeset
|
12 |
implementation |
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff
changeset
|
13 |
|
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff
changeset
|
14 |
var |
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff
changeset
|
15 |
str2PCharBuffer: array[0..255] of char; |
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff
changeset
|
16 |
|
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff
changeset
|
17 |
function str2PChar(const s: shortstring): PChar; |
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff
changeset
|
18 |
var i: Integer; |
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff
changeset
|
19 |
begin |
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff
changeset
|
20 |
for i:= 1 to Length(s) do |
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff
changeset
|
21 |
begin |
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff
changeset
|
22 |
str2PCharBuffer[i - 1] := s[i]; |
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff
changeset
|
23 |
end; |
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff
changeset
|
24 |
str2PCharBuffer[Length(s)]:= #0; |
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff
changeset
|
25 |
str2PChar:= @(str2PCharBuffer[0]); |
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff
changeset
|
26 |
end; |
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff
changeset
|
27 |
|
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff
changeset
|
28 |
function intToStr(n: LongInt): shortstring; |
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff
changeset
|
29 |
begin |
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff
changeset
|
30 |
str(n, intToStr) |
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff
changeset
|
31 |
end; |
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff
changeset
|
32 |
|
10616 | 33 |
function strToInt(s: shortstring): LongInt; |
34 |
begin |
|
35 |
val(s, strToInt); |
|
36 |
end; |
|
37 |
||
10440 | 38 |
function midStr(s: shortstring; pos: byte): shortstring; |
39 |
begin |
|
40 |
midStr:= copy(s, pos, length(s) - pos + 1) |
|
41 |
end; |
|
42 |
||
10517 | 43 |
procedure underScore2Space(var s: shortstring); |
44 |
var i: LongInt; |
|
45 |
begin |
|
46 |
for i:= length(s) downto 1 do |
|
47 |
if s[i] = '_' then s[i]:= ' ' |
|
48 |
end; |
|
49 |
||
10757 | 50 |
function readInt(name, input: shortstring; var value: LongInt): boolean; |
51 |
var l: LongInt; |
|
52 |
begin |
|
53 |
name:= name + '='; |
|
54 |
l:= length(name); |
|
55 |
||
56 |
if copy(input, 1, l) = name then |
|
57 |
begin |
|
58 |
value:= strToInt(midStr(input, l + 1)); |
|
59 |
readInt:= true |
|
60 |
end |
|
61 |
else |
|
62 |
readInt:= false |
|
63 |
end; |
|
64 |
||
65 |
function readBool(name, input: shortstring; var value: boolean): boolean; |
|
66 |
var l: LongInt; |
|
67 |
begin |
|
68 |
name:= name + '='; |
|
69 |
l:= length(name); |
|
70 |
||
71 |
if copy(input, 1, l) = name then |
|
72 |
begin |
|
73 |
value:= (length(input) > l) and (input[l + 1] <> 'f'); |
|
74 |
readBool:= true |
|
75 |
end |
|
76 |
else |
|
77 |
readBool:= false |
|
78 |
end; |
|
79 |
||
10434
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff
changeset
|
80 |
end. |