Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #pragma once
00015
00019 #include "SharedPtr.h"
00020 #include "MessageListParser.h"
00021
00022 namespace kNet
00023 {
00024
00025 class SerializedDataIterator : public RefCountable
00026 {
00027 public:
00028 SerializedDataIterator(const SerializedMessageDesc &desc_)
00029 :desc(desc_)
00030 {
00031 ResetTraversal();
00032 }
00033
00034 BasicSerializedDataType NextElementType() const;
00035
00036 const SerializedElementDesc *NextElementDesc() const;
00037
00038 void ProceedToNextVariable();
00039
00040 void ProceedNVariables(int count);
00041
00045 void SetVaryingElemSize(u32 count);
00046
00047 void ResetTraversal();
00048
00049 private:
00050 struct ElemInfo
00051 {
00053 SerializedElementDesc *elem;
00055 int nextElem;
00057 int nextIndex;
00059 int count;
00061 bool dynamicCountSpecified;
00062 };
00063
00064 void ProceedToNextElement();
00065 void DescendIntoStructure();
00066
00068 std::vector<ElemInfo> currentElementStack;
00070 const SerializedMessageDesc &desc;
00071 };
00072
00073 }