home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 3 / AACD03.BIN / AACD / Programming / sofa / archive / exml.lha / exml / main / character_array_abs.e < prev    next >
Text File  |  1999-04-13  |  2KB  |  91 lines

  1. indexing
  2.     description:"inherits from ARRAY [CHARACTER] and implements the %
  3.                     %functionality of beeing created from a C-type string%
  4.                     %with a length value"
  5.     status:        "See notice at end of class."
  6.     author:        "Andreas Leitner"
  7.  
  8. deferred class
  9.     CHARACTER_ARRAY_ABS
  10. inherit
  11.     ARRAY [CHARACTER]
  12.         redefine
  13.             out
  14.         end
  15. feature {NONE} -- Initialisation
  16.     make_from_c (content_ptr: POINTER; len: INTEGER) is
  17.             -- make a ARRAY [CHARACTER] object from a C-type
  18.             -- character array at 'content_ptr' with the length
  19.             -- 'len'
  20.             -- Note: the memory must be copied from
  21.         require
  22.             content_ptr_not_null: content_ptr /= default_pointer
  23.             len >= 0
  24.         deferred
  25.       end
  26.  
  27.     make_from_string (a_string: STRING) is
  28.         require
  29.             a_string_not_void: a_string /= void
  30.         local
  31.             i: INTEGER
  32.         do
  33.             make (1, a_string.count)
  34.             from
  35.                 i := 1
  36.             until
  37.                 i > a_string.count
  38.             loop
  39.                 put (a_string.item (i), i)
  40.                 i := i + 1
  41.             end
  42.         end
  43.  
  44. feature
  45.     out: STRING is
  46.         local
  47.             i: INTEGER
  48.         do
  49.             from
  50.                 i := lower
  51.                 !! Result.make (0)
  52.             until
  53.                 i > upper
  54.             loop
  55.                 Result.append_character (item (i))
  56.                 i := i + 1
  57.             end
  58.         end
  59. feature
  60.     append (other: like Current) is
  61.             -- append 'other' to Current
  62.         require
  63.             other /= Void
  64.         local
  65.             i: INTEGER        
  66.         do
  67.             from
  68.                 i := 1
  69.             until
  70.                 i > other.count
  71.             loop
  72.                 force (other.item (i), count + 1)
  73.                 i := i + 1
  74.             end
  75.         end
  76.  
  77. end -- class CHARACTER_ARRAY_ABS
  78. --|-------------------------------------------------------------------------
  79. --| eXML, Eiffel XML Parser Toolkit
  80. --| Copyright (C) 1999  Andreas Leitner
  81. --| See the file forum.txt included in this package for licensing info.
  82. --|
  83. --| Comments, Questions, Additions to this library? please contact:
  84. --|
  85. --| Andreas Leitner
  86. --| Arndtgasse 1/3/5
  87. --| 8010 Graz
  88. --| Austria
  89. --| email: andreas.leitner@teleweb.at
  90. --| web: http://exml.dhs.org
  91. --|-------------------------------------------------------------------------