diff options
author | Danny Baumann <dannybaumann@web.de> | 2008-10-13 11:42:07 +0200 |
---|---|---|
committer | Danny Baumann <dannybaumann@web.de> | 2008-10-13 11:42:07 +0200 |
commit | 5b71849f2a59bc9c6f05444c024d0771b2b187f0 (patch) | |
tree | ed095a64a1a80359124e7a63afce7771403a0d29 /src/action.cpp | |
parent | c4fdbc30f3ed3286dc9017633eb7e755a598d724 (diff) | |
download | unity-window-decorator-5b71849f2a59bc9c6f05444c024d0771b2b187f0.tar.gz unity-window-decorator-5b71849f2a59bc9c6f05444c024d0771b2b187f0.tar.bz2 |
Make CompAction *FromString functions return the information whether the conversion was successful or not.
Diffstat (limited to 'src/action.cpp')
-rw-r--r-- | src/action.cpp | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/src/action.cpp b/src/action.cpp index ea94e48..fc672ff 100644 --- a/src/action.cpp +++ b/src/action.cpp @@ -147,7 +147,7 @@ CompAction::KeyBinding::keycode () } bool -CompAction::KeyBinding::fromString (const CompString str) +CompAction::KeyBinding::fromString (const CompString &str) { CompString sStr; unsigned int mods; @@ -262,7 +262,7 @@ CompAction::ButtonBinding::button () } bool -CompAction::ButtonBinding::fromString (const CompString str) +CompAction::ButtonBinding::fromString (const CompString &str) { unsigned int mods; size_t pos; @@ -442,19 +442,25 @@ CompAction::operator= (const CompAction &action) return *this; } -void -CompAction::keyFromString (const CompString str) +bool +CompAction::keyFromString (const CompString &str) { - if (priv->key.fromString (str)) + bool retval = priv->key.fromString (str); + + if (retval) priv->type = CompAction::BindingTypeKey; else priv->type = CompAction::BindingTypeNone; + + return retval; } -void -CompAction::buttonFromString (const CompString str) +bool +CompAction::buttonFromString (const CompString &str) { - if (priv->button.fromString (str)) + bool retval = priv->button.fromString (str); + + if (retval) { priv->edgeMask = bindingStringToEdgeMask (str); if (priv->edgeMask) @@ -466,10 +472,12 @@ CompAction::buttonFromString (const CompString str) { priv->type = CompAction::BindingTypeNone; } + + return retval; } -void -CompAction::edgeMaskFromString (const CompString str) +bool +CompAction::edgeMaskFromString (const CompString &str) { unsigned int edgeMask = 0; size_t pos; @@ -495,6 +503,8 @@ CompAction::edgeMaskFromString (const CompString str) } priv->edgeMask = edgeMask; + + return (edgeMask != 0 || str.empty ()); } CompString |