gccxml_gem 0.9-x86-cygwin

Sign up to get free protection for your applications and to get access to all the features.
Files changed (241) hide show
  1. data/Rakefile +75 -0
  2. data/bin/gccxml.exe +0 -0
  3. data/bin/gccxml_cc1plus.exe +0 -0
  4. data/gccxml.rb +50 -0
  5. data/share/doc/gccxml-0.9/Copyright.txt +55 -0
  6. data/share/doc/gccxml-0.9/gccxml.html +168 -0
  7. data/share/doc/gccxml-0.9/gccxml.txt +293 -0
  8. data/share/gccxml-0.9/Borland/5.5/Wrappers/algorithm +7 -0
  9. data/share/gccxml-0.9/Borland/5.5/Wrappers/algorithm.h +7 -0
  10. data/share/gccxml-0.9/Borland/5.5/Wrappers/bitset +7 -0
  11. data/share/gccxml-0.9/Borland/5.5/Wrappers/bitset.h +7 -0
  12. data/share/gccxml-0.9/Borland/5.5/Wrappers/cctype +1 -0
  13. data/share/gccxml-0.9/Borland/5.5/Wrappers/cfloat +1 -0
  14. data/share/gccxml-0.9/Borland/5.5/Wrappers/climits +1 -0
  15. data/share/gccxml-0.9/Borland/5.5/Wrappers/cmath +1 -0
  16. data/share/gccxml-0.9/Borland/5.5/Wrappers/complex +7 -0
  17. data/share/gccxml-0.9/Borland/5.5/Wrappers/complex.h +7 -0
  18. data/share/gccxml-0.9/Borland/5.5/Wrappers/cstddef +1 -0
  19. data/share/gccxml-0.9/Borland/5.5/Wrappers/cstdio +1 -0
  20. data/share/gccxml-0.9/Borland/5.5/Wrappers/cstdlib +1 -0
  21. data/share/gccxml-0.9/Borland/5.5/Wrappers/cstring +7 -0
  22. data/share/gccxml-0.9/Borland/5.5/Wrappers/cstring.h +7 -0
  23. data/share/gccxml-0.9/Borland/5.5/Wrappers/ctime +1 -0
  24. data/share/gccxml-0.9/Borland/5.5/Wrappers/cwchar +1 -0
  25. data/share/gccxml-0.9/Borland/5.5/Wrappers/cwctype +1 -0
  26. data/share/gccxml-0.9/Borland/5.5/Wrappers/deque +7 -0
  27. data/share/gccxml-0.9/Borland/5.5/Wrappers/deque.h +7 -0
  28. data/share/gccxml-0.9/Borland/5.5/Wrappers/exception +7 -0
  29. data/share/gccxml-0.9/Borland/5.5/Wrappers/exception.h +7 -0
  30. data/share/gccxml-0.9/Borland/5.5/Wrappers/fstream +7 -0
  31. data/share/gccxml-0.9/Borland/5.5/Wrappers/fstream.h +7 -0
  32. data/share/gccxml-0.9/Borland/5.5/Wrappers/function +7 -0
  33. data/share/gccxml-0.9/Borland/5.5/Wrappers/function.h +7 -0
  34. data/share/gccxml-0.9/Borland/5.5/Wrappers/functional +7 -0
  35. data/share/gccxml-0.9/Borland/5.5/Wrappers/gccxml_typeinfo.h +146 -0
  36. data/share/gccxml-0.9/Borland/5.5/Wrappers/iomanip +7 -0
  37. data/share/gccxml-0.9/Borland/5.5/Wrappers/iomanip.h +7 -0
  38. data/share/gccxml-0.9/Borland/5.5/Wrappers/ios +7 -0
  39. data/share/gccxml-0.9/Borland/5.5/Wrappers/ios.h +7 -0
  40. data/share/gccxml-0.9/Borland/5.5/Wrappers/iosfwd +7 -0
  41. data/share/gccxml-0.9/Borland/5.5/Wrappers/iosfwd.h +7 -0
  42. data/share/gccxml-0.9/Borland/5.5/Wrappers/iostream +7 -0
  43. data/share/gccxml-0.9/Borland/5.5/Wrappers/iostream.h +7 -0
  44. data/share/gccxml-0.9/Borland/5.5/Wrappers/istream +7 -0
  45. data/share/gccxml-0.9/Borland/5.5/Wrappers/istream.h +7 -0
  46. data/share/gccxml-0.9/Borland/5.5/Wrappers/iterator +7 -0
  47. data/share/gccxml-0.9/Borland/5.5/Wrappers/iterator.h +7 -0
  48. data/share/gccxml-0.9/Borland/5.5/Wrappers/limits +7 -0
  49. data/share/gccxml-0.9/Borland/5.5/Wrappers/limits.h +7 -0
  50. data/share/gccxml-0.9/Borland/5.5/Wrappers/list +7 -0
  51. data/share/gccxml-0.9/Borland/5.5/Wrappers/list.h +7 -0
  52. data/share/gccxml-0.9/Borland/5.5/Wrappers/locale +7 -0
  53. data/share/gccxml-0.9/Borland/5.5/Wrappers/locale.h +7 -0
  54. data/share/gccxml-0.9/Borland/5.5/Wrappers/map +7 -0
  55. data/share/gccxml-0.9/Borland/5.5/Wrappers/map.h +7 -0
  56. data/share/gccxml-0.9/Borland/5.5/Wrappers/memory +7 -0
  57. data/share/gccxml-0.9/Borland/5.5/Wrappers/memory.h +7 -0
  58. data/share/gccxml-0.9/Borland/5.5/Wrappers/new +7 -0
  59. data/share/gccxml-0.9/Borland/5.5/Wrappers/new.h +7 -0
  60. data/share/gccxml-0.9/Borland/5.5/Wrappers/numeric +7 -0
  61. data/share/gccxml-0.9/Borland/5.5/Wrappers/numeric.h +7 -0
  62. data/share/gccxml-0.9/Borland/5.5/Wrappers/ostream +7 -0
  63. data/share/gccxml-0.9/Borland/5.5/Wrappers/ostream.h +7 -0
  64. data/share/gccxml-0.9/Borland/5.5/Wrappers/queue +7 -0
  65. data/share/gccxml-0.9/Borland/5.5/Wrappers/queue.h +7 -0
  66. data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/codecvt +1 -0
  67. data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/collate +1 -0
  68. data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/ctype +1 -0
  69. data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/iosbase +1 -0
  70. data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/iotraits +1 -0
  71. data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/iterator +1 -0
  72. data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/lochelp +1 -0
  73. data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/locimpl +1 -0
  74. data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/locvector +1 -0
  75. data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/messages +1 -0
  76. data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/money +1 -0
  77. data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/numbrw +1 -0
  78. data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/numeral +1 -0
  79. data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/rwdispatch.h +1 -0
  80. data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/rwlocale +1 -0
  81. data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/rwstderr_macros.h +64 -0
  82. data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/string_ref +1 -0
  83. data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/time +1 -0
  84. data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/traits +1 -0
  85. data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/tree +1 -0
  86. data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/usefacet +1 -0
  87. data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/valimp +1 -0
  88. data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/vendor +1 -0
  89. data/share/gccxml-0.9/Borland/5.5/Wrappers/set +7 -0
  90. data/share/gccxml-0.9/Borland/5.5/Wrappers/set.h +7 -0
  91. data/share/gccxml-0.9/Borland/5.5/Wrappers/sstream +7 -0
  92. data/share/gccxml-0.9/Borland/5.5/Wrappers/sstream.h +7 -0
  93. data/share/gccxml-0.9/Borland/5.5/Wrappers/stack +7 -0
  94. data/share/gccxml-0.9/Borland/5.5/Wrappers/stack.h +7 -0
  95. data/share/gccxml-0.9/Borland/5.5/Wrappers/stdexcept +7 -0
  96. data/share/gccxml-0.9/Borland/5.5/Wrappers/stdexcept.h +7 -0
  97. data/share/gccxml-0.9/Borland/5.5/Wrappers/streambuf +7 -0
  98. data/share/gccxml-0.9/Borland/5.5/Wrappers/streambuf.h +7 -0
  99. data/share/gccxml-0.9/Borland/5.5/Wrappers/string +7 -0
  100. data/share/gccxml-0.9/Borland/5.5/Wrappers/string.h +7 -0
  101. data/share/gccxml-0.9/Borland/5.5/Wrappers/strstream +7 -0
  102. data/share/gccxml-0.9/Borland/5.5/Wrappers/strstream.h +7 -0
  103. data/share/gccxml-0.9/Borland/5.5/Wrappers/typeinfo +7 -0
  104. data/share/gccxml-0.9/Borland/5.5/Wrappers/typeinfo.h +7 -0
  105. data/share/gccxml-0.9/Borland/5.5/Wrappers/utility +7 -0
  106. data/share/gccxml-0.9/Borland/5.5/Wrappers/utility.h +7 -0
  107. data/share/gccxml-0.9/Borland/5.5/Wrappers/valarray +7 -0
  108. data/share/gccxml-0.9/Borland/5.5/Wrappers/valarray.h +7 -0
  109. data/share/gccxml-0.9/Borland/5.5/Wrappers/vector +7 -0
  110. data/share/gccxml-0.9/Borland/5.5/Wrappers/vector.h +7 -0
  111. data/share/gccxml-0.9/Borland/5.5/except.h +154 -0
  112. data/share/gccxml-0.9/Borland/5.5/gccxml_fstream.h +431 -0
  113. data/share/gccxml-0.9/Borland/5.5/gccxml_new.h +166 -0
  114. data/share/gccxml-0.9/Borland/5.5/gccxml_valarray.h +786 -0
  115. data/share/gccxml-0.9/Borland/5.5/gccxml_vector.h +1457 -0
  116. data/share/gccxml-0.9/Borland/5.5/io.h +352 -0
  117. data/share/gccxml-0.9/Borland/5.5/oaidl.h +7006 -0
  118. data/share/gccxml-0.9/Borland/5.5/propidl.h +1477 -0
  119. data/share/gccxml-0.9/Borland/5.5/rw/locimpl.h +477 -0
  120. data/share/gccxml-0.9/Borland/5.5/rw/rwlocale.h +619 -0
  121. data/share/gccxml-0.9/Borland/5.5/stdarg.h +55 -0
  122. data/share/gccxml-0.9/Borland/5.5/valarray.cc +2883 -0
  123. data/share/gccxml-0.9/GCC/2.95/algorithm +76 -0
  124. data/share/gccxml-0.9/GCC/2.95/bitset +17 -0
  125. data/share/gccxml-0.9/GCC/2.95/cctype +24 -0
  126. data/share/gccxml-0.9/GCC/2.95/clocale +14 -0
  127. data/share/gccxml-0.9/GCC/2.95/cmath +33 -0
  128. data/share/gccxml-0.9/GCC/2.95/complex +38 -0
  129. data/share/gccxml-0.9/GCC/2.95/csetjmp +13 -0
  130. data/share/gccxml-0.9/GCC/2.95/csignal +14 -0
  131. data/share/gccxml-0.9/GCC/2.95/cstdarg +12 -0
  132. data/share/gccxml-0.9/GCC/2.95/cstddef +13 -0
  133. data/share/gccxml-0.9/GCC/2.95/cstdio +55 -0
  134. data/share/gccxml-0.9/GCC/2.95/cstdlib +66 -0
  135. data/share/gccxml-0.9/GCC/2.95/cstring +34 -0
  136. data/share/gccxml-0.9/GCC/2.95/ctime +24 -0
  137. data/share/gccxml-0.9/GCC/2.95/cwchar +65 -0
  138. data/share/gccxml-0.9/GCC/2.95/cwctype +31 -0
  139. data/share/gccxml-0.9/GCC/2.95/deque +19 -0
  140. data/share/gccxml-0.9/GCC/2.95/exception +20 -0
  141. data/share/gccxml-0.9/GCC/2.95/fstream +23 -0
  142. data/share/gccxml-0.9/GCC/2.95/functional +64 -0
  143. data/share/gccxml-0.9/GCC/2.95/gccxml_bitset +1066 -0
  144. data/share/gccxml-0.9/GCC/2.95/iomanip +20 -0
  145. data/share/gccxml-0.9/GCC/2.95/iosfwd +20 -0
  146. data/share/gccxml-0.9/GCC/2.95/iostream +27 -0
  147. data/share/gccxml-0.9/GCC/2.95/iterator +39 -0
  148. data/share/gccxml-0.9/GCC/2.95/list +19 -0
  149. data/share/gccxml-0.9/GCC/2.95/map +20 -0
  150. data/share/gccxml-0.9/GCC/2.95/memory +21 -0
  151. data/share/gccxml-0.9/GCC/2.95/new +13 -0
  152. data/share/gccxml-0.9/GCC/2.95/numeric +15 -0
  153. data/share/gccxml-0.9/GCC/2.95/pthread.h +16 -0
  154. data/share/gccxml-0.9/GCC/2.95/queue +20 -0
  155. data/share/gccxml-0.9/GCC/2.95/set +20 -0
  156. data/share/gccxml-0.9/GCC/2.95/sstream +24 -0
  157. data/share/gccxml-0.9/GCC/2.95/stack +19 -0
  158. data/share/gccxml-0.9/GCC/2.95/std/bastring.cc +524 -0
  159. data/share/gccxml-0.9/GCC/2.95/std/complext.h +397 -0
  160. data/share/gccxml-0.9/GCC/2.95/std/dcomplex.h +92 -0
  161. data/share/gccxml-0.9/GCC/2.95/std/fcomplex.h +88 -0
  162. data/share/gccxml-0.9/GCC/2.95/std/gslice_array.h +170 -0
  163. data/share/gccxml-0.9/GCC/2.95/std/indirect_array.h +157 -0
  164. data/share/gccxml-0.9/GCC/2.95/std/ldcomplex.h +96 -0
  165. data/share/gccxml-0.9/GCC/2.95/std/mask_array.h +154 -0
  166. data/share/gccxml-0.9/GCC/2.95/std/slice_array.h +156 -0
  167. data/share/gccxml-0.9/GCC/2.95/std/std_valarray.h +728 -0
  168. data/share/gccxml-0.9/GCC/2.95/std/straits.h +162 -0
  169. data/share/gccxml-0.9/GCC/2.95/std/valarray_meta.h +1035 -0
  170. data/share/gccxml-0.9/GCC/2.95/stdexcept +17 -0
  171. data/share/gccxml-0.9/GCC/2.95/stl_alloc.h +1057 -0
  172. data/share/gccxml-0.9/GCC/2.95/stl_bvector.h +836 -0
  173. data/share/gccxml-0.9/GCC/2.95/stl_deque.h +1699 -0
  174. data/share/gccxml-0.9/GCC/2.95/stl_list.h +843 -0
  175. data/share/gccxml-0.9/GCC/2.95/stl_tree.h +1331 -0
  176. data/share/gccxml-0.9/GCC/2.95/stl_vector.h +828 -0
  177. data/share/gccxml-0.9/GCC/2.95/string +26 -0
  178. data/share/gccxml-0.9/GCC/2.95/strstream +23 -0
  179. data/share/gccxml-0.9/GCC/2.95/typeinfo +11 -0
  180. data/share/gccxml-0.9/GCC/2.95/utility +25 -0
  181. data/share/gccxml-0.9/GCC/2.95/valarray +52 -0
  182. data/share/gccxml-0.9/GCC/2.95/vector +19 -0
  183. data/share/gccxml-0.9/GCC/2.96/sstream +305 -0
  184. data/share/gccxml-0.9/GCC/3.0/pthread.h +16 -0
  185. data/share/gccxml-0.9/GCC/3.1/pthread.h +16 -0
  186. data/share/gccxml-0.9/GCC/3.2/bits/fstream.tcc +500 -0
  187. data/share/gccxml-0.9/GCC/3.2/bits/istream.tcc +1207 -0
  188. data/share/gccxml-0.9/GCC/3.2/bits/locale_facets.h +1810 -0
  189. data/share/gccxml-0.9/GCC/3.2/bits/locale_facets.tcc +2397 -0
  190. data/share/gccxml-0.9/GCC/3.2/bits/messages_members.h +108 -0
  191. data/share/gccxml-0.9/GCC/3.2/bits/ostream.tcc +713 -0
  192. data/share/gccxml-0.9/GCC/3.2/bits/sstream.tcc +241 -0
  193. data/share/gccxml-0.9/GCC/3.2/bits/stl_deque.h +1682 -0
  194. data/share/gccxml-0.9/GCC/3.2/bits/stl_list.h +989 -0
  195. data/share/gccxml-0.9/GCC/3.2/bits/stl_tree.h +1462 -0
  196. data/share/gccxml-0.9/GCC/3.2/bits/stl_vector.h +1085 -0
  197. data/share/gccxml-0.9/GCC/3.2/bits/valarray_meta.h +1063 -0
  198. data/share/gccxml-0.9/GCC/3.2/fstream +579 -0
  199. data/share/gccxml-0.9/GCC/3.2/pthread.h +16 -0
  200. data/share/gccxml-0.9/GCC/3.2/sstream +384 -0
  201. data/share/gccxml-0.9/GCC/3.3/bits/fstream.tcc +530 -0
  202. data/share/gccxml-0.9/GCC/3.3/bits/list.tcc +378 -0
  203. data/share/gccxml-0.9/GCC/3.3/bits/locale_facets.h +2050 -0
  204. data/share/gccxml-0.9/GCC/3.3/bits/messages_members.h +108 -0
  205. data/share/gccxml-0.9/GCC/3.3/bits/sstream.tcc +243 -0
  206. data/share/gccxml-0.9/GCC/3.3/bits/stl_deque.h +1603 -0
  207. data/share/gccxml-0.9/GCC/3.3/bits/stl_list.h +1167 -0
  208. data/share/gccxml-0.9/GCC/3.3/bits/stl_tree.h +1462 -0
  209. data/share/gccxml-0.9/GCC/3.3/bits/stl_vector.h +992 -0
  210. data/share/gccxml-0.9/GCC/3.3/bits/valarray_meta.h +1135 -0
  211. data/share/gccxml-0.9/GCC/3.3/fstream +842 -0
  212. data/share/gccxml-0.9/GCC/3.3/gccxml_builtins.h +22 -0
  213. data/share/gccxml-0.9/GCC/3.3/sstream +638 -0
  214. data/share/gccxml-0.9/GCC/3.4/gccxml_builtins.h +91 -0
  215. data/share/gccxml-0.9/GCC/4.0/gccxml_builtins.h +128 -0
  216. data/share/gccxml-0.9/GCC/4.1/bits/gthr-default.h +618 -0
  217. data/share/gccxml-0.9/GCC/4.1/gccxml_builtins.h +131 -0
  218. data/share/gccxml-0.9/GCC/4.2/gccxml_builtins.h +131 -0
  219. data/share/gccxml-0.9/GCC/find_flags +105 -0
  220. data/share/gccxml-0.9/Intel/find_flags +56 -0
  221. data/share/gccxml-0.9/Intel/pthread.h +16 -0
  222. data/share/gccxml-0.9/MIPSpro/7.3/exception +9 -0
  223. data/share/gccxml-0.9/MIPSpro/7.3/gccxml_mpro_internals.h +21 -0
  224. data/share/gccxml-0.9/MIPSpro/7.3/iomanip +161 -0
  225. data/share/gccxml-0.9/MIPSpro/7.3/ostream +9 -0
  226. data/share/gccxml-0.9/MIPSpro/7.3/stddef.h +9 -0
  227. data/share/gccxml-0.9/MIPSpro/7.3/stl_config.h +9 -0
  228. data/share/gccxml-0.9/MIPSpro/7.3/stl_locale.h +17 -0
  229. data/share/gccxml-0.9/MIPSpro/7.3/stl_monetary.h +14 -0
  230. data/share/gccxml-0.9/MIPSpro/7.3/stl_numeric_facets.h +13 -0
  231. data/share/gccxml-0.9/MIPSpro/7.3/stl_threads.h +11 -0
  232. data/share/gccxml-0.9/MIPSpro/7.3/string +18 -0
  233. data/share/gccxml-0.9/MIPSpro/find_flags +137 -0
  234. data/share/gccxml-0.9/Sun/5.8/adaptation.patch +168 -0
  235. data/share/gccxml-0.9/Sun/README +8 -0
  236. data/share/gccxml-0.9/Sun/adapt_headers.sh +24 -0
  237. data/share/gccxml-0.9/Sun/find_flags +69 -0
  238. data/share/gccxml-0.9/gccxml_config +2 -0
  239. data/share/gccxml-0.9/gccxml_find_flags +93 -0
  240. data/share/man/man1/gccxml.1 +246 -0
  241. metadata +324 -0
@@ -0,0 +1,524 @@
1
+ // Member templates for the -*- C++ -*- string classes.
2
+ // Copyright (C) 1994, 1999 Free Software Foundation
3
+
4
+ // This file is part of the GNU ANSI C++ Library. This library is free
5
+ // software; you can redistribute it and/or modify it under the
6
+ // terms of the GNU General Public License as published by the
7
+ // Free Software Foundation; either version 2, or (at your option)
8
+ // any later version.
9
+
10
+ // This library is distributed in the hope that it will be useful,
11
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ // GNU General Public License for more details.
14
+
15
+ // You should have received a copy of the GNU General Public License
16
+ // along with this library; see the file COPYING. If not, write to the Free
17
+ // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
+
19
+ // As a special exception, if you link this library with files
20
+ // compiled with a GNU compiler to produce an executable, this does not cause
21
+ // the resulting executable to be covered by the GNU General Public License.
22
+ // This exception does not however invalidate any other reasons why
23
+ // the executable file might be covered by the GNU General Public License.
24
+
25
+ // Written by Jason Merrill based upon the specification by Takanori Adachi
26
+ // in ANSI X3J16/94-0013R2.
27
+
28
+ extern "C++" {
29
+ template <class charT, class traits, class Allocator>
30
+ inline void * basic_string <charT, traits, Allocator>::Rep::
31
+ operator new (size_t s, size_t extra)
32
+ {
33
+ return Allocator::allocate(s + extra * sizeof (charT));
34
+ }
35
+
36
+ template <class charT, class traits, class Allocator>
37
+ inline void basic_string <charT, traits, Allocator>::Rep::
38
+ operator delete (void * ptr)
39
+ {
40
+ Allocator::deallocate(ptr, sizeof(Rep) +
41
+ reinterpret_cast<Rep *>(ptr)->res *
42
+ sizeof (charT));
43
+ }
44
+
45
+ template <class charT, class traits, class Allocator>
46
+ inline size_t basic_string <charT, traits, Allocator>::Rep::
47
+ frob_size (size_t s)
48
+ {
49
+ size_t i = 16;
50
+ while (i < s) i *= 2;
51
+ return i;
52
+ }
53
+
54
+ template <class charT, class traits, class Allocator>
55
+ inline typename basic_string <charT, traits, Allocator>::Rep *
56
+ basic_string <charT, traits, Allocator>::Rep::
57
+ create (size_t extra)
58
+ {
59
+ extra = frob_size (extra + 1);
60
+ Rep *p = new (extra) Rep;
61
+ p->res = extra;
62
+ p->ref = 1;
63
+ p->selfish = false;
64
+ return p;
65
+ }
66
+
67
+ template <class charT, class traits, class Allocator>
68
+ charT * basic_string <charT, traits, Allocator>::Rep::
69
+ clone ()
70
+ {
71
+ Rep *p = Rep::create (len);
72
+ p->copy (0, data (), len);
73
+ p->len = len;
74
+ return p->data ();
75
+ }
76
+
77
+ template <class charT, class traits, class Allocator>
78
+ inline bool basic_string <charT, traits, Allocator>::Rep::
79
+ excess_slop (size_t s, size_t r)
80
+ {
81
+ return 2 * (s <= 16 ? 16 : s) < r;
82
+ }
83
+
84
+ template <class charT, class traits, class Allocator>
85
+ inline bool basic_string <charT, traits, Allocator>::
86
+ check_realloc (basic_string::size_type s) const
87
+ {
88
+ s += sizeof (charT);
89
+ rep ()->selfish = false;
90
+ return (rep ()->ref > 1
91
+ || s > capacity ()
92
+ || Rep::excess_slop (s, capacity ()));
93
+ }
94
+
95
+ template <class charT, class traits, class Allocator>
96
+ void basic_string <charT, traits, Allocator>::
97
+ alloc (basic_string::size_type __size, bool __save)
98
+ {
99
+ if (! check_realloc (__size))
100
+ return;
101
+
102
+ Rep *p = Rep::create (__size);
103
+
104
+ if (__save)
105
+ {
106
+ p->copy (0, data (), length ());
107
+ p->len = length ();
108
+ }
109
+ else
110
+ p->len = 0;
111
+
112
+ repup (p);
113
+ }
114
+
115
+ template <class charT, class traits, class Allocator>
116
+ basic_string <charT, traits, Allocator>&
117
+ basic_string <charT, traits, Allocator>::
118
+ replace (size_type pos1, size_type n1,
119
+ const basic_string& _str, size_type pos2, size_type n2)
120
+ {
121
+ const size_t len2 = _str.length ();
122
+
123
+ if (pos1 == 0 && n1 >= length () && pos2 == 0 && n2 >= len2)
124
+ return operator= (_str);
125
+
126
+ OUTOFRANGE (pos2 > len2);
127
+
128
+ if (n2 > len2 - pos2)
129
+ n2 = len2 - pos2;
130
+
131
+ return replace (pos1, n1, _str.data () + pos2, n2);
132
+ }
133
+
134
+ template <class charT, class traits, class Allocator>
135
+ inline void basic_string <charT, traits, Allocator>::Rep::
136
+ copy (size_t pos, const charT *s, size_t n)
137
+ {
138
+ if (n)
139
+ traits::copy (data () + pos, s, n);
140
+ }
141
+
142
+ template <class charT, class traits, class Allocator>
143
+ inline void basic_string <charT, traits, Allocator>::Rep::
144
+ move (size_t pos, const charT *s, size_t n)
145
+ {
146
+ if (n)
147
+ traits::move (data () + pos, s, n);
148
+ }
149
+
150
+ template <class charT, class traits, class Allocator>
151
+ basic_string <charT, traits, Allocator>&
152
+ basic_string <charT, traits, Allocator>::
153
+ replace (size_type pos, size_type n1, const charT* s, size_type n2)
154
+ {
155
+ const size_type len = length ();
156
+ OUTOFRANGE (pos > len);
157
+ if (n1 > len - pos)
158
+ n1 = len - pos;
159
+ LENGTHERROR (len - n1 > max_size () - n2);
160
+ size_t newlen = len - n1 + n2;
161
+
162
+ if (check_realloc (newlen))
163
+ {
164
+ Rep *p = Rep::create (newlen);
165
+ p->copy (0, data (), pos);
166
+ p->copy (pos + n2, data () + pos + n1, len - (pos + n1));
167
+ p->copy (pos, s, n2);
168
+ repup (p);
169
+ }
170
+ else
171
+ {
172
+ rep ()->move (pos + n2, data () + pos + n1, len - (pos + n1));
173
+ rep ()->copy (pos, s, n2);
174
+ }
175
+ rep ()->len = newlen;
176
+
177
+ return *this;
178
+ }
179
+
180
+ template <class charT, class traits, class Allocator>
181
+ inline void basic_string <charT, traits, Allocator>::Rep::
182
+ set (size_t pos, const charT c, size_t n)
183
+ {
184
+ traits::set (data () + pos, c, n);
185
+ }
186
+
187
+ template <class charT, class traits, class Allocator>
188
+ basic_string <charT, traits, Allocator>& basic_string <charT, traits, Allocator>::
189
+ replace (size_type pos, size_type n1, size_type n2, charT c)
190
+ {
191
+ const size_t len = length ();
192
+ OUTOFRANGE (pos > len);
193
+ if (n1 > len - pos)
194
+ n1 = len - pos;
195
+ LENGTHERROR (len - n1 > max_size () - n2);
196
+ size_t newlen = len - n1 + n2;
197
+
198
+ if (check_realloc (newlen))
199
+ {
200
+ Rep *p = Rep::create (newlen);
201
+ p->copy (0, data (), pos);
202
+ p->copy (pos + n2, data () + pos + n1, len - (pos + n1));
203
+ p->set (pos, c, n2);
204
+ repup (p);
205
+ }
206
+ else
207
+ {
208
+ rep ()->move (pos + n2, data () + pos + n1, len - (pos + n1));
209
+ rep ()->set (pos, c, n2);
210
+ }
211
+ rep ()->len = newlen;
212
+
213
+ return *this;
214
+ }
215
+
216
+ template <class charT, class traits, class Allocator>
217
+ void basic_string <charT, traits, Allocator>::
218
+ resize (size_type n, charT c)
219
+ {
220
+ LENGTHERROR (n > max_size ());
221
+
222
+ if (n > length ())
223
+ append (n - length (), c);
224
+ else
225
+ erase (n);
226
+ }
227
+
228
+ template <class charT, class traits, class Allocator>
229
+ typename basic_string <charT, traits, Allocator>::size_type
230
+ basic_string <charT, traits, Allocator>::
231
+ copy (charT* s, size_type n, size_type pos) const
232
+ {
233
+ OUTOFRANGE (pos > length ());
234
+
235
+ if (n > length () - pos)
236
+ n = length () - pos;
237
+
238
+ traits::copy (s, data () + pos, n);
239
+ return n;
240
+ }
241
+
242
+ template <class charT, class traits, class Allocator>
243
+ typename basic_string <charT, traits, Allocator>::size_type
244
+ basic_string <charT, traits, Allocator>::
245
+ find (const charT* s, size_type pos, size_type n) const
246
+ {
247
+ size_t xpos = pos;
248
+ for (; xpos + n <= length (); ++xpos)
249
+ if (traits::eq (data () [xpos], *s)
250
+ && traits::compare (data () + xpos, s, n) == 0)
251
+ return xpos;
252
+ return npos;
253
+ }
254
+
255
+ template <class charT, class traits, class Allocator>
256
+ inline typename basic_string <charT, traits, Allocator>::size_type
257
+ basic_string <charT, traits, Allocator>::
258
+ _find (const charT* ptr, charT c, size_type xpos, size_type len)
259
+ {
260
+ for (; xpos < len; ++xpos)
261
+ if (traits::eq (ptr [xpos], c))
262
+ return xpos;
263
+ return npos;
264
+ }
265
+
266
+ template <class charT, class traits, class Allocator>
267
+ typename basic_string <charT, traits, Allocator>::size_type
268
+ basic_string <charT, traits, Allocator>::
269
+ find (charT c, size_type pos) const
270
+ {
271
+ return _find (data (), c, pos, length ());
272
+ }
273
+
274
+ template <class charT, class traits, class Allocator>
275
+ typename basic_string <charT, traits, Allocator>::size_type
276
+ basic_string <charT, traits, Allocator>::
277
+ rfind (const charT* s, size_type pos, size_type n) const
278
+ {
279
+ if (n > length ())
280
+ return npos;
281
+
282
+ size_t xpos = length () - n;
283
+ if (xpos > pos)
284
+ xpos = pos;
285
+
286
+ for (++xpos; xpos-- > 0; )
287
+ if (traits::eq (data () [xpos], *s)
288
+ && traits::compare (data () + xpos, s, n) == 0)
289
+ return xpos;
290
+ return npos;
291
+ }
292
+
293
+ template <class charT, class traits, class Allocator>
294
+ typename basic_string <charT, traits, Allocator>::size_type
295
+ basic_string <charT, traits, Allocator>::
296
+ rfind (charT c, size_type pos) const
297
+ {
298
+ if (1 > length ())
299
+ return npos;
300
+
301
+ size_t xpos = length () - 1;
302
+ if (xpos > pos)
303
+ xpos = pos;
304
+
305
+ for (++xpos; xpos-- > 0; )
306
+ if (traits::eq (data () [xpos], c))
307
+ return xpos;
308
+ return npos;
309
+ }
310
+
311
+ template <class charT, class traits, class Allocator>
312
+ typename basic_string <charT, traits, Allocator>::size_type
313
+ basic_string <charT, traits, Allocator>::
314
+ find_first_of (const charT* s, size_type pos, size_type n) const
315
+ {
316
+ size_t xpos = pos;
317
+ for (; xpos < length (); ++xpos)
318
+ if (_find (s, data () [xpos], 0, n) != npos)
319
+ return xpos;
320
+ return npos;
321
+ }
322
+
323
+ template <class charT, class traits, class Allocator>
324
+ typename basic_string <charT, traits, Allocator>::size_type
325
+ basic_string <charT, traits, Allocator>::
326
+ find_last_of (const charT* s, size_type pos, size_type n) const
327
+ {
328
+ if (length() == 0)
329
+ return npos;
330
+ size_t xpos = length () - 1;
331
+ if (xpos > pos)
332
+ xpos = pos;
333
+ for (++xpos; xpos-- > 0;)
334
+ if (_find (s, data () [xpos], 0, n) != npos)
335
+ return xpos;
336
+ return npos;
337
+ }
338
+
339
+ template <class charT, class traits, class Allocator>
340
+ typename basic_string <charT, traits, Allocator>::size_type
341
+ basic_string <charT, traits, Allocator>::
342
+ find_first_not_of (const charT* s, size_type pos, size_type n) const
343
+ {
344
+ size_t xpos = pos;
345
+ for (; xpos < length (); ++xpos)
346
+ if (_find (s, data () [xpos], 0, n) == npos)
347
+ return xpos;
348
+ return npos;
349
+ }
350
+
351
+ template <class charT, class traits, class Allocator>
352
+ typename basic_string <charT, traits, Allocator>::size_type
353
+ basic_string <charT, traits, Allocator>::
354
+ find_first_not_of (charT c, size_type pos) const
355
+ {
356
+ size_t xpos = pos;
357
+ for (; xpos < length (); ++xpos)
358
+ if (traits::ne (data () [xpos], c))
359
+ return xpos;
360
+ return npos;
361
+ }
362
+
363
+ template <class charT, class traits, class Allocator>
364
+ typename basic_string <charT, traits, Allocator>::size_type
365
+ basic_string <charT, traits, Allocator>::
366
+ find_last_not_of (const charT* s, size_type pos, size_type n) const
367
+ {
368
+ if (length() == 0)
369
+ return npos;
370
+ size_t xpos = length () - 1;
371
+ if (xpos > pos)
372
+ xpos = pos;
373
+ for (++xpos; xpos-- > 0;)
374
+ if (_find (s, data () [xpos], 0, n) == npos)
375
+ return xpos;
376
+ return npos;
377
+ }
378
+
379
+ template <class charT, class traits, class Allocator>
380
+ typename basic_string <charT, traits, Allocator>::size_type
381
+ basic_string <charT, traits, Allocator>::
382
+ find_last_not_of (charT c, size_type pos) const
383
+ {
384
+ if (length() == 0)
385
+ return npos;
386
+ size_t xpos = length () - 1;
387
+ if (xpos > pos)
388
+ xpos = pos;
389
+ for (++xpos; xpos-- > 0;)
390
+ if (traits::ne (data () [xpos], c))
391
+ return xpos;
392
+ return npos;
393
+ }
394
+
395
+ template <class charT, class traits, class Allocator>
396
+ int basic_string <charT, traits, Allocator>::
397
+ compare (const basic_string& _str, size_type pos, size_type n) const
398
+ {
399
+ OUTOFRANGE (pos > length ());
400
+
401
+ size_t rlen = length () - pos;
402
+ if (rlen > n)
403
+ rlen = n;
404
+ if (rlen > _str.length ())
405
+ rlen = _str.length ();
406
+ int r = traits::compare (data () + pos, _str.data (), rlen);
407
+ if (r != 0)
408
+ return r;
409
+ if (rlen == n)
410
+ return 0;
411
+ return (length () - pos) - _str.length ();
412
+ }
413
+
414
+ template <class charT, class traits, class Allocator>
415
+ int basic_string <charT, traits, Allocator>::
416
+ compare (const charT* s, size_type pos, size_type n) const
417
+ {
418
+ OUTOFRANGE (pos > length ());
419
+
420
+ size_t rlen = length () - pos;
421
+ if (rlen > n)
422
+ rlen = n;
423
+ int r = traits::compare (data () + pos, s, rlen);
424
+ if (r != 0)
425
+ return r;
426
+ return (length () - pos) - n;
427
+ }
428
+
429
+ #include <iostream.h>
430
+
431
+ template <class charT, class traits, class Allocator>
432
+ istream &
433
+ operator>> (istream &is, basic_string <charT, traits, Allocator> &s)
434
+ {
435
+ int w = is.width (0);
436
+ if (is.ipfx0 ())
437
+ {
438
+ register streambuf *sb = is.rdbuf ();
439
+ s.resize (0);
440
+ while (1)
441
+ {
442
+ int ch = sb->sbumpc ();
443
+ if (ch == EOF)
444
+ {
445
+ is.setstate (ios::eofbit);
446
+ break;
447
+ }
448
+ else if (traits::is_del (ch))
449
+ {
450
+ sb->sungetc ();
451
+ break;
452
+ }
453
+ s += static_cast<charT> (ch);
454
+ if (--w == 1)
455
+ break;
456
+ }
457
+ }
458
+
459
+ is.isfx ();
460
+ if (s.length () == 0)
461
+ is.setstate (ios::failbit);
462
+
463
+ return is;
464
+ }
465
+
466
+ template <class charT, class traits, class Allocator>
467
+ ostream &
468
+ operator<< (ostream &o, const basic_string <charT, traits, Allocator>& s)
469
+ {
470
+ return o.write (s.data (), s.length ());
471
+ }
472
+
473
+ template <class charT, class traits, class Allocator>
474
+ istream&
475
+ getline (istream &is, basic_string <charT, traits, Allocator>& s, charT delim)
476
+ {
477
+ if (is.ipfx1 ())
478
+ {
479
+ _IO_size_t _count = 0;
480
+ streambuf *sb = is.rdbuf ();
481
+ s.resize (0);
482
+
483
+ while (1)
484
+ {
485
+ int ch = sb->sbumpc ();
486
+ if (ch == EOF)
487
+ {
488
+ is.setstate (_count == 0
489
+ ? (ios::failbit|ios::eofbit)
490
+ : ios::eofbit);
491
+ break;
492
+ }
493
+
494
+ ++_count;
495
+
496
+ if (ch == delim)
497
+ break;
498
+
499
+ s += static_cast<charT> (ch);
500
+
501
+ if (s.length () == s.npos - 1)
502
+ {
503
+ is.setstate (ios::failbit);
504
+ break;
505
+ }
506
+ }
507
+ }
508
+
509
+ // We need to be friends with istream to do this.
510
+ // is._gcount = _count;
511
+ is.isfx ();
512
+
513
+ return is;
514
+ }
515
+
516
+ template <class charT, class traits, class Allocator>
517
+ typename basic_string <charT, traits, Allocator>::Rep
518
+ basic_string<charT, traits, Allocator>::nilRep = { 0, 0, 1, false };
519
+
520
+ template <class charT, class traits, class Allocator>
521
+ const typename basic_string <charT, traits, Allocator>::size_type
522
+ basic_string <charT, traits, Allocator>::npos;
523
+
524
+ } // extern "C++"