Include protobuf. Not sure if we're supposed to commit protoc :S

This commit is contained in:
momo5502
2016-02-10 14:54:50 +01:00
parent 029c1e4c7d
commit 75e76226d1
10 changed files with 78 additions and 70 deletions

View File

@ -43,7 +43,7 @@ namespace Utils
for (int i = 0; i < CSV::GetRows(); ++i)
{
count = max(CSV::GetColumns(i), count);
count = std::max(CSV::GetColumns(i), count);
}
return count;

View File

@ -246,31 +246,4 @@ namespace Utils
this->KeyValuePairs[KeyValues[i]] = KeyValues[i + 1];
}
}
namespace Message
{
void WriteBuffer(std::string& message, std::string buffer)
{
DWORD length = buffer.size();
message.append(reinterpret_cast<char*>(&length), 4);
message.append(buffer);
}
bool ReadBuffer(std::string& message, std::string& buffer)
{
if (message.size() < 4) return false;
char* messagePtr = const_cast<char*>(message.data());
DWORD length = *reinterpret_cast<DWORD*>(messagePtr);
if (message.size() < (length + 4)) return false;
buffer.clear();
buffer.append(messagePtr + 4, length);
message = std::string(messagePtr + 4 + length, message.size() - (4 + length));
return true;
}
}
}

View File

@ -59,12 +59,4 @@ namespace Utils
target->push_back(entry);
}
}
// TODO: Implement a bytebuffer class
// Maybe convery's or protobuf
namespace Message
{
void WriteBuffer(std::string& message, std::string buffer);
bool ReadBuffer(std::string& message, std::string& buffer);
}
}