X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;f=source%2Fcore%2Futil%2FVariable.cpp;h=3145725f367c0795b969f79af4cbc06b3f091e79;hb=5a6cba5fde2b2f538a7515f8293cc0a8d9589dfa;hp=9f45178ce009e1497178f1bf751cf70e4ae32a69;hpb=5256cb543a9d35b610df19bd227cde977186aef0;p=anna.git diff --git a/source/core/util/Variable.cpp b/source/core/util/Variable.cpp index 9f45178..3145725 100644 --- a/source/core/util/Variable.cpp +++ b/source/core/util/Variable.cpp @@ -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 // #include @@ -82,35 +54,35 @@ Variable::~Variable() { } void Variable::setValue(const char* value) -throw(RuntimeException) { +noexcept(false) { verifyMatchType(Type::String, ANNA_FILE_LOCATION); a_isNull = false; *a_value.a_string = value; } void Variable::setValue(const int value) -throw(RuntimeException) { +noexcept(false) { verifyMatchType(Type::Integer, ANNA_FILE_LOCATION); a_isNull = false; *a_value.a_integer = value; } void Variable::setValue(const S64 value) -throw(RuntimeException) { +noexcept(false) { verifyMatchType(Type::Integer64, ANNA_FILE_LOCATION); a_isNull = false; *a_value.a_longInteger = value; } void Variable::setValue(const bool value) -throw(RuntimeException) { +noexcept(false) { verifyMatchType(Type::Boolean, ANNA_FILE_LOCATION); a_isNull = false; *a_value.a_boolean = value; } void Variable::setValue(const DataBlock& value) -throw(RuntimeException) { +noexcept(false) { verifyMatchType(Type::Block, ANNA_FILE_LOCATION); if(a_value.a_dataBlock->deepCopy() == false) { @@ -125,7 +97,7 @@ throw(RuntimeException) { } void Variable::setValue(const float value) -throw(RuntimeException) { +noexcept(false) { verifyMatchSomeType(Type::Float, Type::Double, ANNA_FILE_LOCATION); if(a_type == Type::Float) { @@ -138,7 +110,7 @@ throw(RuntimeException) { } void Variable::setValue(const double value) -throw(RuntimeException) { +noexcept(false) { verifyMatchSomeType(Type::Float, Type::Double, ANNA_FILE_LOCATION); if(a_type == Type::Float) { @@ -151,21 +123,21 @@ throw(RuntimeException) { } const char* Variable::getStringValue() const -throw(RuntimeException) { +noexcept(false) { verifyIsNotNull(ANNA_FILE_LOCATION); verifyMatchType(Type::String, ANNA_FILE_LOCATION); return a_value.a_string->c_str(); } int Variable::getIntegerValue() const -throw(RuntimeException) { +noexcept(false) { verifyIsNotNull(ANNA_FILE_LOCATION); verifyMatchType(Type::Integer, ANNA_FILE_LOCATION); return *a_value.a_integer; } S64 Variable::getInteger64Value() const -throw(RuntimeException) { +noexcept(false) { int result(0); verifyIsNotNull(ANNA_FILE_LOCATION); verifyMatchSomeType(Type::Integer, Type::Integer64, ANNA_FILE_LOCATION); @@ -180,21 +152,21 @@ throw(RuntimeException) { } bool Variable::getBooleanValue() const -throw(RuntimeException) { +noexcept(false) { verifyIsNotNull(ANNA_FILE_LOCATION); verifyMatchType(Type::Boolean, ANNA_FILE_LOCATION); return *a_value.a_boolean; } const DataBlock& Variable::getDataBlockValue() const -throw(RuntimeException) { +noexcept(false) { verifyIsNotNull(ANNA_FILE_LOCATION); verifyMatchType(Type::Block, ANNA_FILE_LOCATION); return *a_value.a_dataBlock; } float Variable::getFloatValue() const -throw(RuntimeException) { +noexcept(false) { float result(0.0); verifyIsNotNull(ANNA_FILE_LOCATION); verifyMatchSomeType(Type::Float, Type::Double, ANNA_FILE_LOCATION); @@ -209,7 +181,7 @@ throw(RuntimeException) { } double Variable::getDoubleValue() const -throw(RuntimeException) { +noexcept(false) { double result(0.0); verifyIsNotNull(ANNA_FILE_LOCATION); verifyMatchSomeType(Type::Float, Type::Double, ANNA_FILE_LOCATION); @@ -224,7 +196,7 @@ throw(RuntimeException) { } String Variable::asString() const -throw() { +{ String result("anna::Variable { Name: "); result << a_name; result << " | Type: " << Type::asNotNullCString(a_type); @@ -250,7 +222,7 @@ throw() { } void* Variable::buffer() const -throw() { +{ void* result(NULL); switch(a_type) { @@ -269,7 +241,7 @@ throw() { } void* Variable::getReference() const -throw() { +{ void* result(NULL); switch(a_type) { @@ -288,7 +260,7 @@ throw() { } void Variable::verifyMatchType(const Type::_v type, const char* file, const int lineno) const -throw(RuntimeException) { +noexcept(false) { if(a_type != type) { String msg("Variable: "); msg << a_name << " | " << Type::asNotNullCString(type) << " mismatch data type"; @@ -297,7 +269,7 @@ throw(RuntimeException) { } void Variable::verifyMatchSomeType(const Type::_v firstType, const Type::_v secondType, const char* file, const int lineno) const -throw(RuntimeException) { +noexcept(false) { if(a_type != firstType && a_type != secondType) { String msg("Variable: "); msg << a_name << " | Neihter " << Type::asNotNullCString(firstType); @@ -307,7 +279,7 @@ throw(RuntimeException) { } void Variable::verifyIsNotNull(const char* file, const int lineno) const -throw(RuntimeException) { +noexcept(false) { if(a_isNull == true) { String msg("Variable: "); msg << a_name << " | Variable does not have assigned value";