diff options
author | Willem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl> | 2017-08-31 16:47:29 +0200 |
---|---|---|
committer | Willem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl> | 2017-10-17 20:35:30 +0200 |
commit | 8d8a3d26372d9c0a784e181121fc2b360f6fee51 (patch) | |
tree | b04d799efded02263306f3f41974ed4491b0d571 /src/XMLNode.cpp | |
parent | 7b25c857ded357c0cb0b481dac6404c27ed0293d (diff) | |
download | astra-8d8a3d26372d9c0a784e181121fc2b360f6fee51.tar.gz astra-8d8a3d26372d9c0a784e181121fc2b360f6fee51.tar.bz2 astra-8d8a3d26372d9c0a784e181121fc2b360f6fee51.tar.xz astra-8d8a3d26372d9c0a784e181121fc2b360f6fee51.zip |
Add trailing ,/; to string repr of float vector/matrix
This makes it possible to differentiate between a scalar and a one-element
vector, and fixes #111.
Diffstat (limited to 'src/XMLNode.cpp')
-rw-r--r-- | src/XMLNode.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/XMLNode.cpp b/src/XMLNode.cpp index 0ddc511..2bf1330 100644 --- a/src/XMLNode.cpp +++ b/src/XMLNode.cpp @@ -379,9 +379,9 @@ void XMLNode::setContent(float32 _fValue) template<typename T> static std::string setContentList_internal(T* pfList, int _iSize) { - std::string str = (_iSize > 0) ? StringUtil::toString(pfList[0]) : ""; - for (int i = 1; i < _iSize; i++) { - str += "," + StringUtil::toString(pfList[i]); + std::string str; + for (int i = 0; i < _iSize; i++) { + str += StringUtil::toString(pfList[i]) + ","; } return str; } @@ -422,8 +422,7 @@ static std::string setContentMatrix_internal(T* _pfMatrix, int _iWidth, int _iHe for (int x = 1; x < _iWidth; x++) s << "," << _pfMatrix[x*s1 + y*s2]; - if (y != _iHeight-1) - s << ";"; + s << ";"; } return s.str(); |