diff options
author | Mike Buland <eichlan@xagasoft.com> | 2009-01-15 07:01:02 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2009-01-15 07:01:02 +0000 |
commit | 46f2f8c2962532e010fcb4e3492ce97e2216fb0e (patch) | |
tree | 4b8b04bb10484e0bc23845d332a518455bcdbbc1 /src/tafnode.cpp | |
parent | 422a09d330d15f90c854dcc1001a544ffd4b4967 (diff) | |
download | libbu++-46f2f8c2962532e010fcb4e3492ce97e2216fb0e.tar.gz libbu++-46f2f8c2962532e010fcb4e3492ce97e2216fb0e.tar.bz2 libbu++-46f2f8c2962532e010fcb4e3492ce97e2216fb0e.tar.xz libbu++-46f2f8c2962532e010fcb4e3492ce97e2216fb0e.zip |
Fixed a minor suggestion in Bu::Socket, gcc wanted more parenthesies to make a
statement clearer (good coding guide).
Made the Taf code getters report their own errors, so much nicer. They actually
tell you what was looked for from where and that it couldn't be found instead of
a horrible old Bu::HashException key not found error.
Diffstat (limited to '')
-rw-r--r-- | src/tafnode.cpp | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/src/tafnode.cpp b/src/tafnode.cpp index 829a8e1..09fc21b 100644 --- a/src/tafnode.cpp +++ b/src/tafnode.cpp | |||
@@ -111,7 +111,13 @@ bool Bu::TafGroup::hasChild( const Bu::FString &sName ) const | |||
111 | 111 | ||
112 | const Bu::TafGroup::GroupList &Bu::TafGroup::getChildren( const Bu::FString &sName ) const | 112 | const Bu::TafGroup::GroupList &Bu::TafGroup::getChildren( const Bu::FString &sName ) const |
113 | { | 113 | { |
114 | return hChildren.get( sName ); | 114 | try { |
115 | return hChildren.get( sName ); | ||
116 | } catch( Bu::HashException &e ) | ||
117 | { | ||
118 | throw Bu::TafException("No children of group \"%s\" match \"%s\".", | ||
119 | this->sName.getStr(), sName.getStr() ); | ||
120 | } | ||
115 | } | 121 | } |
116 | 122 | ||
117 | const Bu::TafGroup::NodeList &Bu::TafGroup::getChildren() const | 123 | const Bu::TafGroup::NodeList &Bu::TafGroup::getChildren() const |
@@ -121,7 +127,13 @@ const Bu::TafGroup::NodeList &Bu::TafGroup::getChildren() const | |||
121 | 127 | ||
122 | const Bu::TafGroup *Bu::TafGroup::getChild( const Bu::FString &sName ) const | 128 | const Bu::TafGroup *Bu::TafGroup::getChild( const Bu::FString &sName ) const |
123 | { | 129 | { |
124 | return hChildren.get( sName ).first(); | 130 | try { |
131 | return hChildren.get( sName ).first(); | ||
132 | } catch( Bu::HashException &e ) | ||
133 | { | ||
134 | throw Bu::TafException("No children of group \"%s\" match \"%s\".", | ||
135 | this->sName.getStr(), sName.getStr() ); | ||
136 | } | ||
125 | } | 137 | } |
126 | 138 | ||
127 | bool Bu::TafGroup::hasProperty( const Bu::FString &sName ) const | 139 | bool Bu::TafGroup::hasProperty( const Bu::FString &sName ) const |
@@ -131,12 +143,24 @@ bool Bu::TafGroup::hasProperty( const Bu::FString &sName ) const | |||
131 | 143 | ||
132 | const Bu::TafGroup::PropList &Bu::TafGroup::getProperties( const Bu::FString &sName ) const | 144 | const Bu::TafGroup::PropList &Bu::TafGroup::getProperties( const Bu::FString &sName ) const |
133 | { | 145 | { |
134 | return hProp.get( sName ); | 146 | try { |
147 | return hProp.get( sName ); | ||
148 | } catch( Bu::HashException &e ) | ||
149 | { | ||
150 | throw Bu::TafException("No properties of group \"%s\" match \"%s\".", | ||
151 | this->sName.getStr(), sName.getStr() ); | ||
152 | } | ||
135 | } | 153 | } |
136 | 154 | ||
137 | const Bu::FString &Bu::TafGroup::getProperty( const Bu::FString &sName ) const | 155 | const Bu::FString &Bu::TafGroup::getProperty( const Bu::FString &sName ) const |
138 | { | 156 | { |
139 | return hProp.get( sName ).first(); | 157 | try { |
158 | return hProp.get( sName ).first(); | ||
159 | } catch( Bu::HashException &e ) | ||
160 | { | ||
161 | throw Bu::TafException("No properties of group \"%s\" match \"%s\".", | ||
162 | this->sName.getStr(), sName.getStr() ); | ||
163 | } | ||
140 | } | 164 | } |
141 | 165 | ||
142 | const Bu::FString &Bu::TafGroup::getProperty( const Bu::FString &sName, | 166 | const Bu::FString &Bu::TafGroup::getProperty( const Bu::FString &sName, |