mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Remove TaggedList's, they're obsolete.
This commit is contained in:
@@ -380,64 +380,6 @@ int Serializer::addVL(const std::string& string)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int Serializer::addTaggedList(const std::list<TaggedListItem>& list)
|
||||
{
|
||||
int size = list.size();
|
||||
if (size > 255) return -1;
|
||||
int ret = add8(size);
|
||||
if (size != 0)
|
||||
{
|
||||
BOOST_FOREACH(const TaggedListItem& it, list)
|
||||
{
|
||||
add8(it.first);
|
||||
addVL(it.second);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int Serializer::addTaggedList(const std::vector<TaggedListItem>& list)
|
||||
{
|
||||
int size = list.size();
|
||||
if (size > 255) return -1;
|
||||
int ret = add8(size);
|
||||
if (size != 0)
|
||||
{
|
||||
BOOST_FOREACH(const TaggedListItem& it, list)
|
||||
{
|
||||
add8(it.first);
|
||||
addVL(it.second);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int Serializer::getTaggedListLength(const std::list<TaggedListItem>& list)
|
||||
{
|
||||
int size = list.size();
|
||||
if (size > 255) return -1;
|
||||
int ret = 1;
|
||||
if (size != 0)
|
||||
{
|
||||
BOOST_FOREACH(const TaggedListItem& it, list)
|
||||
ret += 1 + it.second.size() + Serializer::encodeLengthLength(it.second.size());
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int Serializer::getTaggedListLength(const std::vector<TaggedListItem>& list)
|
||||
{
|
||||
int size = list.size();
|
||||
if (size > 255) return -1;
|
||||
int ret = 1;
|
||||
if (size != 0)
|
||||
{
|
||||
BOOST_FOREACH(const TaggedListItem& it, list)
|
||||
ret += 1 + it.second.size() + Serializer::encodeLengthLength(it.second.size());
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool Serializer::getVL(std::vector<unsigned char>& objectVL, int offset, int& length) const
|
||||
{
|
||||
int b1;
|
||||
@@ -503,44 +445,6 @@ bool Serializer::getVLLength(int& length, int offset) const
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Serializer::getTaggedList(std::list<TaggedListItem>& list, int offset, int& length) const
|
||||
{
|
||||
list.clear();
|
||||
int startOffset = offset;
|
||||
int numElem;
|
||||
if (!get8(numElem, offset++)) return false;
|
||||
for (int i = 0; i<numElem; ++i)
|
||||
{
|
||||
int tag, len;
|
||||
std::vector<unsigned char> data;
|
||||
if (!get8(tag, offset++)) return false;
|
||||
if (!getVL(data, offset, len)) return false;
|
||||
offset += len;
|
||||
list.push_back(std::make_pair(tag, data));
|
||||
}
|
||||
length = offset - startOffset;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Serializer::getTaggedList(std::vector<TaggedListItem>& list, int offset, int& length) const
|
||||
{
|
||||
list.clear();
|
||||
int startOffset = offset;
|
||||
int numElem;
|
||||
if (!get8(numElem, offset++)) return false;
|
||||
for (int i = 0; i<numElem; ++i)
|
||||
{
|
||||
int tag, len;
|
||||
std::vector<unsigned char> data;
|
||||
if (!get8(tag, offset++)) return false;
|
||||
if (!getVL(data, offset, len)) return false;
|
||||
offset += len;
|
||||
list.push_back(std::make_pair(tag, data));
|
||||
}
|
||||
length = offset - startOffset;
|
||||
return true;
|
||||
}
|
||||
|
||||
std::vector<unsigned char> Serializer::encodeVL(int length)
|
||||
{
|
||||
unsigned char lenBytes[4];
|
||||
@@ -692,15 +596,6 @@ std::vector<unsigned char> SerializerIterator::getVL()
|
||||
return vl;
|
||||
}
|
||||
|
||||
std::vector<TaggedListItem> SerializerIterator::getTaggedList()
|
||||
{
|
||||
int length;
|
||||
std::vector<TaggedListItem> tl;
|
||||
if (!mSerializer.getTaggedList(tl, mPos, length)) throw std::runtime_error("invalid serializer getTL");
|
||||
mPos += length;
|
||||
return tl;
|
||||
}
|
||||
|
||||
std::vector<unsigned char> SerializerIterator::getRaw(int iLength)
|
||||
{
|
||||
int iPos = mPos;
|
||||
|
||||
Reference in New Issue
Block a user