Rev 1 | Blame | Compare with Previous | Last modification | View Log | RSS feed
/*defines bob_dom_cut - class that can manipulate the CUT1 format and all theunderlying objects*/#ifndef BOB_DOM_CUT_INCLUDED#define BOB_DOM_CUT_INCLUDED#include "bob_dom_base.h"#include "bob_dom_bob.h"#include "Settings.h"#include "bob_dom_frame.h"#include "../common/ext_utils.h"#include "../common/strutils.h"class bob_dom_cut;class bob_path;class bob_stat;class bob_name : public bob_string{public:static const int HDR_BEGIN = BOB_SECTION_NAME_NAME_BEGIN;static const int HDR_END = BOB_SECTION_NAME_NAME_END;bool load(ibinaryfilestream& is) { return bob_string::load(is, HDR_BEGIN, HDR_END); }bool toFile(obinaryfilestream& os) { return bob_string::toFile(os, HDR_BEGIN, HDR_END); }bool toFile(otextfilestream& os);};class bob_constants : public bob_section{public:static const int HDR_BEGIN = BOB_SECTION_NAME_CONST_BEGIN;static const int HDR_END = BOB_SECTION_NAME_CONST_END;struct constant{int a;double b;constant() { a=0; b=0; }bool load(ibinaryfilestream& is);bool toFile(obinaryfilestream& os);bool toFile(otextfilestream& os);};typedef ext::list<constant>::iterator iterator;ext::list<constant> values;bool load(ibinaryfilestream& is);bool toFile(obinaryfilestream& os);bool toFile(otextfilestream& os);};struct bob_note{int value;char *text;bob_error_codes errorCode;bob_note() { value=0; text=0; errorCode=e_noError; }~bob_note() { delete[] text; }bool load(ibinaryfilestream& is);bool toFile(obinaryfilestream& os);bool toFile(otextfilestream& os);};class bob_notes : public bob_section, public bob_cantainer<bob_note>{public:static const int HDR_BEGIN=BOB_SECTION_NAME_NOTE_BEGIN;static const int HDR_END=BOB_SECTION_NAME_NOTE_END;bool load(ibinaryfilestream& is, int lineCount);bool toFile(obinaryfilestream& os);bool toFile(otextfilestream& os);};typedef bob_cantainer<bob_frame> FrameContainer;class bob_path : public bob_section, public FrameContainer{private:static const int HDR_STAT_BEGIN = BOB_SECTION_NAME_STAT_BEGIN;static const int HDR_STAT_END = BOB_SECTION_NAME_STAT_END;typedef ext::list<int> TempStatList;bob_notes m_notes;const Settings *m_settings;char *m_bodyId;bool loadStatValues(ibinaryfilestream& is, int count);public:enum BodyFlags {fCamera=1,fDirLight=2,fOmniLight=10,fBody=64,fScene=128};static const int HDR_BEGIN = BOB_SECTION_NAME_PATH_BEGIN;static const int HDR_END = BOB_SECTION_NAME_PATH_END;bob_name name;bob_constants constants;int partIdx;int cockpitIdx;int parentIdx;int bodyFlags; // 'c' for cameras, 'l' for lightsbob_dom_bob *bob;bob_path(const Settings *s){partIdx=0; m_bodyId=0; cockpitIdx=0; bodyFlags=0; parentIdx=null_value; bob=0;m_settings=s;}~bob_path() { delete m_bodyId; delete bob; }const char * bodyId() const { return m_bodyId; }void bodyId(const char *str) { strcreate(m_bodyId, str); }bob_notes& notes() { return m_notes; }bool toFile(obinaryfilestream& os, int cutVersion);bool toFile(otextfilestream& os, int idx);bool load(ibinaryfilestream& is, int version);child_type* createChild(){child_type *ch=new bob_frame();children.push_back(ch);return ch;}};class bob_dom_cut : public bob_section, public bob_cantainer<bob_path>{private:int m_storedPathCount;const Settings *m_settings;public:static const int HDR_BEGIN = BOB_SECTION_NAME_CUT_BEGIN;static const int HDR_END =BOB_SECTION_NAME_CUT_END;static const int supported_version = 6;int version;bob_info info;bob_dom_cut(const Settings *s) { m_settings=s; version=0; m_storedPathCount=0; }bool toFile(obinaryfilestream& os);bool toFile(otextfilestream& os);value_type_ptr createChild() { return *(children.push_back(new bob_path(m_settings))); }bool load(ibinaryfilestream& is);bool convert(ibinaryfilestream& is, otextfilestream& os);};#endif // !defined(BOB_DOM_CUT_INCLUDED)