Packet create functions

This commit is contained in:
Dan Paulat 2021-12-28 16:51:23 -06:00
parent 95a3bb7cb7
commit 0ef21fd609
12 changed files with 95 additions and 0 deletions

View file

@ -35,6 +35,8 @@ public:
bool Parse(std::istream& is) override; bool Parse(std::istream& is) override;
static std::shared_ptr<LinkedContourVectorPacket> Create(std::istream& is);
private: private:
std::unique_ptr<LinkedContourVectorPacketImpl> p; std::unique_ptr<LinkedContourVectorPacketImpl> p;
}; };

View file

@ -34,6 +34,8 @@ public:
bool Parse(std::istream& is) override; bool Parse(std::istream& is) override;
static std::shared_ptr<LinkedVectorPacket> Create(std::istream& is);
private: private:
std::unique_ptr<LinkedVectorPacketImpl> p; std::unique_ptr<LinkedVectorPacketImpl> p;
}; };

View file

@ -34,6 +34,8 @@ public:
bool Parse(std::istream& is) override; bool Parse(std::istream& is) override;
static std::shared_ptr<SetColorLevelPacket> Create(std::istream& is);
static constexpr size_t SIZE = 6u; static constexpr size_t SIZE = 6u;
private: private:

View file

@ -35,6 +35,8 @@ public:
bool Parse(std::istream& is) override; bool Parse(std::istream& is) override;
static std::shared_ptr<TextAndSpecialSymbolPacket> Create(std::istream& is);
private: private:
std::unique_ptr<TextAndSpecialSymbolPacketImpl> p; std::unique_ptr<TextAndSpecialSymbolPacketImpl> p;
}; };

View file

@ -35,6 +35,8 @@ public:
bool Parse(std::istream& is) override; bool Parse(std::istream& is) override;
static std::shared_ptr<UnlinkedContourVectorPacket> Create(std::istream& is);
private: private:
std::unique_ptr<UnlinkedContourVectorPacketImpl> p; std::unique_ptr<UnlinkedContourVectorPacketImpl> p;
}; };

View file

@ -34,6 +34,8 @@ public:
bool Parse(std::istream& is) override; bool Parse(std::istream& is) override;
static std::shared_ptr<UnlinkedVectorPacket> Create(std::istream& is);
private: private:
std::unique_ptr<UnlinkedVectorPacketImpl> p; std::unique_ptr<UnlinkedVectorPacketImpl> p;
}; };

View file

@ -136,6 +136,20 @@ bool LinkedContourVectorPacket::Parse(std::istream& is)
return blockValid; return blockValid;
} }
std::shared_ptr<LinkedContourVectorPacket>
LinkedContourVectorPacket::Create(std::istream& is)
{
std::shared_ptr<LinkedContourVectorPacket> packet =
std::make_shared<LinkedContourVectorPacket>();
if (!packet->Parse(is))
{
packet.reset();
}
return packet;
}
} // namespace rpg } // namespace rpg
} // namespace wsr88d } // namespace wsr88d
} // namespace scwx } // namespace scwx

View file

@ -142,6 +142,19 @@ bool LinkedVectorPacket::Parse(std::istream& is)
return blockValid; return blockValid;
} }
std::shared_ptr<LinkedVectorPacket> LinkedVectorPacket::Create(std::istream& is)
{
std::shared_ptr<LinkedVectorPacket> packet =
std::make_shared<LinkedVectorPacket>();
if (!packet->Parse(is))
{
packet.reset();
}
return packet;
}
} // namespace rpg } // namespace rpg
} // namespace wsr88d } // namespace wsr88d
} // namespace scwx } // namespace scwx

View file

@ -95,6 +95,20 @@ bool SetColorLevelPacket::Parse(std::istream& is)
return blockValid; return blockValid;
} }
std::shared_ptr<SetColorLevelPacket>
SetColorLevelPacket::Create(std::istream& is)
{
std::shared_ptr<SetColorLevelPacket> packet =
std::make_shared<SetColorLevelPacket>();
if (!packet->Parse(is))
{
packet.reset();
}
return packet;
}
} // namespace rpg } // namespace rpg
} // namespace wsr88d } // namespace wsr88d
} // namespace scwx } // namespace scwx

View file

@ -134,6 +134,20 @@ bool TextAndSpecialSymbolPacket::Parse(std::istream& is)
return blockValid; return blockValid;
} }
std::shared_ptr<TextAndSpecialSymbolPacket>
TextAndSpecialSymbolPacket::Create(std::istream& is)
{
std::shared_ptr<TextAndSpecialSymbolPacket> packet =
std::make_shared<TextAndSpecialSymbolPacket>();
if (!packet->Parse(is))
{
packet.reset();
}
return packet;
}
} // namespace rpg } // namespace rpg
} // namespace wsr88d } // namespace wsr88d
} // namespace scwx } // namespace scwx

View file

@ -120,6 +120,20 @@ bool UnlinkedContourVectorPacket::Parse(std::istream& is)
return blockValid; return blockValid;
} }
std::shared_ptr<UnlinkedContourVectorPacket>
UnlinkedContourVectorPacket::Create(std::istream& is)
{
std::shared_ptr<UnlinkedContourVectorPacket> packet =
std::make_shared<UnlinkedContourVectorPacket>();
if (!packet->Parse(is))
{
packet.reset();
}
return packet;
}
} // namespace rpg } // namespace rpg
} // namespace wsr88d } // namespace wsr88d
} // namespace scwx } // namespace scwx

View file

@ -145,6 +145,20 @@ bool UnlinkedVectorPacket::Parse(std::istream& is)
return blockValid; return blockValid;
} }
std::shared_ptr<UnlinkedVectorPacket>
UnlinkedVectorPacket::Create(std::istream& is)
{
std::shared_ptr<UnlinkedVectorPacket> packet =
std::make_shared<UnlinkedVectorPacket>();
if (!packet->Parse(is))
{
packet.reset();
}
return packet;
}
} // namespace rpg } // namespace rpg
} // namespace wsr88d } // namespace wsr88d
} // namespace scwx } // namespace scwx