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_SOL_H
00019 #define GNASH_SOL_H
00020
00021 #include <boost/cstdint.hpp>
00022 #include <string>
00023 #include <vector>
00024
00025 #include "dsodefs.h"
00026 #include "amf.h"
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00043 namespace cygnal
00044 {
00045
00046
00047 class Element;
00048
00053 class DSOEXPORT SOL {
00054 public:
00055 SOL();
00056 ~SOL();
00057
00061 size_t size() const { return _amfobjs.size(); }
00062
00063 size_t fileSize() const { return _filesize; }
00064
00071 bool extractHeader(const std::vector<boost::uint8_t> &data);
00072
00078 bool extractHeader(const std::string &filespec);
00079
00086 bool formatHeader(const std::vector<boost::uint8_t> &data);
00087
00093 bool formatHeader(const std::string &name);
00094
00102 bool formatHeader(const std::string &name, int filesize);
00103
00107 bool writeFile();
00108
00116 bool writeFile(const std::string &filespec, const std::string &objname);
00117
00123 bool readFile(const std::string &filespec);
00124
00128 std::vector<boost::uint8_t> getHeader() { return _header; };
00129
00131
00135 void addObj(boost::shared_ptr<Element> el);
00136
00141 std::vector<boost::shared_ptr<cygnal::Element> > &getElements() { return _amfobjs; }
00142
00148 boost::shared_ptr<Element> getElement(size_t size)
00149 {
00150 assert(size<_amfobjs.size());
00151 return _amfobjs[size];
00152 }
00153
00161 void setFilespec(const std::string &filespec) { _filespec = filespec; };
00162
00167 const std::string &getFilespec() const { return _filespec; };
00168
00174 void setObjectName(const std::string &objname) { _objname = objname; };
00175
00180 const std::string &getObjectName() const { return _objname; };
00181
00182 bool updateSO(boost::shared_ptr<cygnal::Element> &el);
00183 bool updateSO(int index, boost::shared_ptr<cygnal::Element> &el);
00184
00188 void dump();
00189
00190 private:
00193 std::vector<boost::uint8_t> _header;
00194
00197 std::vector<boost::uint8_t> _data;
00198
00201 std::string _objname;
00202
00205 std::string _filespec;
00206
00209 int _filesize;
00210
00211 protected:
00214 std::vector<boost::shared_ptr<Element> > _amfobjs;
00215
00216 };
00217
00218
00219 }
00220
00221
00222 #endif
00223
00224
00225
00226
00227