From fca1bc1a334b0d4bd3b3d74e7dce2368c47435ef Mon Sep 17 00:00:00 2001 From: Tomasz Sowa Date: Thu, 2 Apr 2009 05:21:49 +0000 Subject: [PATCH] added: Objects::IsDefined(const std::string & name) returning true if such an object is defined git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@117 e52654a7-88a9-db11-a3e9-0013d4bc506e --- ttmath/ttmathint.h | 2 +- ttmath/ttmathobjects.h | 23 +++++++++++++++++++---- ttmath/ttmathparser.h | 2 +- ttmath/ttmathuint.h | 2 +- 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/ttmath/ttmathint.h b/ttmath/ttmathint.h index 70cc1db..2d140e6 100644 --- a/ttmath/ttmathint.h +++ b/ttmath/ttmathint.h @@ -901,7 +901,7 @@ public: existing first white characters will be ommited (between '-' and a first digit can be white characters too) - after_source (if exists) is pointing at the end of the parsing string + after_source (if exists) is pointing at the end of the parsed string value_read (if exists) tells whether something has actually been read (at least one digit) */ diff --git a/ttmath/ttmathobjects.h b/ttmath/ttmathobjects.h index f603b13..52acf9c 100644 --- a/ttmath/ttmathobjects.h +++ b/ttmath/ttmathobjects.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2006-2008, Tomasz Sowa + * Copyright (c) 2006-2009, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -130,6 +130,21 @@ public: } + /*! + this method returns true if such an object is defined (name exists) + */ + bool IsDefined(const std::string & name) + { + Iterator i = table.find(name); + + if( i != table.end() ) + // we have this object in our table + return true; + + return false; + } + + /*! this method adds one object (variable of function) into the table */ @@ -258,7 +273,7 @@ public: /*! - this method sets the value of a specific object + this method gets the value of a specific object */ ErrorCode GetValue(const std::string & name, std::string & value) const { @@ -280,7 +295,7 @@ public: /*! - this method sets the value of a specific object + this method gets the value of a specific object (this version is used for not copying the whole string) */ ErrorCode GetValue(const std::string & name, const char ** value) const @@ -303,7 +318,7 @@ public: /*! - this method sets the value and the number of parameters + this method gets the value and the number of parameters of a specific object */ ErrorCode GetValueAndParam(const std::string & name, std::string & value, int * param) const diff --git a/ttmath/ttmathparser.h b/ttmath/ttmathparser.h index 3f36fa7..ac52542 100644 --- a/ttmath/ttmathparser.h +++ b/ttmath/ttmathparser.h @@ -97,7 +97,7 @@ namespace ttmath etc. Value can be: - constant e.g. 100, can be preceded by operators to change the base (radix): [#|&] + constant e.g. 100, can be preceded by operators for changing the base (radix): [#|&] # - hex & - bin sample: #10 = 16 diff --git a/ttmath/ttmathuint.h b/ttmath/ttmathuint.h index 8a17ecd..394d7df 100644 --- a/ttmath/ttmathuint.h +++ b/ttmath/ttmathuint.h @@ -3201,7 +3201,7 @@ public: if the value from s is too large the rest digits will be skipped - after_source (if exists) is pointing at the end of the parsing string + after_source (if exists) is pointing at the end of the parsed string value_read (if exists) tells whether something has actually been read (at least one digit) */