Thread: [Compbench-devel] CompBenchmarks++/libcompbenchmarks/UI UI-Console.cpp, 1.8, 1.9 UI-Console.h, 1.3,
Brought to you by:
xfred
From: Frederic T. <xf...@us...> - 2007-09-11 20:16:55
|
Update of /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/UI In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv20986 Modified Files: UI-Console.cpp UI-Console.h UI.cpp UI.h Log Message: Code from UI::Console moved to UI. Index: UI.h =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/UI/UI.h,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** UI.h 6 Sep 2007 17:38:36 -0000 1.16 --- UI.h 11 Sep 2007 20:16:51 -0000 1.17 *************** *** 39,42 **** --- 39,80 ---- protected: + /** Compute depth of a message. + * + * Returns the number of parents of a message + * \param _msg Message instance + * \return Number of parents for given message + */ + virtual int depth(UIMsg *_msg); + + + /** Get flags from a message. + * \param _msg Message instance + * \return Flags for the given message + */ + virtual UIMsg::Flags flags(UIMsg *_msg); + + + /** Get progress information on a message. + * \param _msg Message instance + * \return Progress (0 to 100.0) + */ + virtual float progress(UIMsg *_msg); + + /** Get action from a message. + * \param _msg Message instance + * \return Action for the given message + */ + virtual UIMsg::ActionType action(UIMsg *_msg); + + /** Get a field from a message. + * \param _msg Message instance + * \param _field Field to get + * \return Value of field in message + */ + virtual std::string objectField(UIMsg *_msg, + std::string _field); + + + /** \brief Internal method to post a message. * Index: UI.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/UI/UI.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** UI.cpp 24 Aug 2007 18:52:50 -0000 1.15 --- UI.cpp 11 Sep 2007 20:16:51 -0000 1.16 *************** *** 31,34 **** --- 31,111 ---- } + int UI::depth(UIMsg *_msg) + { + int d = 0; + + while ((_msg) && (_msg->getParent())) { + _msg=(UIMsg*)_msg->getParent()->getParent(); + if ((UO_verbose==CBM::All) || + (action(_msg)!=UIMsg::ShellCommand)) + d++; + } + + return(d); + } + + UIMsg::Flags UI::flags(UIMsg *_msg) + { + XMLAttribute *A = _msg->getAttribute("flags"); + + if (A->Value()=="Progress") + return(UIMsg::Progress); + else + return(UIMsg::NoProgress); + } + + float UI::progress(UIMsg *_msg) + { + XMLNode *N = _msg->getNode("progress"); + XMLAttribute *A; + + if (!N) + return(0.0f); + + A=N->getAttribute("value"); + + if (!A) + return(0.0f); + + return((float)atof(A->Value().c_str())); + } + + UIMsg::ActionType UI::action(UIMsg *_msg) + { + XMLNode *N = _msg->getNode("action"); + XMLAttribute *A; + UIMsg::ActionType r; + + if (!N) + return(UIMsg::UndefAction); + + + A=N->getAttribute("type"); + if (!A) + return(UIMsg::UndefAction); + + r=(UIMsg::ActionType)atoi(A->Value().c_str()); + + return(r); + } + + std::string UI::objectField(UIMsg *_msg, + std::string _field) + { + XMLNode *N = _msg->getNode("object"); + XMLAttribute *A; + + if (!N) + return(""); + + + A=N->getAttribute(_field); + if (!A) + return(""); + + return(A->Value()); + } + + UIMsg *UI::currentMsg(void) { Index: UI-Console.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/UI/UI-Console.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** UI-Console.cpp 10 Sep 2007 16:42:19 -0000 1.8 --- UI-Console.cpp 11 Sep 2007 20:16:51 -0000 1.9 *************** *** 30,109 **** } - int UIConsole::depth(UIMsg *_msg) - { - int d = 0; - - while ((_msg) && (_msg->getParent())) { - _msg=(UIMsg*)_msg->getParent()->getParent(); - if ((UO_verbose==CBM::All) || - (action(_msg)!=UIMsg::ShellCommand)) - d++; - } - - return(d); - } - - UIMsg::Flags UIConsole::flags(UIMsg *_msg) - { - XMLAttribute *A = _msg->getAttribute("flags"); - - if (A->Value()=="Progress") - return(UIMsg::Progress); - else - return(UIMsg::NoProgress); - } - - float UIConsole::progress(UIMsg *_msg) - { - XMLNode *N = _msg->getNode("progress"); - XMLAttribute *A; - - if (!N) - return(0.0f); - - A=N->getAttribute("value"); - - if (!A) - return(0.0f); - - return((float)atof(A->Value().c_str())); - } - - UIMsg::ActionType UIConsole::action(UIMsg *_msg) - { - XMLNode *N = _msg->getNode("action"); - XMLAttribute *A; - UIMsg::ActionType r; - - if (!N) - return(UIMsg::UndefAction); - - - A=N->getAttribute("type"); - if (!A) - return(UIMsg::UndefAction); - - r=(UIMsg::ActionType)atoi(A->Value().c_str()); - - return(r); - } - - std::string UIConsole::objectField(UIMsg *_msg, - std::string _field) - { - XMLNode *N = _msg->getNode("object"); - XMLAttribute *A; - - if (!N) - return(""); - - - A=N->getAttribute(_field); - if (!A) - return(""); - - return(A->Value()); - } - int UIConsole::childNumber(UIMsg *_msg) { --- 30,33 ---- Index: UI-Console.h =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/UI/UI-Console.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** UI-Console.h 9 Sep 2007 18:21:19 -0000 1.3 --- UI-Console.h 11 Sep 2007 20:16:51 -0000 1.4 *************** *** 31,68 **** virtual void LF(void); protected: - /** Compute depth of a message. - * - * Returns the number of parents of a message - * \param _msg Message instance - * \return Number of parents for given message - */ - virtual int depth(UIMsg *_msg); - - /** Get flags from a message. - * \param _msg Message instance - * \return Flags for the given message - */ - virtual UIMsg::Flags flags(UIMsg *_msg); - - /** Get progress information on a message. - * \param _msg Message instance - * \return Progress (0 to 100.0) - */ - virtual float progress(UIMsg *_msg); - - /** Get action from a message. - * \param _msg Message instance - * \return Action for the given message - */ - virtual UIMsg::ActionType action(UIMsg *_msg); - - /** Get a field from a message. - * \param _msg Message instance - * \param _field Field to get - * \return Value of field in message - */ - virtual std::string objectField(UIMsg *_msg, - std::string _field); - /** Get message's child number. * \param _msg Message instance --- 31,34 ---- |