mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-09 20:51:16 +00:00
Added operator >> overload for Binary
This commit is contained in:
@@ -10,6 +10,8 @@
|
||||
|
||||
namespace YAML
|
||||
{
|
||||
class Node;
|
||||
|
||||
std::string EncodeBase64(const unsigned char *data, std::size_t size);
|
||||
std::vector<unsigned char> DecodeBase64(const std::string& input);
|
||||
|
||||
@@ -35,11 +37,30 @@ namespace YAML
|
||||
}
|
||||
}
|
||||
|
||||
bool operator == (const Binary& rhs) const {
|
||||
const std::size_t s = size();
|
||||
if(s != rhs.size())
|
||||
return false;
|
||||
const unsigned char *d1 = data();
|
||||
const unsigned char *d2 = rhs.data();
|
||||
for(std::size_t i=0;i<s;i++) {
|
||||
if(*d1++ != *d2++)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool operator != (const Binary& rhs) const {
|
||||
return !(*this == rhs);
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<unsigned char> m_data;
|
||||
const unsigned char *m_unownedData;
|
||||
std::size_t m_unownedSize;
|
||||
};
|
||||
|
||||
void operator >> (const Node& node, Binary& binary);
|
||||
}
|
||||
|
||||
#endif // BASE64_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||
|
Reference in New Issue
Block a user