diff options
author | George Hazan <george.hazan@gmail.com> | 2013-09-04 17:02:59 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-09-04 17:02:59 +0000 |
commit | 85dd9103853d66d0bd6ab858cc9eec4c2c916489 (patch) | |
tree | c4e55cc4a290a8ec71e8e4b3aa17f528ccde2003 /protocols/MRA/src/Mra.h | |
parent | 89180a5137c945c2f1b6877438e239c9cdf2b508 (diff) |
added also functional access for BinBuffer()
git-svn-id: http://svn.miranda-ng.org/main/trunk@5944 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/MRA/src/Mra.h')
-rw-r--r-- | protocols/MRA/src/Mra.h | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/protocols/MRA/src/Mra.h b/protocols/MRA/src/Mra.h index a0d859e903..2e98bfd1ba 100644 --- a/protocols/MRA/src/Mra.h +++ b/protocols/MRA/src/Mra.h @@ -122,19 +122,28 @@ struct MRA_ADDR_LIST /////////////////////////////////////////////////////////////////////////////
-struct BinBuffer
+class BinBuffer
{
- BinBuffer(LPBYTE data, size_t len) : m_data(data), m_len(len) {}
-
LPBYTE m_data;
size_t m_len;
+
+public:
+ BinBuffer(LPBYTE data, size_t len) : m_data(data), m_len(len) {}
+
+ DWORD getDword();
+ DWORDLONG getInt64();
+ MRA_GUID getGuid();
+ void getStringA(CMStringA&);
+ void getStringW(CMStringW&);
+
+ __forceinline bool eof() const { return m_len > 0; }
};
-BinBuffer& operator >>(BinBuffer&, DWORD&);
-BinBuffer& operator >>(BinBuffer&, DWORDLONG&);
-BinBuffer& operator >>(BinBuffer&, MRA_GUID&);
-BinBuffer& operator >>(BinBuffer&, CMStringA&);
-BinBuffer& operator >>(BinBuffer&, CMStringW&);
+__forceinline BinBuffer& operator >>(BinBuffer& buf, DWORD &dwVar) { dwVar = buf.getDword(); return buf; }
+__forceinline BinBuffer& operator >>(BinBuffer& buf, DWORDLONG &llVar) { llVar = buf.getInt64(); return buf; }
+__forceinline BinBuffer& operator >>(BinBuffer& buf, MRA_GUID &guid) { guid = buf.getGuid(); return buf; }
+__forceinline BinBuffer& operator >>(BinBuffer& buf, CMStringA &sVar) { buf.getStringA(sVar); return buf; }
+__forceinline BinBuffer& operator >>(BinBuffer& buf, CMStringW &sVar) { buf.getStringW(sVar); return buf; }
/////////////////////////////////////////////////////////////////////////////
|