[Aptitude-svn-commit] r3271 - in branches/aptitude-0.3/aptitude: . src/vscreen/config
Daniel Burrows
dburrows@costa.debian.org
Sun, 08 May 2005 13:02:16 +0000
Author: dburrows
Date: Sun May 8 13:02:13 2005
New Revision: 3271
Modified:
branches/aptitude-0.3/aptitude/ChangeLog
branches/aptitude-0.3/aptitude/src/vscreen/config/style.cc
branches/aptitude-0.3/aptitude/src/vscreen/config/style.h
Log:
Don't throw an exception...
Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog (original)
+++ branches/aptitude-0.3/aptitude/ChangeLog Sun May 8 13:02:13 2005
@@ -2,6 +2,13 @@
* src/vscreen/config/style.cc, src/vscreen/config/style.h:
+ Cancel that; instead, just return a 'null' style. I'd like to
+ have unknown styles blow up, but that has other problems
+ (especially when the user is allowed to create screen regions and
+ specify their styles).
+
+ * src/vscreen/config/style.cc, src/vscreen/config/style.h:
+
Throw an exception if a style is missing, rather than just
silently creating a new style.
Modified: branches/aptitude-0.3/aptitude/src/vscreen/config/style.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/vscreen/config/style.cc (original)
+++ branches/aptitude-0.3/aptitude/src/vscreen/config/style.cc Sun May 8 13:02:13 2005
@@ -28,10 +28,11 @@
const style &get_style(const std::string &name)
{
+ static style null_style;
map<string, style>::const_iterator found=styles.find(name);
if(found == styles.end())
- throw NoSuchStyle(name);
+ return null_style;
else
return found->second;
}
Modified: branches/aptitude-0.3/aptitude/src/vscreen/config/style.h
==============================================================================
--- branches/aptitude-0.3/aptitude/src/vscreen/config/style.h (original)
+++ branches/aptitude-0.3/aptitude/src/vscreen/config/style.h Sun May 8 13:02:13 2005
@@ -24,16 +24,6 @@
#include <string>
-/** Exception thrown if a style lookup fails. */
-class NoSuchStyle
-{
- std::string name;
-public:
- NoSuchStyle(const std::string &_name):name(_name) {}
-
- std::string get_name() {return name;}
-};
-
/** A "style" is a setting to be applied to a display element (widget,
* text, etc). This means color (foreground and background) and
* attributes. A style may contain settings for any or all of these;