[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog libbase/rc.cpp libbase/rc.h
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] gnash ChangeLog libbase/rc.cpp libbase/rc.h |
Date: |
Wed, 05 Mar 2008 09:16:23 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Benjamin Wolsey <bwy> 08/03/05 09:16:22
Modified files:
. : ChangeLog
libbase : rc.cpp rc.h
Log message:
* libbase/rc.{h,cpp}: const correct; clean up parsing, avoiding
an extra iteration at the expense of constructing
a stringstream; add warning on unrecognized commands; general
cleanup of other functions; drop ':' separator for lists,
which
has been deprecated for a while. Document functions.
Even with a massive rcfile there is no appreciable difference in
parsing speed, but it looks cleaner anyway.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5805&r2=1.5806
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/rc.cpp?cvsroot=gnash&r1=1.63&r2=1.64
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/rc.h?cvsroot=gnash&r1=1.46&r2=1.47
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.5805
retrieving revision 1.5806
diff -u -b -r1.5805 -r1.5806
--- ChangeLog 5 Mar 2008 03:55:48 -0000 1.5805
+++ ChangeLog 5 Mar 2008 09:16:20 -0000 1.5806
@@ -1,3 +1,11 @@
+2008-03-04 Benjamin Wolsey <address@hidden>
+
+ * libbase/rc.{h,cpp}: const correct; clean up parsing, avoiding
+ an extra iteration at the expense of constructing
+ a stringstream; add warning on unrecognized commands; general
+ cleanup of other functions; drop ':' separator for lists, which
+ has been deprecated for a while. Document functions.
+
2008-03-04 Bastiaan Jacques <address@hidden>
* all over the place: Remove $Id tags, because it has not been shown
Index: libbase/rc.cpp
===================================================================
RCS file: /sources/gnash/gnash/libbase/rc.cpp,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -b -r1.63 -r1.64
--- libbase/rc.cpp 20 Feb 2008 19:03:57 -0000 1.63
+++ libbase/rc.cpp 5 Mar 2008 09:16:22 -0000 1.64
@@ -35,7 +35,7 @@
#include <unistd.h> // for getuid()
#include <sys/stat.h>
#include <cerrno>
-#include <limits.h>
+#include <limits>
#include <cctype> // for toupper
#include <string>
@@ -100,8 +100,9 @@
_lctrace(true)
{
-// GNASH_REPORT_FUNCTION;
+
loadFiles();
+
#ifdef __OS2__x
_urlOpenerFormat = PrfQueryProfileString( HINI_USER, (PSZ)
"WPURLDEFAULTSETTINGS",
(PSZ) "DefaultBrowserExe", NULL,
@@ -114,14 +115,16 @@
RcInitFile::~RcInitFile()
{
-// GNASH_REPORT_FUNCTION;
}
// Look for a config file in the likely places.
-bool
+void
RcInitFile::loadFiles()
{
-// GNASH_REPORT_FUNCTION;
+// Note: This used to be bool but the return value was (a) never used
+// and (b) only returned true if a gnashrc set by environment variable
+// was successfully parsed. It seems we don't care whether a file
+// actually exists or not anyway.
// Check the default system location
std::string loadfile = "/etc/gnashrc";
@@ -143,39 +146,36 @@
char *gnashrc = getenv("GNASHRC");
if (gnashrc) {
loadfile = gnashrc;
- return parseFile(loadfile);
+ parseFile(loadfile);
}
-
- return false;
}
bool
-RcInitFile::extractSetting(bool *var, const char *pattern,
- std::string &variable, std::string &value)
+RcInitFile::extractSetting(bool &var, const std::string &pattern,
+ const std::string &variable, const std::string
&value)
{
-// GNASH_REPORT_FUNCTION;
- //cout << variable << ": " << value << endl;
StringNoCaseEqual noCaseCompare;
if ( noCaseCompare(variable, pattern) ) {
if ( noCaseCompare(value, "on") || noCaseCompare(value, "yes") ||
noCaseCompare(value, "true")) {
//cout << variable << ": enabled" << endl;
- *var = true;
+ var = true;
}
if (noCaseCompare(value, "off") || noCaseCompare(value, "no") ||
noCaseCompare(value, "false")) {
//cout << variable << ": disabled" << endl;
- *var = false;
+ var = false;
}
return true;
}
- else return false;
+
+ return false;
}
bool
-RcInitFile::extractNumber(boost::uint32_t *num, const char *pattern,
std::string &variable,
- std::string &value)
+RcInitFile::extractNumber(boost::uint32_t &num, const std::string &pattern,
+ const std::string &variable, const std::string
&value)
{
// GNASH_REPORT_FUNCTION;
@@ -183,28 +183,20 @@
// cout << variable << ": " << value << endl;
if ( noCaseCompare(variable, pattern) ) {
- *num = strtoul(value.c_str(), NULL, 0);
- if (*num == LONG_MAX) {
+ num = strtoul(value.c_str(), NULL, 0);
+ if (num == std::numeric_limits<long>::max()) {
long long foo = strtoll(value.c_str(), NULL, 0);
cerr << "RcInitFile::extractNumber: conversion overflow!: " << foo
<< endl;
-
}
return true;
}
- else return false;
-}
-/// Takes references to action ('set' or 'append'), items
-/// (list of items separated by spaces), listname (name of list)
-/// and the item array (list).
-//
-/// Returns either empty array ('set <list> off'), array with only
-/// passed items ('set <list> <items>') or array passed with items
-/// appended ('append <list> <items>').
+ return false;
+}
void
-RcInitFile::parseList(PathList &list, std::string &action,
- std::string &listname, std::string &items)
+RcInitFile::parseList(PathList &list, const std::string &action,
+ std::string &items)
{
// GNASH_REPORT_FUNCTION;
@@ -226,23 +218,9 @@
std::string::size_type pos;
- // This is an ugly way to avoid breaking lists
- // Lists will work if they worked before, but
- // combining the two separators will not.
- // The colon way must be removed before protocols
- // (http://, https:// can be included in lists).
- char separator;
- if (items.find(':') != std::string::npos) {
- // Deprecated behaviour
- separator = ':';
- fprintf(stderr, _("The list '%s' in an rcfile contains a colon. This is
deprecated and may result in "
- "unexpected behaviour. Please only use spaces as a
separator."), listname.c_str());
- } else {
- // New behaviour
- separator = ' ';
- }
+ const char separator = ' ';
- while (items.size()) {
+ while (!items.empty()) {
pos = items.find(separator, 0);
list.push_back(items.substr(0, pos));
items.erase(0, pos);
@@ -252,26 +230,23 @@
}
bool
-RcInitFile::extractDouble(double& out, const char *pattern, std::string
&variable,
- std::string &value)
+RcInitFile::extractDouble(double& out, const std::string &pattern,
+ const std::string &variable,
+ const std::string &value)
{
-// GNASH_REPORT_FUNCTION;
StringNoCaseEqual noCaseCompare;
- // printf("%s: %s\n", variable.c_str(), value.c_str());
-
if ( noCaseCompare(variable, pattern) ) {
out = strtod(value.c_str(), 0);
return true;
- //printf("strtod returned %g\n", out);
}
- else return false;
+
+ return false;
}
void
RcInitFile::expandPath (std::string& path)
-
{
// Leaves path unchanged on systems without
@@ -281,25 +256,25 @@
//Don't build tilde expansion on systems without pwd.h
//Only if path starts with "~"
- if (path.substr(0,1) == "~") {
- const char *home = getenv("HOME");
- if (path.substr(1,1) == "/") {
+ if (path[0] == '~') {
+
// Initial "~" followed by "/"
+ if (path.substr(1,1) == "/") {
+
+ const char *home = getenv("HOME");
if (home) {
// if HOME set in env, replace ~ with HOME
- path = path.replace(0,1,home);
+ path.replace(0, 1, home);
}
-# ifdef HAVE_GETPWNAM
-//Don't try this on systems without getpwnam
-
- //HOME not set in env: try using pwd
+# ifdef HAVE_GETPWNAM //Don't try this on systems without getpwnam
+ // HOME not found in env: try using pwd
else {
struct passwd *password = getpwuid(getuid());
const char *pwdhome = password->pw_dir;
if (home) {
- path = path.replace(0,1,pwdhome);
+ path.replace(0, 1, pwdhome);
}
//If all that fails, leave path alone
}
@@ -307,24 +282,24 @@
//Initial "~" is not followed by "/"
else {
- const char *userhome = NULL;
- std::string::size_type first_slash =
+
+ std::string::size_type firstslash =
path.find_first_of("/");
std::string user;
- if (first_slash != std::string::npos) {
+ if (firstslash != std::string::npos) {
// everything between initial ~ and /
- user = path.substr(1, first_slash - 1 );
- } else user = path.substr(1);
+ user = path.substr(1, firstslash - 1 );
+ }
+ else user = path.substr(1);
- //find user using pwd
+ // find user using pwd
+ const char *userhome = NULL;
struct passwd *password = getpwnam(user.c_str());
if (password) {
- //User found
userhome = password->pw_dir;
- }
if (userhome) {
- std::string foundhome(userhome);
- path = path.replace(0,first_slash,foundhome);
+ path.replace(0, firstslash, userhome);
+ }
}
# endif
}
@@ -334,7 +309,7 @@
}
void
-RcInitFile::writeList (PathList& list, std::ostream& o)
+RcInitFile::writeList (const PathList& list, std::ostream& o)
{
for (PathList::const_iterator it = list.begin();
it != list.end(); ++it) {
@@ -347,12 +322,13 @@
bool
RcInitFile::parseFile(const std::string& filespec)
{
-// GNASH_REPORT_FUNCTION;
+
struct stat stats;
std::string action;
std::string variable;
std::string value;
std::ifstream in;
+ std::string line;
StringNoCaseEqual noCaseCompare;
@@ -361,7 +337,8 @@
return false;
}
- if (stat(filespec.c_str(), &stats) == 0) {
+ if (stat(filespec.c_str(), &stats) != 0) return false;
+
in.open(filespec.c_str());
if (!in) {
@@ -372,32 +349,21 @@
cout << "RcInitFile: parsing " << filespec << endl;
// Read in each line and parse it
- while (!in.eof()) {
+ while (getline(in, line)) {
- // Make sure action is empty, otherwise the last loop (with no new
- // data) keeps action, variable and value from the previous loop.
This
- // causes problems if set blacklist or set whitelist are last,
because
- // value is erased while parsing and the lists are thus deleted.
- action.clear();
+ // Ignore comment lines
+ if (line[0] == '#') continue;
- // Get the first token
- in >> action;
+ std::istringstream ss(line);
- // Ignore comment lines
- if (action[0] == '#') {
- // suck up the rest of the line
- std::string discard;
- getline(in, discard);
- continue;
- }
+ // Get the first token
+ ss >> action;
// Get second token
- in >> variable;
+ ss >> variable;
- // cout << "Parsing " << variable << endl;
-
- // Read in rest of line for parsing.
- getline(in, value);
+ // The rest of the line is the value
+ if (!getline (ss, value)) continue;
// Erase leading spaces.
// If there are nothing but spaces in the value,
@@ -444,17 +410,17 @@
}
if (noCaseCompare(variable, "blacklist") ) {
- parseList(_blacklist, action, variable, value);
+ parseList(_blacklist, action, value);
continue;
}
if (noCaseCompare(variable, "whitelist")) {
- parseList(_whitelist, action, variable, value);
+ parseList(_whitelist, action, value);
continue;
}
if (noCaseCompare(variable, "localSandboxPath")) {
- parseList(_localSandboxPath, action, variable, value);
+ parseList(_localSandboxPath, action, value);
continue;
}
@@ -465,70 +431,64 @@
}
if (noCaseCompare(action , "set") ) {
- extractSetting(&_splashScreen, "splashScreen", variable,
+ extractSetting(_splashScreen, "splashScreen", variable,
value)
||
- extractSetting(&_localhostOnly, "localhost", variable,
+ extractSetting(_localhostOnly, "localhost", variable,
value)
||
- extractSetting(&_localdomainOnly, "localdomain", variable,
+ extractSetting(_localdomainOnly, "localdomain", variable,
value)
||
- extractSetting(&_insecureSSL, "InsecureSSL", variable,
+ extractSetting(_insecureSSL, "insecureSSL", variable,
value)
||
- extractSetting(&_debugger, "debugger", variable, value)
+ extractSetting(_debugger, "debugger", variable, value)
||
- extractSetting(&_actionDump, "actionDump", variable,
value)
+ extractSetting(_actionDump, "actionDump", variable, value)
||
- extractSetting(&_parserDump, "parserDump", variable,
value)
+ extractSetting(_parserDump, "parserDump", variable, value)
||
- extractSetting(&_writeLog, "writelog", variable, value)
+ extractSetting(_writeLog, "writelog", variable, value)
||
- extractSetting(&_sound, "sound", variable, value)
+ extractSetting(_sound, "sound", variable, value)
||
- extractSetting(&_pluginSound, "pluginsound", variable,
value)
+ extractSetting(_pluginSound, "pluginsound", variable, value)
||
- extractSetting(&_verboseASCodingErrors,
+ extractSetting(_verboseASCodingErrors,
"ASCodingErrorsVerbosity", variable, value)
||
- extractSetting(&_verboseMalformedSWF,
"MalformedSWFVerbosity",
+ extractSetting(_verboseMalformedSWF, "MalformedSWFVerbosity",
variable, value)
||
- extractSetting(&_extensionsEnabled, "EnableExtensions",
+ extractSetting(_extensionsEnabled, "EnableExtensions",
variable, value)
||
- extractSetting(&_startStopped, "StartStopped", variable,
value)
+ extractSetting(_startStopped, "StartStopped", variable, value)
||
- extractSetting(&_solreadonly, "SOLReadOnly", variable,
+ extractSetting(_solreadonly, "SOLReadOnly", variable,
value)
||
- extractSetting(&_lcdisabled, "LocalConnection", variable,
+ extractSetting(_lcdisabled, "LocalConnection", variable,
value)
||
- extractSetting(&_lctrace, "LCTrace", variable,
+ extractSetting(_lctrace, "LCTrace", variable,
value)
||
- extractNumber(&_movieLibraryLimit, "movieLibraryLimit",
variable, value)
+ extractNumber(_movieLibraryLimit, "movieLibraryLimit",
variable, value)
||
- extractNumber(&_delay, "delay", variable, value)
+ extractNumber(_delay, "delay", variable, value)
||
- extractNumber(&_verbosity, "verbosity", variable, value)
+ extractNumber(_verbosity, "verbosity", variable, value)
||
- extractNumber(&_lcshmkey, "LCShmkey", variable, value)
+ extractNumber(_lcshmkey, "LCShmkey", variable, value)
||
- extractDouble(_streamsTimeout, "StreamsTimeout",
variable, value);
-
- }
- }
+ extractDouble(_streamsTimeout, "StreamsTimeout", variable,
value)
+ ||
+ cerr << _("Warning: unrecognized directive \"") << variable
+ << _("\" in rcfile.") << endl;
}
-
- } else {
- //cout << filespec << ": no such file or directory" << endl;
- if (in) {
- in.close();
}
- return false;
}
if (in) {
@@ -594,7 +554,7 @@
// prefixed with '0x'.
out << std::boolalpha << std::showbase <<
_("# Generated by Gnash. Manual changes to this file may be overridden.")
<< endl <<
- cmd << "splash_screen " << _splashScreen << endl <<
+ cmd << "splashScreen " << _splashScreen << endl <<
cmd << "localHost " << _localhostOnly << endl <<
cmd << "localDomain " << _localdomainOnly << endl <<
cmd << "insecureSSL " << _insecureSSL << endl <<
@@ -714,8 +674,6 @@
void
RcInitFile::useWriteLog(bool value)
{
-// GNASH_REPORT_FUNCTION;
-
_writeLog = value;
}
@@ -723,8 +681,6 @@
RcInitFile::dump()
{
- using std::cerr;
-
cerr << endl << "Dump RcInitFile:" << endl;
cerr << "\tTimer interupt delay value: " << _delay << endl;
cerr << "\tFlash debugger: "
@@ -754,10 +710,12 @@
<< ((_pluginSound)?"enabled":"disabled") << endl;
cerr << "\tEnable Extensions: "
<< ((_extensionsEnabled)?"enabled":"disabled") << endl;
- if (_log.size()) {
+
+ if (!_log.empty()) {
cerr << "\tDebug Log name is: " << _log << endl;
}
- if (_flashVersionString.size()) {
+
+ if (!_flashVersionString.empty()) {
cerr << "\tFlash Version String is: " << _flashVersionString << endl;
}
Index: libbase/rc.h
===================================================================
RCS file: /sources/gnash/gnash/libbase/rc.h,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -b -r1.46 -r1.47
--- libbase/rc.h 20 Feb 2008 19:03:58 -0000 1.46
+++ libbase/rc.h 5 Mar 2008 09:16:22 -0000 1.47
@@ -37,22 +37,27 @@
{
public:
- // Return the default instance of RC file,
+ /// Return the default instance of RC file
static RcInitFile& getDefaultInstance();
- bool loadFiles();
+ /// Load and parse files, looking in the usual places
+ //
+ void loadFiles();
bool parseFile(const std::string& filespec);
+ /// \brief
/// Writes a valid gnashrc file. If the file already exists,
/// is is overwritten.
+ //
/// @param filespec the file to write
/// @return whether the file was successfully written.
bool updateFile(const std::string& filespec);
- /// Writes a gnashrc file to the file specified in the
+ /// \brief Writes a gnashrc file to the file specified in the
/// GNASHRC environment variable OR to the user's home
/// directory.
+ //
/// @return whether the file was successfully written.
bool updateFile();
@@ -85,7 +90,6 @@
/// Return true if user is willing to start the gui in "stop" mode
//
/// defaults to false.
- ///
bool startStopped() const { return _startStopped; }
void startStopped(bool value) { _startStopped = value; }
@@ -95,10 +99,10 @@
int verbosityLevel() const { return _verbosity; }
void verbosityLevel(int value) { _verbosity = value; }
- void setDebugLog(std::string &x) { _log = x; }
+ void setDebugLog(const std::string &x) { _log = x; }
const std::string& getDebugLog() const { return _log; }
- void setDocumentRoot(std::string &x) { _wwwroot = x; }
+ void setDocumentRoot(const std::string &x) { _wwwroot = x; }
std::string getDocumentRoot() { return _wwwroot; }
bool useDebugger() const { return _debugger; }
@@ -124,20 +128,24 @@
typedef std::vector<std::string> PathList;
/// Get the current RcInitFile whitelist of domains to allow
+ //
/// @return a std::vector of strings containing allowed domains
const PathList& getWhiteList() const { return _whitelist; }
/// Sets the RcInitFile whitelist of domains to allow
+ //
/// @param list a std::vector of strings containing domains without
protocol
- void setWhitelist (std::vector<std::string>& list) { _whitelist = list; }
+ void setWhitelist (const std::vector<std::string>& list) { _whitelist =
list; }
/// Get the current RcInitFile blacklist of domains to block
+ //
/// @return a std::vector of strings containing blocked domains
const PathList& getBlackList() const { return _blacklist; }
/// Sets the RcInitFile blacklist of domains to block
+ //
/// @param list a std::vector of strings containing domains without
protocol
- void setBlacklist (std::vector<std::string>& list) { _blacklist = list; }
+ void setBlacklist (const std::vector<std::string>& list) { _blacklist =
list; }
/// Return the list of directories to be used as the 'local' sandbox
//
@@ -155,6 +163,7 @@
/// Sets a list of sandbox paths. Gnash will only allow movies access
/// to files in these paths. The path of the movie playing is automatically
/// added.
+ //
/// @param list a std::vector of strings containing paths to allow
void setLocalSandboxPath(const PathList& path)
{
@@ -162,13 +171,13 @@
}
const std::string& getFlashVersionString() const { return
_flashVersionString; }
- void setFlashVersionString(std::string& value) { _flashVersionString =
value; }
+ void setFlashVersionString(const std::string& value) { _flashVersionString
= value; }
const std::string& getFlashSystemOS() const { return _flashSystemOS; }
- void setFlashSystemOS(std::string& value) { _flashSystemOS = value; }
+ void setFlashSystemOS(const std::string& value) { _flashSystemOS = value; }
const std::string& getFlashSystemManufacturer() const { return
_flashSystemManufacturer; }
- void setFlashSystemManufacturer(std::string& value) {
_flashSystemManufacturer = value; }
+ void setFlashSystemManufacturer(const std::string& value) {
_flashSystemManufacturer = value; }
const std::string& getGstAudioSink() const { return _gstaudiosink; }
void setGstAudioSink(const std::string& value) { _gstaudiosink = value; }
@@ -179,7 +188,7 @@
/// Return the number of seconds of inactivity before timing out streams
downloads
double getStreamsTimeout() const { return _streamsTimeout; }
/// Set the number of seconds of inactivity before timing out streams
downloads
- void setStreamsTimeout(double x) { _streamsTimeout = x; }
+ void setStreamsTimeout(const double &x) { _streamsTimeout = x; }
/// Get the URL opener command format
//
@@ -200,7 +209,7 @@
const std::string &getSOLSafeDir() const { return _solsandbox; }
// Set the location of the sandbox for .sol files
- void setSOLSafeDir(std::string &x) { _solsandbox = x; }
+ void setSOLSafeDir(const std::string &x) { _solsandbox = x; }
bool getSOLLocalDomain() const { return _sollocaldomain; }
void setSOLLocalDomain(bool x) { _sollocaldomain = x; }
@@ -232,7 +241,7 @@
/// Enable the Flash movie debugger
bool _debugger;
- // Level of debugging output
+ /// Level of debugging output
boost::uint32_t _verbosity;
/// Command format to use to open urls
@@ -248,12 +257,12 @@
/// String representing the first GStreamer audio output pipeline to try
std::string _gstaudiosink;
- /// String to pass as System.capabilities.os
+ /// \brief String to pass as System.capabilities.os
/// in Actionscript. If empty, leaves detection
/// to System.cpp (default).
std::string _flashSystemOS;
- /// String to pass as
+ /// \brief String to pass as
/// System.capabilities.manufacturer
/// in Actionscript
std::string _flashSystemManufacturer;
@@ -315,12 +324,12 @@
/// The number of seconds of inactivity triggering download timeout
double _streamsTimeout;
- /// Local sandbox: the set of resources on the filesystem we want to
- /// give the current movie access to.
+ /// \brief Local sandbox: the set of resources on the
+ /// filesystem we want to give the current movie access to.
PathList _localSandboxPath;
- // SOL Sandbox: This is the only dir .sol (Shared Object) files can be
written in,
- // or read from.
+ /// \brief SOL Sandbox: This is the only dir .sol (Shared Object)
+ /// files can be written in, or read from.
std::string _solsandbox;
/// Whether SOL files can be written
@@ -334,11 +343,11 @@
bool _lctrace;
/// Shared memory segment key (can be set for
- /// compatibility with other players.
+ /// compatibility with other players.)
boost::uint32_t _lcshmkey;
// A function only for writing path lists to an outstream.
- void writeList(PathList& list, std::ostream& o);
+ void writeList(const PathList& list, std::ostream& o);
protected:
@@ -348,38 +357,57 @@
/// Never destroy (TODO: add a destroyDefaultInstance)
~RcInitFile();
- /// Performs substitution on a path string (~)
+ /// Substitutes user's home directory for ~ on a path string
+ /// according to POSIX standard.
+ ///
+ /// @param path the path to expand.
void expandPath(std::string& path);
/// \brief
/// If variable matches pattern (case-insensitive)
- /// set *var according to value
+ /// set var according to value
//
- /// @return true if variable matches patter, false otherwise
- ///
- static bool extractSetting(bool *var, const char *pattern,
- std::string &variable, std::string &value);
+ /// @return true if variable matches pattern, false otherwise
+ /// @param var the variable to change
+ /// @param pattern the pattern for matching
+ /// @variable the variable to match to pattern
+ /// @value the value to adopt if variable matches pattern.
+ static bool extractSetting(bool &var, const std::string& pattern,
+ const std::string &variable, const std::string &value);
/// \brief
/// If variable matches pattern (case-insensitive)
- /// set *num according to value
+ /// set num according to value
//
- /// @return true if variable matches patter, false otherwise
- ///
- static bool extractNumber(boost::uint32_t *num, const char *pattern,
- std::string &variable, std::string &value);
+ /// @return true if variable matches pattern, false otherwise
+ /// @param num the variable to change
+ /// @param pattern the pattern for matching
+ /// @variable the variable to match to pattern
+ /// @value the value to adopt if variable matches pattern.
+ static bool extractNumber(boost::uint32_t &num, const std::string& pattern,
+ const std::string &variable, const std::string &value);
/// \brief
/// If variable matches pattern (case-insensitive)
/// set out according to value
//
- /// @return true if variable matches patter, false otherwise
- ///
- static bool extractDouble(double& out, const char *pattern,
- std::string &variable, std::string &value);
+ /// @return true if variable matches pattern, false otherwise
+ /// @param out the variable to change
+ /// @param pattern the pattern for matching
+ /// @variable the variable to match to pattern
+ /// @value the value to adopt if variable matches pattern.
+ static bool extractDouble(double &out, const std::string& pattern,
+ const std::string &variable, const std::string &value);
- void parseList(std::vector<std::string>& list, std::string &action,
- std::string &listname, std::string &items);
+
+ /// \brief parses a space-separated list into std::vector list
+ //
+ /// @param list the vector to modify or generate.
+ /// @param action either 'set' or 'append': whether to add to or
+ /// clear the vector.
+ /// @param items string of space-separated values. This gets nuked.
+ void parseList(std::vector<std::string>& list, const std::string &action,
+ std::string &items);
};
- [Gnash-commit] gnash ChangeLog libbase/rc.cpp libbase/rc.h,
Benjamin Wolsey <=