From fbb20a204206e644140a653d518c3257bc872c47 Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Tue, 1 Mar 2016 15:22:17 +0100 Subject: [PATCH] _In_/_Out_ parameter declaration added --- include/stdex/idrec.h | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/include/stdex/idrec.h b/include/stdex/idrec.h index 04fdeea8c..4ab1db21e 100644 --- a/include/stdex/idrec.h +++ b/include/stdex/idrec.h @@ -38,7 +38,7 @@ namespace stdex { /// - false otherwise /// template - inline bool ignore(std::istream& stream) + inline bool ignore(_In_ std::istream& stream) { // Read record size. T_SIZE size; @@ -66,7 +66,7 @@ namespace stdex { /// - false otherwise /// template - inline bool find(std::istream& stream, T_ID id, std::streamoff end = (std::streamoff)-1) + inline bool find(_In_ std::istream& stream, _In_ T_ID id, _In_opt_ std::streamoff end = (std::streamoff)-1) { T_ID _id; @@ -94,7 +94,7 @@ namespace stdex { /// \returns Position of the record header start in \p stream. Save for later \c close call. /// template - inline std::streamoff open(std::ostream& stream, T_ID id) + inline std::streamoff open(_In_ std::ostream& stream, _In_ T_ID id) { std::streamoff start = stream.tellp(); @@ -120,7 +120,7 @@ namespace stdex { /// \returns Position of the record end in \p stream /// template - inline std::streamoff close(std::ostream& stream, std::streamoff start) + inline std::streamoff close(_In_ std::ostream& stream, _In_ std::streamoff start) { std::streamoff end = stream.tellp(); T_SIZE @@ -156,8 +156,8 @@ namespace stdex { /// /// \param[in] d Reference to record data /// - inline record( T &d) : data( d) {} - inline record(const T &d) : data((T&)d) {} + inline record(_In_ T &d) : data( d) {} + inline record(_In_ const T &d) : data((T&)d) {} /// @@ -167,7 +167,7 @@ namespace stdex { /// /// \returns A const reference to this struct /// - inline const record& operator =(const record &r) + inline const record& operator =(_In_ const record &r) { data = r.data; return *this; @@ -181,7 +181,7 @@ namespace stdex { /// /// \returns Position of the record header start in \p stream. Save for later \c close call. /// - static inline std::streamoff open(std::ostream& stream) + static inline std::streamoff open(_In_ std::ostream& stream) { return stdex::idrec::open(stream, id); } @@ -195,7 +195,7 @@ namespace stdex { /// /// \returns Position of the record end in \p stream /// - static inline std::streamoff close(std::ostream& stream, std::streamoff start) + static inline std::streamoff close(_In_ std::ostream& stream, _In_ std::streamoff start) { return stdex::idrec::close(stream, start); } @@ -211,11 +211,12 @@ namespace stdex { /// - true when found /// - false otherwise /// - static inline bool find(std::istream& stream, std::streamoff end = (std::streamoff)-1) + static inline bool find(_In_ std::istream& stream, _In_opt_ std::streamoff end = (std::streamoff)-1) { return stdex::idrec::find(stream, id, end); } + static const T_ID id; ///< Record id T &data; ///< Record data reference }; @@ -232,7 +233,7 @@ namespace stdex { /// \returns The stream \p stream /// template -inline std::ostream& operator <<(std::ostream& stream, const stdex::idrec::record r) +inline std::ostream& operator <<(_In_ std::ostream& stream, _In_ const stdex::idrec::record r) { // Parameter r does not need to be passed by reference. It has only one field (data), which is a reference itself already. The id field is static anyway. @@ -254,7 +255,7 @@ inline std::ostream& operator <<(std::ostream& stream, const stdex::idrec::recor /// \returns The stream \p stream /// template -inline std::istream& operator >>(std::istream& stream, stdex::idrec::record r) +inline std::istream& operator >>(_In_ std::istream& stream, _Out_ stdex::idrec::record r) { // Parameter r does not need to be passed by reference. It has only one field (data), which is a reference itself already. The id field is static anyway.