syswide.inc 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. {
  2. *********************************************************************
  3. $Id$
  4. Copyright (C) 2002-2005 by Florian Klaempfl
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16. *********************************************************************
  17. }
  18. function WideUpperCase(const s : WideString) : WideString;{$ifdef SYSUTILSINLINE}inline;{$endif}
  19. begin
  20. result:=widestringmanager.UpperWideStringProc(s);
  21. end;
  22. function WideLowerCase(const s : WideString) : WideString;{$ifdef SYSUTILSINLINE}inline;{$endif}
  23. begin
  24. result:=widestringmanager.LowerWideStringProc(s);
  25. end;
  26. function WideCompareStr(const s1, s2 : WideString) : PtrInt;{$ifdef SYSUTILSINLINE}inline;{$endif}
  27. begin
  28. result:=widestringmanager.CompareWideStringProc(s1,s2);
  29. end;
  30. function WideSameStr(const s1, s2 : WideString) : Boolean;{$ifdef SYSUTILSINLINE}inline;{$endif}
  31. begin
  32. result:=widestringmanager.CompareWideStringProc(s1,s2)=0;
  33. end;
  34. function WideCompareText(const s1, s2 : WideString) : PtrInt;{$ifdef SYSUTILSINLINE}inline;{$endif}
  35. begin
  36. result:=widestringmanager.CompareTextWideStringProc(s1,s2);
  37. end;
  38. function WideSameText(const s1, s2 : WideString) : Boolean;{$ifdef SYSUTILSINLINE}inline;{$endif}
  39. begin
  40. result:=widestringmanager.CompareTextWideStringProc(s1,s2)=0;
  41. end;
  42. { we've no templates, but with includes we can simulate this :) }
  43. {$macro on}
  44. {$define INWIDEFORMAT}
  45. {$define TFormatString:=widestring}
  46. {$define TFormatChar:=widechar}
  47. Function WideFormat (Const Fmt : WideString; const Args : Array of const) : WideString;
  48. {$i sysformt.inc}
  49. {$undef TFormatString}
  50. {$undef TFormatChar}
  51. {$undef INWIDEFORMAT}
  52. {$macro off}
  53. Function WideFormatBuf (Var Buffer; BufLen : Cardinal;
  54. Const Fmt; fmtLen : Cardinal;
  55. Const Args : Array of const) : Cardinal;
  56. Var
  57. S,F : WideString;
  58. begin
  59. Setlength(F,fmtlen);
  60. if fmtlen > 0 then
  61. Move(fmt,F[1],fmtlen*sizeof(Widechar));
  62. S:=WideFormat (F,Args);
  63. If Cardinal(Length(S))<Buflen then
  64. Result:=Length(S)
  65. else
  66. Result:=Buflen;
  67. Move(S[1],Buffer,Result);
  68. end;
  69. Procedure WideFmtStr(Var Res: WideString; Const Fmt : WideString; Const args: Array of const);
  70. begin
  71. Res:=WideFormat(fmt,Args);
  72. end;
  73. {
  74. $Log$
  75. Revision 1.7 2005-03-12 14:56:22 florian
  76. + added Ansi* routines to widestring manager
  77. * made them using OS calls on windows
  78. Revision 1.6 2005/03/06 18:28:23 florian
  79. + WideFormatBuf and WideFmtStr implemented
  80. Revision 1.5 2005/02/26 15:00:14 florian
  81. + WideSameStr
  82. Revision 1.4 2005/02/26 10:21:17 florian
  83. + implemented WideFormat
  84. + some Widestring stuff implemented
  85. * some Widestring stuff fixed
  86. Revision 1.3 2005/02/14 17:13:31 peter
  87. * truncate log
  88. Revision 1.2 2005/02/03 18:40:02 florian
  89. * compilation with 1.0.x fixed
  90. + infrastructure for WideCompareText implemented
  91. Revision 1.1 2005/02/01 20:22:50 florian
  92. * improved widestring infrastructure manager
  93. }