- remove dependencies on sg_throwable::clone
This commit is contained in:
+14
-10
@@ -43,9 +43,9 @@ class PropsVisitor : public XMLVisitor
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
PropsVisitor (SGPropertyNode * root, const string &base)
|
PropsVisitor (SGPropertyNode * root, const string &base)
|
||||||
: _root(root), _level(0), _base(base), _exception(0) {}
|
: _root(root), _level(0), _base(base), _hasException(false) {}
|
||||||
|
|
||||||
virtual ~PropsVisitor () { delete _exception; }
|
virtual ~PropsVisitor () {}
|
||||||
|
|
||||||
void startXML ();
|
void startXML ();
|
||||||
void endXML ();
|
void endXML ();
|
||||||
@@ -54,8 +54,12 @@ public:
|
|||||||
void data (const char * s, int length);
|
void data (const char * s, int length);
|
||||||
void warning (const char * message, int line, int column);
|
void warning (const char * message, int line, int column);
|
||||||
|
|
||||||
bool hasException () const { return (_exception != 0); }
|
bool hasException () const { return _hasException; }
|
||||||
const sg_io_exception * getException () const { return _exception; }
|
sg_io_exception &getException () { return _exception; }
|
||||||
|
void setException (const sg_io_exception &exception) {
|
||||||
|
_exception = exception;
|
||||||
|
_hasException = true;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@@ -91,7 +95,8 @@ private:
|
|||||||
int _level;
|
int _level;
|
||||||
vector<State> _state_stack;
|
vector<State> _state_stack;
|
||||||
string _base;
|
string _base;
|
||||||
sg_io_exception * _exception;
|
sg_io_exception _exception;
|
||||||
|
bool _hasException;
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -191,9 +196,8 @@ PropsVisitor::startElement (const char * name, const XMLAttributes &atts)
|
|||||||
path.append(attval);
|
path.append(attval);
|
||||||
try {
|
try {
|
||||||
readProperties(path.str(), node);
|
readProperties(path.str(), node);
|
||||||
} catch (const sg_io_exception &t) {
|
} catch (sg_io_exception &e) {
|
||||||
cerr << "Caught exception\n";
|
setException(e);
|
||||||
_exception = t.clone();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -284,7 +288,7 @@ readProperties (istream &input, SGPropertyNode * start_node,
|
|||||||
PropsVisitor visitor(start_node, base);
|
PropsVisitor visitor(start_node, base);
|
||||||
readXML(input, visitor, base);
|
readXML(input, visitor, base);
|
||||||
if (visitor.hasException())
|
if (visitor.hasException())
|
||||||
throw *(visitor.getException());
|
throw visitor.getException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -301,7 +305,7 @@ readProperties (const string &file, SGPropertyNode * start_node)
|
|||||||
PropsVisitor visitor(start_node, file);
|
PropsVisitor visitor(start_node, file);
|
||||||
readXML(file, visitor);
|
readXML(file, visitor);
|
||||||
if (visitor.hasException())
|
if (visitor.hasException())
|
||||||
throw *(visitor.getException());
|
throw visitor.getException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user