jastringh.inc 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 1999-2005,2011 by Florian Klaempfl and Jonas Maebe,
  4. members of the Free Pascal development team.
  5. This file implements support routines for AnsiStrings with FPC/JVM
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  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.
  11. **********************************************************************}
  12. {$define FPC_ANSISTRING_TYPE_DEFINED}
  13. type
  14. AnsistringClass = class sealed (JLObject)
  15. private
  16. var
  17. fElementSize: Word;
  18. fCodePage: TSystemCodePage;
  19. fdata: TAnsiCharArray;
  20. public
  21. constructor Create(len: longint; cp: TSystemCodePage);overload;
  22. constructor Create(const arr: array of ansichar; length: longint; cp: TSystemCodePage);overload;
  23. constructor Create(const arr: array of unicodechar; cp: TSystemCodePage);overload;
  24. constructor Create(const u: unicodestring);overload;
  25. constructor Create(const u: unicodestring; cp: TSystemCodePage);overload;
  26. constructor Create(const a: RawByteString; cp: TSystemCodePage);overload;
  27. constructor Create(const s: shortstring; cp: TSystemCodePage);overload;
  28. constructor Create(ch: ansichar; cp: TSystemCodePage);overload;
  29. constructor Create(ch: unicodechar; cp: TSystemCodePage);overload;
  30. class function CreateFromLiteralStringBytes(const u: unicodestring; cp: TSystemCodePage): RawByteString; static;
  31. function charAt(index: jint): ansichar;
  32. function toUnicodeString: unicodestring;
  33. function toShortstring(maxlen: byte): shortstring;
  34. function toString: JLString; override;
  35. // function concat(const a: ansistring): ansistring;
  36. // function concatmultiple(const arr: array of ansistring): ansistring;
  37. function length: jint;
  38. function codePage: TSystemCodePage;
  39. function elementSize: Word;
  40. class function internChars(const a: Ansistring): TAnsiCharArray; static;
  41. end;