[DEV] add stream write of data for FSNode (test)
This commit is contained in:
parent
e6a829fd2a
commit
69c052df6a
@ -1708,6 +1708,39 @@ int64_t etk::FSNode::fileWrite(const void * _data, int64_t _blockSize, int64_t _
|
|||||||
#endif
|
#endif
|
||||||
return fwrite(_data, _blockSize, _nbBlock, m_PointerFile);
|
return fwrite(_data, _blockSize, _nbBlock, m_PointerFile);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
etk::FSNode& etk::FSNode::operator<< (const std::ostream& _data) {
|
||||||
|
fileWrite(_data.str().c_str(), 1, _data.str().size());
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
etk::FSNode& etk::FSNode::operator<< (const std::stringstream& _data) {
|
||||||
|
std::string sss = _data.str();
|
||||||
|
fileWrite(sss.c_str(), 1, sss.size());
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
etk::FSNode& etk::FSNode::operator<< (const std::string& _data) {
|
||||||
|
fileWrite(_data.c_str(), 1, _data.size());
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
etk::FSNode& etk::FSNode::operator<< (const char* _data) {
|
||||||
|
fileWrite(_data, 1, strlen(_data));
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
etk::FSNode& etk::FSNode::operator<< (const int32_t _data) {
|
||||||
|
std::stringstream tmp;
|
||||||
|
tmp << _data;
|
||||||
|
std::string sss = tmp.str();
|
||||||
|
fileWrite(sss.c_str(), 1, sss.size());
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
etk::FSNode& etk::FSNode::operator<< (const uint32_t _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)
|
bool etk::FSNode::fileSeek(long int _offset, enum etk::seekNode _origin)
|
||||||
{
|
{
|
||||||
|
@ -452,6 +452,17 @@ namespace etk {
|
|||||||
* @return Number of element written (in block number)
|
* @return Number of element written (in block number)
|
||||||
*/
|
*/
|
||||||
int64_t fileWrite(const void* _data, int64_t _blockSize, int64_t _nbBlock);
|
int64_t fileWrite(const void* _data, int64_t _blockSize, int64_t _nbBlock);
|
||||||
|
/**
|
||||||
|
* @brief Stream write mode
|
||||||
|
* @param[in] _data Stream to write
|
||||||
|
* @note not stable API ...
|
||||||
|
*/
|
||||||
|
//etk::FSNode& operator<< (const std::ostream& _data);
|
||||||
|
etk::FSNode& operator<< (const std::stringstream& _data);
|
||||||
|
etk::FSNode& operator<< (const std::string& _data);
|
||||||
|
etk::FSNode& operator<< (const char* _data);
|
||||||
|
etk::FSNode& operator<< (const int32_t _data);
|
||||||
|
etk::FSNode& operator<< (const uint32_t _data);
|
||||||
/**
|
/**
|
||||||
* @brief Get the position in the file.
|
* @brief Get the position in the file.
|
||||||
* @return the requested position.
|
* @return the requested position.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user