Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef GNASH_SWF_SCENEANDLABELTAG_H
00019 #define GNASH_SWF_SCENEANDLABELTAG_H
00020
00021 #include "ControlTag.h"
00022 #include "SWF.h"
00023 #include "MovieClip.h"
00024 #include "SWFStream.h"
00025 #include "log.h"
00026
00027 #include <string>
00028 #include <map>
00029
00030
00031 namespace gnash {
00032 class movie_definition;
00033 }
00034
00035 namespace gnash {
00036 namespace SWF {
00037
00038 class DefineSceneAndFrameLabelDataTag : public ControlTag
00039 {
00040 public:
00041
00043 virtual void executeState(MovieClip* , DisplayList& ) const
00044 {
00045 log_unimpl("DefineSceneAndFrameLabelDataTag");
00046 }
00047
00048 static void loader(SWFStream& in, TagType tag, movie_definition& m,
00049 const RunResources& )
00050 {
00051 assert(tag == DEFINESCENEANDFRAMELABELDATA);
00052
00053 if (!m.isAS3()) {
00054 IF_VERBOSE_MALFORMED_SWF(
00055 log_swferror("SWF contains DefineSceneAndFrameLabelData tag, "
00056 "but is not an AS3 SWF!");
00057 );
00058 throw ParserException("DefineSceneAndFrameLabelData tag found in "
00059 "non-AS3 SWF!");
00060 }
00061
00062 DefineSceneAndFrameLabelDataTag* t =
00063 new DefineSceneAndFrameLabelDataTag(in);
00064
00066 m.addControlTag(t);
00067
00068 }
00069
00070 private:
00071
00072 DefineSceneAndFrameLabelDataTag(SWFStream& in)
00073 {
00074 read(in);
00075 }
00076
00077 void read(SWFStream& in) {
00078
00079 boost::uint32_t scenes = in.read_V32();
00080
00081 IF_VERBOSE_PARSE(log_parse("Scene count: %d", scenes));
00082
00083 for (size_t i = 0; i < scenes; ++i) {
00084 boost::uint32_t offset = in.read_V32();
00085 std::string name;
00086 in.read_string(name);
00087 IF_VERBOSE_PARSE(log_parse("Offset %d name: %s", offset, name));
00088 _scenes[offset] = name;
00089 }
00090
00091 boost::uint32_t labels = in.read_V32();
00092
00093 for (size_t i = 0; i < labels; ++i) {
00094 boost::uint32_t num = in.read_V32();
00095 std::string label;
00096 in.read_string(label);
00097 IF_VERBOSE_PARSE(log_parse("Frame %d label: %s", num, label));
00098 _frames[num] = label;
00099 }
00100
00101 }
00102
00103 std::map<boost::uint32_t, std::string> _scenes;
00104 std::map<boost::uint32_t, std::string> _frames;
00105
00106 };
00107
00108 }
00109 }
00110
00111
00112 #endif // GNASH_SWF_SYMBOLCLASSTAG_H
00113
00114
00115
00116
00117
00118