Remove dynamic exceptions
[anna.git] / include / anna / diameter / stack / Avp.hpp
index 1c2de1d..edd4e91 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 //
 
 
 #ifndef anna_diameter_stack_Avp_hpp
@@ -114,7 +86,7 @@ public:
     * @param v FlagRule type
     * @return FlagRule description
     */
-    static const char* asText(const FlagRule::_v v) throw(anna::RuntimeException) {
+    static const char* asText(const FlagRule::_v v) noexcept(false) {
       return asCString(v);
     }
   };
@@ -140,7 +112,7 @@ private:
   bool a_allowFixedRule;
   int a_avprulePosition;
 
-  void _initializeEnumsLabelsAndRules() throw() {
+  void _initializeEnumsLabelsAndRules() {
     a_enums.setLiteral("");
     a_labels.clear();
     a_avprules.clear();
@@ -148,7 +120,7 @@ private:
     a_avprulePosition = 0;
   }
 
-  void _initialize(const Dictionary *d) throw() {
+  void _initialize(const Dictionary *d) {
     a_dictionary = d;
     a_name = "";
     a_formatName = "";
@@ -167,77 +139,77 @@ public:
 
 
   // get
-  const AvpId & getId(void) const throw() { return a_id; }
-  const std::string & getName(void) const throw() { return a_name; }
-  const std::string & getFormatName(void) const throw() { return a_formatName; }
+  const AvpId & getId(void) const { return a_id; }
+  const std::string & getName(void) const { return a_name; }
+  const std::string & getFormatName(void) const { return a_formatName; }
 
-  const FlagRule::_v & getVbit(void) const throw() { return a_vBit; }
-  const FlagRule::_v & getMbit(void) const throw() { return a_mBit; }
-  const FlagRule::_v & getPbit(void) const throw() { return a_pBit; }
-  bool mayEncrypt(void) const throw() { return a_mayEncrypt; }
+  const FlagRule::_v & getVbit(void) const { return a_vBit; }
+  const FlagRule::_v & getMbit(void) const { return a_mBit; }
+  const FlagRule::_v & getPbit(void) const { return a_pBit; }
+  bool mayEncrypt(void) const { return a_mayEncrypt; }
 
-  const char * getEnums(void) const throw() { return a_enums.getLiteral(); }
-  const char * getAlias(const std::string data) const throw() {
+  const char * getEnums(void) const { return a_enums.getLiteral(); }
+  const char * getAlias(const std::string data) const {
     std::map<std::string, std::string>::const_iterator it = a_labels.find(data);
     return ((it != a_labels.end()) ? ((*it).second.c_str()) : NULL);
   }
 
   // containers
-  const_avprule_iterator avprule_begin() const throw() { return a_avprules.begin(); }
-  const_avprule_iterator avprule_end() const throw() { return a_avprules.end(); }
-  int avprule_size() const throw() { return a_avprules.size(); }
+  const_avprule_iterator avprule_begin() const { return a_avprules.begin(); }
+  const_avprule_iterator avprule_end() const { return a_avprules.end(); }
+  int avprule_size() const { return a_avprules.size(); }
 
-  const_label_iterator label_begin() const throw() { return a_labels.begin(); }
-  const_label_iterator label_end() const throw() { return a_labels.end(); }
-  int label_size() const throw() { return a_labels.size(); }
+  const_label_iterator label_begin() const { return a_labels.begin(); }
+  const_label_iterator label_end() const { return a_labels.end(); }
+  int label_size() const { return a_labels.size(); }
 
 
   // helpers
-  bool allowEnum(int value) const throw() { return a_enums.contain(value); }
-  bool hasAliases(void) const throw() { return (a_labels.size() != 0); }
-  bool isChild(const AvpId & avp) const throw();
-  std::string getFlagsDescription(void) const throw();
-  std::string getFlagRulesDescription(void) const throw();
-  const Format * getFormat() const throw();
+  bool allowEnum(int value) const { return a_enums.contain(value); }
+  bool hasAliases(void) const { return (a_labels.size() != 0); }
+  bool isChild(const AvpId & avp) const ;
+  std::string getFlagsDescription(void) const ;
+  std::string getFlagRulesDescription(void) const ;
+  const Format * getFormat() const ;
 
-  std::string asString(void) const throw();
-  anna::xml::Node* asXML(anna::xml::Node* parent) const throw();
+  std::string asString(void) const ;
+  anna::xml::Node* asXML(anna::xml::Node* parent) const ;
 
   // operators
 
   // set
-  void setCode(const S32 & c) throw(anna::RuntimeException) {
+  void setCode(const S32 & c) noexcept(false) {
     if(c < 0) throw anna::RuntimeException("Negative avp-code not allowed", ANNA_FILE_LOCATION);
 
     a_id.first = c;
   }
 
-  void setVendorId(const S32 & v) throw(anna::RuntimeException) {
+  void setVendorId(const S32 & v) noexcept(false) {
     if(v < 0) throw anna::RuntimeException("Negative vendor-id not allowed", ANNA_FILE_LOCATION);
 
     a_id.second = v;
   }
 
-  void setName(const std::string & n) throw(anna::RuntimeException) {
+  void setName(const std::string & n) noexcept(false) {
     if(n == "") throw anna::RuntimeException("Empty avp-name string not allowed", ANNA_FILE_LOCATION);
 
     a_name = n;
   }
 
-  void initialize(const Dictionary *d = NULL) throw() { _initialize(d); }
-  void setVendorName(const std::string & vn) throw() { a_vendorName = vn; }
-  void setFormatName(const std::string & fn) throw() { a_formatName = fn; }
-  void setVbit(const FlagRule::_v &v) throw() { a_vBit = v; }
-  void setMbit(const FlagRule::_v &m) throw() { a_mBit = m; }
-  void setPbit(const FlagRule::_v &p) throw() { a_pBit = p; } // deprecated flag ...
-  void setMayEncrypt(bool me) throw() { a_mayEncrypt = me; }
+  void initialize(const Dictionary *d = NULL) { _initialize(d); }
+  void setVendorName(const std::string & vn) { a_vendorName = vn; }
+  void setFormatName(const std::string & fn) { a_formatName = fn; }
+  void setVbit(const FlagRule::_v &v) { a_vBit = v; }
+  void setMbit(const FlagRule::_v &m) { a_mBit = m; }
+  void setPbit(const FlagRule::_v &p) { a_pBit = p; } // deprecated flag ...
+  void setMayEncrypt(bool me) { a_mayEncrypt = me; }
 
-  void setEnums(const char * e) throw() { a_enums.setLiteral(e); }
-  void addEnums(const char * e) throw() { a_enums.addLiteral(e); a_enums.simplifyLiteral(); }
+  void setEnums(const char * e) { a_enums.setLiteral(e); }
+  void addEnums(const char * e) { a_enums.addLiteral(e); a_enums.simplifyLiteral(); }
 
   // After format configuration:
-  void addLabel(const std::string & data,  const std::string & alias) throw(anna::RuntimeException);
-  void addAvpRule(const AvpRule & avpRule) throw(anna::RuntimeException);
+  void addLabel(const std::string & data,  const std::string & alias) noexcept(false);
+  void addAvpRule(const AvpRule & avpRule) noexcept(false);
 };