util/XmlQoSBase.cpp

Go to the documentation of this file.
00001 /*-----------------------------------------------------------------------------
00002 Name:      XmlQoSBase.cpp
00003 Project:   xmlBlaster.org
00004 Copyright: xmlBlaster.org, see xmlBlaster-LICENSE file
00005 Comment:   Handling one QoS (quality of service), knows how to parse it 
00006            with the implemented xml parser.
00007 -----------------------------------------------------------------------------*/
00008 
00009 #include <util/xmlBlasterDef.h>
00010 #include <util/XmlQoSBase.h>
00011 #include <string>
00012 #include <util/Global.h>
00013 #include <util/StringTrim.h>
00014 
00015 using namespace std;
00016 
00017 namespace org { namespace xmlBlaster { namespace util {
00018 
00019 XmlQoSBase::XmlQoSBase(Global& global) : XmlHandlerBase(global), ReferenceCounterBase()
00020 {
00021    inQos_ = false;
00022    if (log_.call()) log_.trace(me(), "Creating new XmlQoSBase");
00023 }
00024 
00025 bool XmlQoSBase::isEmpty(const string &qos) 
00026 {
00027    if (qos.empty()) return true;
00028    string trimHelper  = StringTrim::trim(qos);
00029    if (trimHelper.size() < 11) return true;
00030    
00031    string middle;
00032    middle.assign(qos, 5, qos.length()-6); // or minus 11 ???
00033    if (middle.size() < 1) return true;
00034    return false;
00035 }
00036 
00037 bool XmlQoSBase::startElementBase(const string &name, const parser::AttributeMap& /*attrs*/) 
00038 {
00039    if (name.compare("qos") == 0) {
00040       inQos_ = true;
00041       return true;
00042    }
00043    return false;
00044 }
00045 
00046 void XmlQoSBase::startElement(const string &name, const parser::AttributeMap &attrs) 
00047 {
00048    startElementBase(name, attrs);
00049 }
00050 
00051 bool XmlQoSBase::endElementBase(const string &name) 
00052 {
00053    if (name.compare("qos") == 0) {
00054       inQos_     = false;
00055       character_ = "";
00056       return true;
00057    }
00058    return false;
00059 }
00060 
00061 void XmlQoSBase::endElement(const string &name) 
00062 {
00063    endElementBase(name);
00064 }
00065 
00066 }}} // namespace