[DEV] add float in file output

This commit is contained in:
Edouard DUPIN 2015-03-05 21:17:37 +01:00
parent d570c54136
commit 9ccf8eea83
3 changed files with 19 additions and 0 deletions

View File

@ -1776,6 +1776,13 @@ etk::FSNode& etk::FSNode::operator<< (const uint32_t _data) {
fileWrite(sss.c_str(), 1, sss.size());
return *this;
}
etk::FSNode& etk::FSNode::operator<< (const float _data) {
std::stringstream tmp;
tmp << _data;
std::string sss = tmp.str();
fileWrite(sss.c_str(), 1, sss.size());
return *this;
}
bool etk::FSNode::fileSeek(long int _offset, enum etk::seekNode _origin)
{

View File

@ -491,6 +491,7 @@ namespace etk {
etk::FSNode& operator<< (const char* _data);
etk::FSNode& operator<< (const int32_t _data);
etk::FSNode& operator<< (const uint32_t _data);
etk::FSNode& operator<< (const float _data);
/**
* @brief Get the position in the file.
* @return the requested position.

View File

@ -388,6 +388,17 @@ namespace std {
namespace etk {
// these declaration is to prevent some under template declaration of unknown type
template <class TYPE> std::string to_string(const TYPE& _variable);
template <class TYPE> std::string to_string(const std::vector<TYPE>& _list) {
std::string out = "{";
for (size_t iii=0; iii<_list.size(); ++iii) {
if (iii!=0) {
out += ";";
}
out+= etk::to_string(_list[iii]);
}
out += "}";
return out;
}
#if __CPP_VERSION__ >= 2011
template <class TYPE> std::u32string to_u32string(const TYPE& _variable);
#endif