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
00019
00020 #ifndef GNASH_RC_H
00021 #define GNASH_RC_H
00022
00023 #include "dsodefs.h"
00024 #include "StringPredicates.h"
00025
00026 #include <string>
00027 #include <vector>
00028 #include <iostream>
00029 #include <sstream>
00030 #include <boost/cstdint.hpp>
00031 #include <boost/tokenizer.hpp>
00032
00033 #if !defined(_WIN32) && !defined(__HAIKU__) && !defined(ANDROID)
00034 #include <sys/shm.h>
00035 #else
00036 #ifdef _WIN32
00037 typedef boost::uint32_t key_t;
00038 #endif // _WIN32
00039 #endif // _WIN32 and __HAIKU__
00040
00041 namespace gnash {
00042
00043 class DSOEXPORT RcInitFile
00044 {
00045 public:
00046
00048 static RcInitFile& getDefaultInstance();
00049
00051
00052 void loadFiles();
00053
00054 bool parseFile(const std::string& filespec);
00055
00059
00062 bool updateFile(const std::string& filespec);
00063
00067
00069 bool updateFile();
00070
00071 bool useSplashScreen() const { return _splashScreen; }
00072 void useSplashScreen(bool value);
00073
00074 bool useActionDump() const { return _actionDump; }
00075 void useActionDump(bool value);
00076
00077 bool useParserDump() const { return _parserDump; }
00078 void useParserDump(bool value);
00079
00080 bool useWriteLog() const { return _writeLog; }
00081 void useWriteLog(bool value);
00082
00083 int getTimerDelay() const { return _delay; }
00084 void setTimerDelay(int x) { _delay = x; }
00085
00086 bool showASCodingErrors() const { return _verboseASCodingErrors; }
00087 void showASCodingErrors(bool value);
00088
00089 bool showMalformedSWFErrors() const { return _verboseMalformedSWF; }
00090 void showMalformedSWFErrors(bool value);
00091
00092 bool showMalformedAMFErrors() const { return _verboseMalformedAMF; }
00093 void showMalformedAMFErrors(bool value);
00094
00095 int getMovieLibraryLimit() const { return _movieLibraryLimit; }
00096 void setMovieLibraryLimit(int value) { _movieLibraryLimit = value; }
00097
00098 bool enableExtensions() const { return _extensionsEnabled; }
00099
00101
00103 bool startStopped() const { return _startStopped; }
00104 void startStopped(bool value) { _startStopped = value; }
00105
00106 bool insecureSSL() const { return _insecureSSL; }
00107 void insecureSSL(bool value) { _insecureSSL = value; }
00108
00109 int qualityLevel() const { return _quality; }
00110 void qualityLevel(int value) { _quality = value; }
00111
00112 int verbosityLevel() const { return _verbosity; }
00113 void verbosityLevel(int value) { _verbosity = value; }
00114
00115 void setDebugLog(const std::string &x) { _log = x; }
00116 const std::string& getDebugLog() const { return _log; }
00117
00118 void setDocumentRoot(const std::string &x) { _wwwroot = x; }
00119 std::string getDocumentRoot() { return _wwwroot; }
00120
00121 bool useDebugger() const { return _debugger; }
00122 void useDebugger(bool value) { _debugger = value; }
00123
00124 bool useSound() const { return _sound; }
00125 void useSound(bool value) { _sound = value; }
00126
00127
00128
00129 bool usePluginSound() const { return _pluginSound; }
00130 void usePluginSound(bool value) { _pluginSound = value; }
00131
00132 bool popupMessages() const { return _popups; }
00133 void interfacePopups(bool value) { _popups = value; }
00134
00135 bool useLocalDomain() const { return _localdomainOnly; }
00136 void useLocalDomain(bool value);
00137
00139 bool useLocalHost() const { return _localhostOnly; }
00140
00142 void useLocalHost(bool value);
00143
00144 typedef std::vector<std::string> PathList;
00145
00147
00149 const PathList& getWhiteList() const { return _whitelist; }
00150
00152
00154 void setWhitelist (const std::vector<std::string>& list) { _whitelist = list; }
00155
00157
00159 const PathList& getBlackList() const { return _blacklist; }
00160
00162
00164 void setBlacklist (const std::vector<std::string>& list) {
00165 _blacklist = list;
00166 }
00167
00169
00173 const PathList& getLocalSandboxPath() const { return _localSandboxPath; }
00174
00176 void addLocalSandboxPath(const std::string& dir)
00177 {
00178 _localSandboxPath.push_back(dir);
00179 }
00180
00184
00186 void setLocalSandboxPath(const PathList& path)
00187 {
00188 _localSandboxPath = path;
00189 }
00190
00191 const std::string& getFlashVersionString() const {
00192 return _flashVersionString;
00193 }
00194
00195 void setFlashVersionString(const std::string& value) {
00196 _flashVersionString = value;
00197 }
00198
00199 const std::string& getFlashSystemOS() const {
00200 return _flashSystemOS;
00201 }
00202
00203 void setFlashSystemOS(const std::string& value) {
00204 _flashSystemOS = value;
00205 }
00206
00207 const std::string& getFlashSystemManufacturer() const {
00208 return _flashSystemManufacturer;
00209 }
00210
00211 void setFlashSystemManufacturer(const std::string& value) {
00212 _flashSystemManufacturer = value;
00213 }
00214
00215 const std::string& getGstAudioSink() const { return _gstaudiosink; }
00216
00217 void setGstAudioSink(const std::string& value) { _gstaudiosink = value; }
00218
00219 int getRetries() const { return _retries; }
00220
00221 void setRetries(int x) { _retries = x; }
00222
00224 double getStreamsTimeout() const { return _streamsTimeout; }
00225
00227 void setStreamsTimeout(const double &x) { _streamsTimeout = x; }
00228
00230
00234 const std::string &getURLOpenerFormat() const
00235 {
00236 return _urlOpenerFormat;
00237 }
00238
00239 void setURLOpenerFormat(const std::string& value)
00240 {
00241 _urlOpenerFormat = value;
00242 }
00243
00244
00245 const std::string &getHWAccel() const { return _hwaccel; }
00246
00247
00248 void setHWAccel(const std::string &x) { _hwaccel = x; }
00249
00250
00251 const std::string& getRenderer() const { return _renderer; }
00252
00253
00254 void setRenderer(const std::string& x) { _renderer = x; }
00255
00256
00257 const std::string& getMediaHandler() const { return _mediahandler; }
00258
00259
00260 void setMediaHandler(const std::string& x) { _mediahandler = x; }
00261
00262
00263 const std::string &getSOLSafeDir() const { return _solsandbox; }
00264
00265
00266 void setSOLSafeDir(const std::string &x) { _solsandbox = x; }
00267
00268 bool getSOLLocalDomain() const { return _sollocaldomain; }
00269
00270 void setSOLLocalDomain(bool x) { _sollocaldomain = x; }
00271
00272 bool getSOLReadOnly() const { return _solreadonly; }
00273
00274 void setSOLReadOnly(bool x) { _solreadonly = x; }
00275
00276 bool getLocalConnection() const { return _lcdisabled; }
00277
00278 void setLocalConnection(bool x) { _lcdisabled = x; }
00279
00281 bool getLCTrace() const { return _lctrace; }
00282
00283 void setLCTrace(bool x) { _lctrace = x; }
00284
00285 key_t getLCShmKey() const { return static_cast<key_t>(_lcshmkey); }
00286
00287 void setLCShmKey(bool x) { _lcshmkey = x; }
00288
00289 bool ignoreFSCommand() const { return _ignoreFSCommand; }
00290
00291 void ignoreFSCommand(bool value) { _ignoreFSCommand = value; }
00292
00293 void saveStreamingMedia(bool value) { _saveStreamingMedia = value; }
00294
00295 bool saveStreamingMedia() const { return _saveStreamingMedia; }
00296
00297 void saveLoadedMedia(bool value) { _saveLoadedMedia = value; }
00298
00299 bool saveLoadedMedia() const { return _saveLoadedMedia; }
00300
00301 void setMediaDir(const std::string& value) { _mediaCacheDir = value; }
00302
00303 const std::string& getMediaDir() const { return _mediaCacheDir; }
00304
00305 void setWebcamDevice(int value) {_webcamDevice = value;}
00306
00307 int getWebcamDevice() const {return _webcamDevice;}
00308
00309 void setAudioInputDevice(int value) {_microphoneDevice = value;}
00310
00311 int getAudioInputDevice() {return _microphoneDevice;}
00312
00314 const std::string& getRootCert() const {
00315 return _rootcert;
00316 }
00318 void setRootCert(const std::string& value) {
00319 _rootcert = value;
00320 }
00321
00323 const std::string& getCertFile() const {
00324 return _certfile;
00325 }
00327 void setCertFile(const std::string& value) {
00328 _certfile = value;
00329 }
00330
00332 const std::string& getCertDir() const {
00333 return _certdir;
00334 }
00336 void setCertDir(const std::string& value) {
00337 _certdir = value;
00338 }
00339
00340 void ignoreShowMenu(bool value) { _ignoreShowMenu= value; }
00341
00342 bool ignoreShowMenu() const { return _ignoreShowMenu; }
00343
00344 void dump();
00345
00346 protected:
00347
00348
00349 void writeList(const PathList& list, std::ostream& o);
00350
00352 RcInitFile();
00353
00355 ~RcInitFile();
00356
00361 static void expandPath(std::string& path);
00362
00366
00372 static bool extractSetting(bool &var, const std::string& pattern,
00373 const std::string &variable, const std::string &value);
00374
00378
00384 template<typename T>
00385 static bool extractNumber(T& num, const std::string& pattern,
00386 const std::string &variable, const std::string &value)
00387 {
00388
00389 StringNoCaseEqual noCaseCompare;
00390
00391 if (noCaseCompare(variable, pattern)) {
00392 std::istringstream in(value);
00393 if (in >> num) return true;
00394
00395
00396
00397 std::cerr << "Conversion overflow in extractNumber: " <<
00398 value << std::endl;
00399 num = 0;
00400 return true;
00401 }
00402
00403 return false;
00404 }
00405
00409
00415 static bool extractDouble(double &out, const std::string& pattern,
00416 const std::string &variable, const std::string &value);
00417
00418
00420
00425 void parseList(std::vector<std::string>& list, const std::string &action,
00426 const std::string &items);
00427
00428 typedef boost::char_separator<char> Sep;
00429 typedef boost::tokenizer< Sep > Tok;
00430
00432 boost::uint32_t _delay;
00433
00435 boost::uint32_t _movieLibraryLimit;
00436
00438 bool _debug;
00439
00441 bool _debugger;
00442
00444 boost::uint32_t _verbosity;
00445
00447
00451 std::string _urlOpenerFormat;
00452
00454 std::string _flashVersionString;
00455
00457 std::string _gstaudiosink;
00458
00462 std::string _flashSystemOS;
00463
00467 std::string _flashSystemManufacturer;
00468
00470 bool _actionDump;
00471
00473 bool _parserDump;
00474
00476 bool _verboseASCodingErrors;
00477
00479 bool _verboseMalformedSWF;
00480
00482 bool _verboseMalformedAMF;
00483
00485 bool _splashScreen;
00486
00488 bool _localdomainOnly;
00489
00491 bool _localhostOnly;
00492
00494 PathList _whitelist;
00495
00497 PathList _blacklist;
00498
00500 std::string _log;
00501
00503 bool _writeLog;
00504
00506 std::string _wwwroot;
00507
00509 int _retries;
00510
00512 bool _sound;
00513
00515 bool _pluginSound;
00516
00518 bool _extensionsEnabled;
00519
00521 bool _startStopped;
00522
00524 bool _insecureSSL;
00525
00527 double _streamsTimeout;
00528
00531 PathList _localSandboxPath;
00532
00535 std::string _solsandbox;
00536
00538 bool _solreadonly;
00539 bool _sollocaldomain;
00540
00541
00542 bool _lcdisabled;
00543
00545 bool _lctrace;
00546
00549 boost::uint32_t _lcshmkey;
00550
00553 bool _ignoreFSCommand;
00554
00556 int _quality;
00557
00558 bool _saveStreamingMedia;
00559
00560 bool _saveLoadedMedia;
00561
00562 std::string _mediaCacheDir;
00563
00564 bool _popups;
00565
00566 bool _useXv;
00567
00570 int _webcamDevice;
00571
00572 int _microphoneDevice;
00573
00576 std::string _certfile;
00577
00580 std::string _certdir;
00581
00584 std::string _rootcert;
00585
00588 bool _ignoreShowMenu;
00589
00593 std::string _hwaccel;
00594
00598 std::string _renderer;
00599
00602 std::string _mediahandler;
00603 };
00604
00605
00606 }
00607
00608 #endif
00609
00610
00611
00612
00613
00614