syswide.inc 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. {
  2. *********************************************************************
  3. Copyright (C) 2002-2005 by Florian Klaempfl
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  15. *********************************************************************
  16. }
  17. function WideUpperCase(const s : WideString) : WideString;{$ifdef SYSUTILSINLINE}inline;{$endif}
  18. begin
  19. result:=widestringmanager.UpperWideStringProc(s);
  20. end;
  21. function WideLowerCase(const s : WideString) : WideString;{$ifdef SYSUTILSINLINE}inline;{$endif}
  22. begin
  23. result:=widestringmanager.LowerWideStringProc(s);
  24. end;
  25. function WideCompareStr(const s1, s2 : WideString) : PtrInt;{$ifdef SYSUTILSINLINE}inline;{$endif}
  26. begin
  27. result:=widestringmanager.CompareWideStringProc(s1,s2);
  28. end;
  29. function WideSameStr(const s1, s2 : WideString) : Boolean;{$ifdef SYSUTILSINLINE}inline;{$endif}
  30. begin
  31. result:=widestringmanager.CompareWideStringProc(s1,s2)=0;
  32. end;
  33. function WideCompareText(const s1, s2 : WideString) : PtrInt;{$ifdef SYSUTILSINLINE}inline;{$endif}
  34. begin
  35. result:=widestringmanager.CompareTextWideStringProc(s1,s2);
  36. end;
  37. function WideSameText(const s1, s2 : WideString) : Boolean;{$ifdef SYSUTILSINLINE}inline;{$endif}
  38. begin
  39. result:=widestringmanager.CompareTextWideStringProc(s1,s2)=0;
  40. end;
  41. { we've no templates, but with includes we can simulate this :) }
  42. {$macro on}
  43. {$define INWIDEFORMAT}
  44. {$define TFormatString:=widestring}
  45. {$define TFormatChar:=widechar}
  46. Function WideFormat (Const Fmt : WideString; const Args : Array of const) : WideString;
  47. {$i sysformt.inc}
  48. {$undef TFormatString}
  49. {$undef TFormatChar}
  50. {$undef INWIDEFORMAT}
  51. {$macro off}
  52. Function WideFormatBuf (Var Buffer; BufLen : Cardinal;
  53. Const Fmt; fmtLen : Cardinal;
  54. Const Args : Array of const) : Cardinal;
  55. Var
  56. S,F : WideString;
  57. begin
  58. Setlength(F,fmtlen);
  59. if fmtlen > 0 then
  60. Move(fmt,F[1],fmtlen*sizeof(Widechar));
  61. S:=WideFormat (F,Args);
  62. If Cardinal(Length(S))<Buflen then
  63. Result:=Length(S)
  64. else
  65. Result:=Buflen;
  66. Move(S[1],Buffer,Result);
  67. end;
  68. Procedure WideFmtStr(Var Res: WideString; Const Fmt : WideString; Const args: Array of const);
  69. begin
  70. Res:=WideFormat(fmt,Args);
  71. end;