Added operator >> overload for Binary

This commit is contained in:
Jesse Beder
2012-01-21 02:01:37 -06:00
parent d760d037ca
commit 01eb370300
3 changed files with 46 additions and 0 deletions

View File

@@ -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