12 |
// |
// |
13 |
// $Id$ |
// $Id$ |
14 |
|
|
15 |
|
#include <map> |
16 |
|
#include <iostream> |
17 |
|
|
18 |
#include <boost/thread.hpp> |
#include <boost/thread.hpp> |
19 |
#include <boost/bind.hpp> |
#include <boost/bind.hpp> |
20 |
#include <boost/scoped_array.hpp> |
#include <boost/scoped_array.hpp> |
21 |
#include "scene_parser.hpp" |
|
|
#include <iostream> |
|
22 |
#include <expat.h> |
#include <expat.h> |
23 |
|
|
24 |
|
#include "scene_parser.hpp" |
25 |
|
#include "scene_parser_elements.hpp" |
26 |
|
#include "../log.hpp" |
27 |
|
|
28 |
namespace usata |
namespace usata |
29 |
{ |
{ |
30 |
|
|
31 |
|
|
32 |
class SceneDocument |
SceneElement::SceneElement(SceneElement*parent, |
33 |
: public SceneElement |
SceneParser*parser) |
34 |
{ |
{ |
35 |
SceneDocument(SceneParser *parser); |
mParent = parent; |
36 |
}; |
mParser = parser; |
37 |
|
return; |
38 |
|
} |
39 |
|
|
40 |
|
|
41 |
SceneParser::SceneParser(std::istream& stream, |
SceneParser::SceneParser(std::istream& stream, |
65 |
void |
void |
66 |
SceneParser::element_start(const char* name, const char**attrib) |
SceneParser::element_start(const char* name, const char**attrib) |
67 |
{ |
{ |
68 |
|
if (mElements.empty()) |
69 |
|
{ |
70 |
|
SceneElement * ns = new SceneDocument(this); |
71 |
|
ns->start_element(name,attrib); |
72 |
|
mElements.push_back(ns); |
73 |
|
return; |
74 |
|
} |
75 |
|
|
|
|
|
|
|
|
76 |
} |
} |
77 |
void SceneParser::element_end(const char*) |
void SceneParser::element_end(const char*) |
78 |
{ |
{ |
89 |
std::streamsize readlen; |
std::streamsize readlen; |
90 |
std::streamsize x=0; |
std::streamsize x=0; |
91 |
bool done(false); |
bool done(false); |
|
|
|
92 |
|
|
93 |
void*buf; |
void*buf; |
94 |
while (!done) |
while (!done) |
113 |
SceneParser::threaded_parse() |
SceneParser::threaded_parse() |
114 |
{ |
{ |
115 |
mThread.reset(new boost::thread(boost::bind(&SceneParser::thread_main,this))); |
mThread.reset(new boost::thread(boost::bind(&SceneParser::thread_main,this))); |
|
|
|
|
|
|
116 |
} |
} |
117 |
|
|
118 |
} |
} |