[DEV] add stream operator in io interface
This commit is contained in:
parent
088e9b1a2d
commit
c866bfe734
@ -43,3 +43,31 @@ bool etk::io::Interface::puts(const etk::String& _input) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
etk::io::Interface& etk::io::Interface::operator<< (const etk::Stream& _data) {
|
||||
write(_data.c_str(), 1, _data.size());
|
||||
return *this;
|
||||
}
|
||||
etk::io::Interface& etk::io::Interface::operator<< (const etk::String& _data) {
|
||||
write(_data.c_str(), 1, _data.size());
|
||||
return *this;
|
||||
}
|
||||
etk::io::Interface& etk::io::Interface::operator<< (const char* _data) {
|
||||
write(_data, 1, strlen(_data));
|
||||
return *this;
|
||||
}
|
||||
etk::io::Interface& etk::io::Interface::operator<< (const int32_t _data) {
|
||||
etk::String sss = etk::toString(_data);
|
||||
write(sss.c_str(), 1, sss.size());
|
||||
return *this;
|
||||
}
|
||||
etk::io::Interface& etk::io::Interface::operator<< (const uint32_t _data) {
|
||||
etk::String sss = etk::toString(_data);
|
||||
write(sss.c_str(), 1, sss.size());
|
||||
return *this;
|
||||
}
|
||||
etk::io::Interface& etk::io::Interface::operator<< (const float _data) {
|
||||
etk::String sss = etk::toString(_data);
|
||||
write(sss.c_str(), 1, sss.size());
|
||||
return *this;
|
||||
}
|
@ -141,6 +141,23 @@ namespace etk {
|
||||
bool writeAll(const etk::String& _value) {
|
||||
return int64_t(_value.size()) == write(static_cast<const void*>(&(_value[0])), sizeof(char), _value.size()/sizeof(char));
|
||||
}
|
||||
/**
|
||||
* @brief Stream write mode
|
||||
* @param[in] _data Stream to write
|
||||
* @return The current FSNode reference to add other stream.
|
||||
* @note not stable API ...
|
||||
*/
|
||||
etk::io::Interface& operator<< (const etk::Stream& _data);
|
||||
//! @copydoc etk::io::Interface::operator<<(const etk::Stringstream&)
|
||||
etk::io::Interface& operator<< (const etk::String& _data);
|
||||
//! @copydoc etk::io::Interface::operator<<(const etk::Stringstream&)
|
||||
etk::io::Interface& operator<< (const char* _data);
|
||||
//! @copydoc etk::io::Interface::operator<<(const etk::Stringstream&)
|
||||
etk::io::Interface& operator<< (const int32_t _data);
|
||||
//! @copydoc etk::io::Interface::operator<<(const etk::Stringstream&)
|
||||
etk::io::Interface& operator<< (const uint32_t _data);
|
||||
//! @copydoc etk::io::Interface::operator<<(const etk::Stringstream&)
|
||||
etk::io::Interface& operator<< (const float _data);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user