21 #ifndef GNASH_LOADVARIABLESTHREAD_H
22 #define GNASH_LOADVARIABLESTHREAD_H
26 #include <boost/scoped_ptr.hpp>
27 #include <boost/thread/thread.hpp>
28 #include <boost/thread/mutex.hpp>
29 #include <boost/bind.hpp>
52 typedef std::map<std::string, std::string>
ValuesMap;
76 const std::string& postdata);
90 assert(!_thread.get());
91 assert(_stream.get());
92 _thread.reset(
new boost::thread(
93 boost::bind(LoadVariablesThread::execLoadingThread,
this)));
106 return ( _thread.get() != NULL );
117 boost::mutex::scoped_lock lock(_mutex);
118 if ( _completed && _thread.get() )
160 boost::mutex::scoped_lock lock(_mutex);
183 size_t parse(
const std::string& str)
193 bool cancelRequested();
199 boost::scoped_ptr<IOChannel> _stream;
201 boost::scoped_ptr<boost::thread> _thread;
214 #endif // GNASH_LOADVARIABLESTHREAD_H
static void parse_querystring(const std::string &query_string, std::map< std::string, std::string > &target_map)
Parse a query string filling the provided map.
Definition: URL.cpp:355
LoadVariablesThread(const StreamProvider &sp, const URL &url)
Construct a LoadVariablesThread opening a stream for the given URL.
Definition: LoadVariablesThread.cpp:156
std::map< std::string, std::string > ValuesMap
Definition: LoadVariablesThread.h:52
bool inProgress()
Return true if loading/parsing is in progress.
Definition: LoadVariablesThread.h:103
void process()
Start the load and parse thread.
Definition: LoadVariablesThread.h:88
size_t getBytesLoaded() const
Definition: LoadVariablesThread.h:126
A manager for loadVariable requests.
Definition: LoadVariablesThread.h:49
bool completed()
Mutex-protected inspector for thread completion.
Definition: LoadVariablesThread.h:115
~LoadVariablesThread()
Destroy the LoadVariablesThread, joining the thread if spawned.
Definition: LoadVariablesThread.cpp:185
std::string url
Definition: gnash.cpp:58
ValuesMap & getValues()
Return the name,value map parsed out of the loaded stream.
Definition: LoadVariablesThread.h:82
void cancel()
Cancel a download in progress.
Definition: LoadVariablesThread.cpp:172
size_t getBytesTotal() const
Definition: LoadVariablesThread.h:132
A StreamProvider makes IOChannels available to the core on request.
Definition: StreamProvider.h:49
Definition: LoadVariablesThread.h:42
Uniform Resource Locator.
Definition: URL.h:34