DynamicBuffer_v2.qbk 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. [/
  2. / Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
  3. /
  4. / Distributed under the Boost Software License, Version 1.0. (See accompanying
  5. / file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. /]
  7. [section:DynamicBuffer_v2 Dynamic buffer requirements (version 2)]
  8. A dynamic buffer encapsulates memory storage that may be automatically resized
  9. as required.
  10. A dynamic buffer type `X` shall satisfy the requirements of `CopyConstructible`
  11. (C++ Std, [copyconstructible]) types in addition to those listed below.
  12. In the table below, `X` denotes a dynamic buffer class, `x` denotes a value of
  13. type `X&`, `x1` denotes values of type `const X&`, `pos` and `n` denote values
  14. of type `size_t`, and `u` denotes an identifier.
  15. [table DynamicBuffer_v2 requirements
  16. [[expression] [type] [assertion/note\npre/post-conditions]]
  17. [
  18. [`X::const_buffers_type`]
  19. [type meeting [link boost_asio.reference.ConstBufferSequence ConstBufferSequence]
  20. requirements.]
  21. [This type represents the underlying memory as a sequence of @c const_buffer
  22. objects.]
  23. ]
  24. [
  25. [`X::mutable_buffers_type`]
  26. [type meeting [link boost_asio.reference.MutableBufferSequence MutableBufferSequence]
  27. requirements.]
  28. [This type represents the underlying memory as a sequence of @c
  29. mutable_buffer objects.]
  30. ]
  31. [
  32. [`x1.size()`]
  33. [`size_t`]
  34. [Returns the size, in bytes, of the underlying memory.]
  35. ]
  36. [
  37. [`x1.max_size()`]
  38. [`size_t`]
  39. [Returns the permitted maximum size of the underlying memory.]
  40. ]
  41. [
  42. [`x1.capacity()`]
  43. [`size_t`]
  44. [Returns the maximum size to which the underlying memory can grow without
  45. requiring reallocation.]
  46. ]
  47. [
  48. [`x1.data(pos, n)`]
  49. [`X::const_buffers_type`]
  50. [Returns a constant buffer sequence `u` that represents the underlying
  51. memory beginning at offset `pos`, and where `buffer_size(u) <= n`.]
  52. ]
  53. [
  54. [`x.data(pos, n)`]
  55. [`X::mutable_buffers_type`]
  56. [Returns a mutable buffer sequence `u` that represents the underlying
  57. memory beginning at offset `pos`, and where `buffer_size(u) <= n`.]
  58. ]
  59. [
  60. [`x.grow(n)`]
  61. []
  62. [Requires: `size() + n <= max_size()`.\n
  63. \n
  64. Extends the underlying memory to accommodate `n` additional bytes at the
  65. end. The dynamic buffer reallocates memory as required. All constant or
  66. mutable buffer sequences previously obtained using `data()` are
  67. invalidated.\n
  68. \n
  69. Throws: `length_error` if `size() + n > max_size()`.]
  70. ]
  71. [
  72. [`x.shrink(n)`]
  73. []
  74. [Removes `n` bytes from the end of the underlying memory. If `n` is greater
  75. than the size of the underlying memory, the entire underlying memory is
  76. emptied. All constant or mutable buffer sequences previously obtained
  77. using `data()` are invalidated.]
  78. ]
  79. [
  80. [`x.consume(n)`]
  81. []
  82. [Removes `n` bytes from the beginning of the underlying memory. If `n` is
  83. greater than the size of the underlying memory, the entire underlying memory
  84. is emptied. All constant or mutable buffer sequences previously obtained
  85. using `data()` are invalidated.]
  86. ]
  87. ]
  88. [endsect]