21 #include "mongo/base/data_view.h"
22 #include "mongo/platform/endian.h"
72 *
this = view() +
sizeof(T);
84 T readNativeAndAdvance() {
86 readNativeAndAdvance(&out);
91 T readLEAndAdvance() {
92 return endian::littleToNative(readNativeAndAdvance<T>());
96 T readBEAndAdvance() {
97 return endian::bigToNative(readNativeAndAdvance<T>());
130 return operator+=(1);
140 return operator-=(1);
149 template <
typename T>
151 *
this = view() +
sizeof(T);
155 template <
typename T>
162 template <
typename T>
163 T readNativeAndAdvance() {
165 readNativeAndAdvance(&out);
169 template <
typename T>
170 T readLEAndAdvance() {
171 return endian::littleToNative(readNativeAndAdvance<T>());
174 template <
typename T>
175 T readBEAndAdvance() {
176 return endian::bigToNative(readNativeAndAdvance<T>());
179 template <
typename T>
180 DataCursor& writeNativeAndAdvance(
const T& value) {
186 template <
typename T>
187 DataCursor& writeLEAndAdvance(
const T& value) {
188 return writeNativeAndAdvance(endian::nativeToLittle(value));
191 template <
typename T>
192 DataCursor& writeBEAndAdvance(
const T& value) {
193 return writeNativeAndAdvance(endian::nativeToBig(value));
Utility functions for parsing numbers from strings.
Definition: compare_numbers.h:20
Definition: data_view.h:30
Definition: data_cursor.h:26
Definition: data_cursor.h:101
Definition: data_view.h:71