Skip to content

Commit ee61fe4

Browse files
committed
Remove duplicate variable declaration
Filled in more documentation
1 parent 3e5fd55 commit ee61fe4

File tree

2 files changed

+58
-2
lines changed

2 files changed

+58
-2
lines changed

include/rapidjson/document.h

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1972,27 +1972,84 @@ class GenericValue {
19721972
GenericValue v(value, shape, ndim, allocator);
19731973
return AddMember(name, v, allocator);
19741974
}
1975-
1975+
1976+
/*!
1977+
\brief Add a scalar with units as member (name-value pair) to the object.
1978+
\tparam T Type of the scalar value.
1979+
\param name A string value as name of member.
1980+
\param value Scalar value for member.
1981+
\param units_str Units for member.
1982+
\param units_len Length of \c units_str.
1983+
\param allocator Allocator for reallocating memory. Commonly use GenericDocument::GetAllocator().
1984+
\return The value itself for fluent API.
1985+
\pre IsObject()
1986+
*/
19761987
template <typename T>
19771988
GenericValue& AddMember(GenericValue& name, T value, const Ch* units_str, SizeType units_len, Allocator& allocator) {
19781989
GenericValue v(value, units_str, units_len, allocator);
19791990
return AddMember(name, v, allocator);
19801991
}
1992+
/*!
1993+
\brief Add a 1D array with units as member (name-value pair) to the object.
1994+
\tparam T Type of the scalar value.
1995+
\param name A string value as name of member.
1996+
\param value Pointer to 1D array for member.
1997+
\param nelements Number of elements in \c value.
1998+
\param units_str Units for member.
1999+
\param units_len Length of \c units_str.
2000+
\param allocator Allocator for reallocating memory. Commonly use GenericDocument::GetAllocator().
2001+
\return The value itself for fluent API.
2002+
\pre IsObject()
2003+
*/
19812004
template <typename T>
19822005
GenericValue& AddMember(GenericValue& name, T* value, SizeType nelements, const Ch* units_str, SizeType units_len, Allocator& allocator) {
19832006
GenericValue v(value, nelements, units_str, units_len, allocator);
19842007
return AddMember(name, v, allocator);
19852008
}
2009+
/*!
2010+
\brief Add a 1D array as member (name-value pair) to the object.
2011+
\tparam T Type of the scalar value.
2012+
\param name A string value as name of member.
2013+
\param value Pointer to 1D array for member.
2014+
\param nelements Number of elements in \c value.
2015+
\param allocator Allocator for reallocating memory. Commonly use GenericDocument::GetAllocator().
2016+
\return The value itself for fluent API.
2017+
\pre IsObject()
2018+
*/
19862019
template <typename T>
19872020
GenericValue& AddMember(GenericValue& name, T* value, SizeType nelements, Allocator& allocator) {
19882021
GenericValue v(value, nelements, allocator);
19892022
return AddMember(name, v, allocator);
19902023
}
2024+
/*!
2025+
\brief Add a ND array with units as member (name-value pair) to the object.
2026+
\tparam T Type of the scalar value.
2027+
\param name A string value as name of member.
2028+
\param value Pointer to ND array for member.
2029+
\param shape Array of length \c ndim containing the size of the array in each dimension.
2030+
\param ndim Number of dimensions in \c value.
2031+
\param units_str Units for member.
2032+
\param units_len Length of \c units_str.
2033+
\param allocator Allocator for reallocating memory. Commonly use GenericDocument::GetAllocator().
2034+
\return The value itself for fluent API.
2035+
\pre IsObject()
2036+
*/
19912037
template <typename T>
19922038
GenericValue& AddMember(GenericValue& name, T* value, SizeType shape[], SizeType ndim, const Ch* units_str, SizeType units_len, Allocator& allocator) {
19932039
GenericValue v(value, shape, ndim, units_str, units_len, allocator);
19942040
return AddMember(name, v, allocator);
19952041
}
2042+
/*!
2043+
\brief Add a ND array as member (name-value pair) to the object.
2044+
\tparam T Type of the scalar value.
2045+
\param name A string value as name of member.
2046+
\param value Pointer to ND array for member.
2047+
\param shape Array of length \c ndim containing the size of the array in each dimension.
2048+
\param ndim Number of dimensions in \c value.
2049+
\param allocator Allocator for reallocating memory. Commonly use GenericDocument::GetAllocator().
2050+
\return The value itself for fluent API.
2051+
\pre IsObject()
2052+
*/
19962053
template <typename T>
19972054
GenericValue& AddMember(GenericValue& name, T* value, SizeType shape[], SizeType ndim, Allocator& allocator) {
19982055
GenericValue v(value, shape, ndim, allocator);

include/rapidjson/units.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3695,7 +3695,6 @@ class GenericQuantityArray {
36953695
template<typename Tout, typename T2, typename Encoding2>
36963696
GenericQuantityArray<Tout, Encoding>
36973697
_copy_for_op(const GenericQuantityArray<T2, Encoding2>& rhs) const {
3698-
GenericQuantityArray<Tout, Encoding> out;
36993698
if (this->nelements() == 1) {
37003699
GenericQuantityArray<Tout, Encoding> out(
37013700
value_[0], rhs.ndim(), rhs.shape(), units_);

0 commit comments

Comments
 (0)