Remove dynamic exceptions
[anna.git] / source / diameter / stack / Avp.cpp
index 502745a..9bd2e24 100644 (file)
@@ -1,37 +1,9 @@
-// ANNA - Anna is Not Nothingness Anymore
-//
-// (c) Copyright 2005-2014 Eduardo Ramos Testillano & Francisco Ruiz Rayo
-//
-// http://redmine.teslayout.com/projects/anna-suite
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     *  Neither the name of the copyright holder nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Authors: eduardo.ramos.testillano@gmail.com
-//          cisco.tierra@gmail.com
+// ANNA - Anna is Not Nothingness Anymore                                                         //
+//                                                                                                //
+// (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo                         //
+//                                                                                                //
+// See project site at http://redmine.teslayout.com/projects/anna-suite                           //
+// See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
 
 
 // Includes propios
@@ -65,7 +37,7 @@ anna::diameter::stack::Avp::~Avp(void) {
 //------------------------------------------------------------------------------
 //--------------------------------------------------------------- Avp::isChild()
 //------------------------------------------------------------------------------
-bool anna::diameter::stack::Avp::isChild(const AvpId & avpId) const throw() {
+bool anna::diameter::stack::Avp::isChild(const AvpId & avpId) const {
   const Format * format = getFormat();
 
   if(!format->isGrouped()) return false;
@@ -81,7 +53,7 @@ bool anna::diameter::stack::Avp::isChild(const AvpId & avpId) const throw() {
 //------------------------------------------------------------------------------
 //--------------------------------------------------- Avp::getFlagsDescription()
 //------------------------------------------------------------------------------
-std::string anna::diameter::stack::Avp::getFlagsDescription(void) const throw() {
+std::string anna::diameter::stack::Avp::getFlagsDescription(void) const {
   std::string trace;
   trace += "V: "; trace += Avp::FlagRule::asText(a_vBit);
   trace += ", M: "; trace += Avp::FlagRule::asText(a_mBit);
@@ -93,7 +65,7 @@ std::string anna::diameter::stack::Avp::getFlagsDescription(void) const throw()
 //------------------------------------------------------------------------------
 //----------------------------------------------- Avp::getFlagRulesDescription()
 //------------------------------------------------------------------------------
-std::string anna::diameter::stack::Avp::getFlagRulesDescription(void) const throw() {
+std::string anna::diameter::stack::Avp::getFlagRulesDescription(void) const {
   std::string trace;
   // Flag Rules:
   std::string s_must, s_may, s_shouldnot, s_mustnot, s_mayEncypt;
@@ -150,7 +122,7 @@ std::string anna::diameter::stack::Avp::getFlagRulesDescription(void) const thro
 //------------------------------------------------------------------------------
 //------------------------------------------------------------- Avp::getFormat()
 //------------------------------------------------------------------------------
-const anna::diameter::stack::Format * anna::diameter::stack::Avp::getFormat() const throw() {
+const anna::diameter::stack::Format * anna::diameter::stack::Avp::getFormat() const {
   return a_dictionary->getFormat(a_formatName);
 }
 
@@ -158,7 +130,7 @@ const anna::diameter::stack::Format * anna::diameter::stack::Avp::getFormat() co
 //------------------------------------------------------------------------------
 //-------------------------------------------------------------- Avp::asString()
 //------------------------------------------------------------------------------
-std::string anna::diameter::stack::Avp::asString() const throw() {
+std::string anna::diameter::stack::Avp::asString() const {
   std::string trace;
   //trace = "Avp '";
   trace = "'";
@@ -184,7 +156,7 @@ std::string anna::diameter::stack::Avp::asString() const throw() {
       std::string qual = (*it).second.getQual();
       int NumberOfSpaces = strlen(DICTIONARY_AVPRULE_TAB) - qual.size();
 
-      for(register int k = 0; k < NumberOfSpaces; k++) trace += " ";
+      for(int k = 0; k < NumberOfSpaces; k++) trace += " ";
 
       trace += (*it).second.asString();
       trace += "\n";
@@ -210,7 +182,7 @@ std::string anna::diameter::stack::Avp::asString() const throw() {
 //------------------------------------------------------------------------------
 //-------------------------------------------------------------- Avp::addLabel()
 //------------------------------------------------------------------------------
-void anna::diameter::stack::Avp::addLabel(const std::string & data,  const std::string & alias) throw(anna::RuntimeException) {
+void anna::diameter::stack::Avp::addLabel(const std::string & data,  const std::string & alias) noexcept(false) {
   const Format * format = getFormat();
 
   if(format->isGrouped())
@@ -231,7 +203,7 @@ void anna::diameter::stack::Avp::addLabel(const std::string & data,  const std::
 //------------------------------------------------------------------------------
 //------------------------------------------------------------ Avp::addAvpRule()
 //------------------------------------------------------------------------------
-void anna::diameter::stack::Avp::addAvpRule(const AvpRule & avpRule) throw(anna::RuntimeException) {
+void anna::diameter::stack::Avp::addAvpRule(const AvpRule & avpRule) noexcept(false) {
   const Format * format = getFormat();
 
   if(format->isGrouped()) {
@@ -260,7 +232,7 @@ void anna::diameter::stack::Avp::addAvpRule(const AvpRule & avpRule) throw(anna:
 //------------------------------------------------------------------------------
 //----------------------------------------------------------------- Avp::asXML()
 //------------------------------------------------------------------------------
-anna::xml::Node* anna::diameter::stack::Avp::asXML(anna::xml::Node* parent) const throw() {
+anna::xml::Node* anna::diameter::stack::Avp::asXML(anna::xml::Node* parent) const {
 //   <!ELEMENT avp (single | grouped)>
 //   <!ATTLIST avp name CDATA #REQUIREDcode CDATA #REQUIRED vendor-name CDATA #IMPLIED may-encrypt (yes | no) #IMPLIED v-bit (must | may | shouldnot | mustnot) #IMPLIED m-bit (must | may | shouldnot | mustnot) #IMPLIED p-bit (must | may | shouldnot | mustnot) #IMPLIED>
 //   <!ELEMENT single (label*)>
@@ -294,7 +266,9 @@ anna::xml::Node* anna::diameter::stack::Avp::asXML(anna::xml::Node* parent) cons
     single->createAttribute("format-name", a_formatName);
 
     if(format->isEnumerated()) {
-      single->createAttribute("enum", getEnums());
+      std::string enums = getEnums();
+
+      if(enums != "") single->createAttribute("enum", enums);
     }
 
     if(hasAliases()) {