[DEV] add basic display of basic type in vector

This commit is contained in:
Edouard DUPIN 2015-02-08 15:12:45 +01:00
parent b00b7aa7b3
commit e79daa2062
2 changed files with 139 additions and 1 deletions

View File

@ -173,7 +173,7 @@ static uint8_t sizeElement(const char* _data, int32_t _lenMax) {
char32_t utf8::convertChar32(const char* _input) {
char32_t value = 0;
if (NULL == _input) {
if (nullptr == _input) {
return value;
}
int32_t len = strlen(_input);
@ -1121,6 +1121,125 @@ std::ostream& std::operator <<(std::ostream& _os, const std::vector<std::u32stri
return _os;
}
std::ostream& std::operator <<(std::ostream& _os, const std::vector<float>& _obj) {
_os << "{";
for (size_t iii=0; iii< _obj.size(); iii++) {
if (iii>0) {
_os << ";";
}
_os << _obj[iii];
}
_os << "}";
return _os;
}
std::ostream& std::operator <<(std::ostream& _os, const std::vector<double>& _obj) {
_os << "{";
for (size_t iii=0; iii< _obj.size(); iii++) {
if (iii>0) {
_os << ";";
}
_os << _obj[iii];
}
_os << "}";
return _os;
}
std::ostream& std::operator <<(std::ostream& _os, const std::vector<int64_t>& _obj) {
_os << "{";
for (size_t iii=0; iii< _obj.size(); iii++) {
if (iii>0) {
_os << ";";
}
_os << _obj[iii];
}
_os << "}";
return _os;
}
std::ostream& std::operator <<(std::ostream& _os, const std::vector<uint64_t>& _obj) {
_os << "{";
for (size_t iii=0; iii< _obj.size(); iii++) {
if (iii>0) {
_os << ";";
}
_os << _obj[iii];
}
_os << "}";
return _os;
}
std::ostream& std::operator <<(std::ostream& _os, const std::vector<int32_t>& _obj) {
_os << "{";
for (size_t iii=0; iii< _obj.size(); iii++) {
if (iii>0) {
_os << ";";
}
_os << _obj[iii];
}
_os << "}";
return _os;
}
std::ostream& std::operator <<(std::ostream& _os, const std::vector<uint32_t>& _obj) {
_os << "{";
for (size_t iii=0; iii< _obj.size(); iii++) {
if (iii>0) {
_os << ";";
}
_os << _obj[iii];
}
_os << "}";
return _os;
}
std::ostream& std::operator <<(std::ostream& _os, const std::vector<int16_t>& _obj) {
_os << "{";
for (size_t iii=0; iii< _obj.size(); iii++) {
if (iii>0) {
_os << ";";
}
_os << _obj[iii];
}
_os << "}";
return _os;
}
std::ostream& std::operator <<(std::ostream& _os, const std::vector<uint16_t>& _obj) {
_os << "{";
for (size_t iii=0; iii< _obj.size(); iii++) {
if (iii>0) {
_os << ";";
}
_os << _obj[iii];
}
_os << "}";
return _os;
}
std::ostream& std::operator <<(std::ostream& _os, const std::vector<int8_t>& _obj) {
_os << "{";
for (size_t iii=0; iii< _obj.size(); iii++) {
if (iii>0) {
_os << ";";
}
_os << _obj[iii];
}
_os << "}";
return _os;
}
std::ostream& std::operator <<(std::ostream& _os, const std::vector<uint8_t>& _obj) {
_os << "{";
for (size_t iii=0; iii< _obj.size(); iii++) {
if (iii>0) {
_os << ";";
}
_os << _obj[iii];
}
_os << "}";
return _os;
}
#if (defined(__TARGET_OS__Android))
std::string std::to_string(int _val) {

View File

@ -460,6 +460,15 @@ namespace etk {
void sort(std::vector<std::u32string *>& _list);
//! @previous
void sort(std::vector<std::string *>& _list);
template<typename T, typename T2> bool isIn(const T& _val, const std::vector<T2>& _list) {
for (auto &it : _list) {
if (it == _val) {
return true;
}
}
return false;
}
};
namespace std {
@ -473,6 +482,16 @@ namespace std {
std::ostream& operator <<(std::ostream& _os, const std::vector<std::string>& _obj);
std::ostream& operator <<(std::ostream& _os, const std::u32string& _obj);
std::ostream& operator <<(std::ostream& _os, const std::vector<std::u32string>& _obj);
std::ostream& operator <<(std::ostream& _os, const std::vector<float>& _obj);
std::ostream& operator <<(std::ostream& _os, const std::vector<double>& _obj);
std::ostream& operator <<(std::ostream& _os, const std::vector<int64_t>& _obj);
std::ostream& operator <<(std::ostream& _os, const std::vector<uint64_t>& _obj);
std::ostream& operator <<(std::ostream& _os, const std::vector<int32_t>& _obj);
std::ostream& operator <<(std::ostream& _os, const std::vector<uint32_t>& _obj);
std::ostream& operator <<(std::ostream& _os, const std::vector<int16_t>& _obj);
std::ostream& operator <<(std::ostream& _os, const std::vector<uint16_t>& _obj);
std::ostream& operator <<(std::ostream& _os, const std::vector<int8_t>& _obj);
std::ostream& operator <<(std::ostream& _os, const std::vector<uint8_t>& _obj);
};
int32_t strlen(const char32_t * _data);