You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
(84) |
Apr
(41) |
May
(8) |
Jun
|
Jul
(85) |
Aug
(81) |
Sep
|
Oct
(4) |
Nov
(6) |
Dec
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(3) |
Aug
(8) |
Sep
|
Oct
|
Nov
|
Dec
(7) |
Update of /cvsroot/libais/libaisutil/include/aisutil/config In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14591/include/aisutil/config Added Files: config.h definitions.h errors.h handler.h seg-handler.h var-handler.h Removed Files: data.h parser.h Log Message: Initial updates for the new configuration parser - WILL NOT COMPLETELY BUILD!! Major architectural changes here!! Yes, it's new years -- HAPPY NEW 2005!!! :) --- NEW FILE: config.h --- /* $Id: config.h,v 1.1 2004/12/31 22:58:06 pickle Exp $ * * Copyright (c) 2002,2003,2004 Alien Internet Services * * This file is a part of LibAISutil. * * LibAISutil is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * LibAISutil is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with LibAISutil; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _INCLUDE_LIBAISUTIL_CONFIG_DATA_H_ # define _INCLUDE_LIBAISUTIL_CONFIG_DATA_H_ 1 # include <aisutil/config/definitions.h> # include <aisutil/config/errors.h> namespace AIS { namespace Util { namespace Config { /*! * \brief Configuration data class * * This is the configuration data class, used to store your * configuration data for use primarily during program run-time. */ class Config { private: //! Definitions table, which is bound to data held in this class const defTable_ptr definitions; //! Error reporting mechanism ErrorReporter* const errorReporter; protected: /*! * \brief Default constructor * */ Config(const defTable_ptr _definitions, ErrorReporter* const _errorReporter = 0) : definitions(_definitions), errorReporter(_errorReporter) {}; public: //! Destructor virtual ~Config(void) {}; }; // class Config }; // namespace Config }; // namespace Util }; // namespace AIS #endif // _INCLUDE_LIBAISUTIL_CONFIG_DATA_H_ --- NEW FILE: var-handler.h --- /* $Id: var-handler.h,v 1.1 2004/12/31 22:58:06 pickle Exp $ * * Copyright (c) 2004 Alien Internet Services * * This file is a part of LibAISutil. * * LibAISutil is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * LibAISutil is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with LibAISutil; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _INCLUDE_LIBAISUTIL_CONFIG_VAR_HANDLER_H_ # define _INCLUDE_LIBAISUTIL_CONFIG_VAR_HANDLER_H_ 1 # include <aisutil/config/handler.h> namespace AIS { namespace Util { namespace Config { /*! * \brief Configuration data variable handler functoid base class * * This functoid is designed for variables. If you have a particular * type of data in your data class that this library does not have * a handler for, you will be wanting to create your own handler by * making a new functoid class inheriting from this base class. * * When the configuration parser hits a definition it recognises, * it gathers up the data defined in the configuration file and * passes it on to the handling functoid defined in the definition * tables for that particular configuration segment. * * Armed with all the information you need to process the data * given in the configuration file, you can do what you need with * it (convert it, munge it, send it to extraterrestrial life forms * for probing) and feed the appropriate value into the variable * pointed to by the variable pointer. */ class VariableHandler : public Handler { protected: //! Default constructor VariableHandler(void) {}; public: //! Destructor virtual ~VariableHandler(void) {}; private: //! Process function virtual const bool process(void) = 0; //! Validity function virtual const bool check(void) const { return true; /* Presume OK */ }; public: //! The handler virtual const bool handle(void) { return false; /* !!! */ }; }; // class VariableHandler }; // namespace Config }; // namespace Util }; // namespace AIS #endif // _INCLUDE_LIBAISUTIL_CONFIG_VAR_HANDLER_H_ --- NEW FILE: errors.h --- /* $Id: errors.h,v 1.1 2004/12/31 22:58:06 pickle Exp $ * * Copyright (c) 2004 Alien Internet Services * * This file is a part of LibAISutil. * * LibAISutil is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * LibAISutil is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with LibAISutil; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _INCLUDE_LIBAISUTIL_CONFIG_ERRORS_H_ # define _INCLUDE_LIBAISUTIL_CONFIG_ERRORS_H_ 1 # include <string> namespace AIS { namespace Util { namespace Config { //! List of errors namespace Errors { enum errorCode_type { Informational = 0x0000, //!< Informational notice (not error) OutOfRange = 0x0100, //!< Out of range error BelowRange = 0x0101, //!< Out of range: Below minimum AboveRange = 0x0102, //!< Out of range: Above minimum UnknownError = 0xFFFF //!< Unknown error }; }; /*! * \brief Error handler functoid * */ class ErrorReporter { protected: //! Default constructor ErrorReporter(void) {}; public: //! Destructor virtual ~ErrorReporter(void) {}; //! Reporting mechanism virtual void report(const unsigned int LineNumber, const Errors::errorCode_type errorCode, const std::string& report) {}; }; // class ErrorReporter }; // namespace Config }; // namespace Util }; // namespace AIS #endif // _INCLUDE_LIBAISUTIL_CONFIG_ERRORS_H_ --- NEW FILE: handler.h --- /* $Id: handler.h,v 1.1 2004/12/31 22:58:06 pickle Exp $ * * Copyright (c) 2004 Alien Internet Services * * This file is a part of LibAISutil. * * LibAISutil is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * LibAISutil is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with LibAISutil; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _INCLUDE_LIBAISUTIL_CONFIG_HANDLER_H_ # define _INCLUDE_LIBAISUTIL_CONFIG_HANDLER_H_ 1 namespace AIS { namespace Util { namespace Config { /*! * \brief Configuration data handler functoid base class * */ class Handler { protected: //! Default constructor Handler(void) {}; public: //! Destructor virtual ~Handler(void) {}; }; // class Handler }; // namespace Config }; // namespace Util }; // namespace AIS #endif // _INCLUDE_LIBAISUTIL_CONFIG_HANDLER_H_ --- parser.h DELETED --- --- data.h DELETED --- --- NEW FILE: definitions.h --- /* $Id: definitions.h,v 1.1 2004/12/31 22:58:06 pickle Exp $ * * Copyright (c) 2002,2003,2004 Alien Internet Services * * This file is a part of LibAISutil. * * LibAISutil is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * LibAISutil is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with LibAISutil; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _INCLUDE_LIBAISUTIL_CONFIG_DEFINITIONS_H_ # define _INCLUDE_LIBAISUTIL_CONFIG_DEFINITIONS_H_ 1 # include <aisutil/config/var-handler.h> # include <aisutil/config/seg-handler.h> namespace AIS { namespace Util { namespace Config { // Forward declaration of the Definition structure for typedefs struct Definition; /*! * \brief A table of definitions * * This is a type definition for a table of configuration file * definitions, used to provide a complete picture of which labels * apply to what data within the data segment. */ typedef Definition defTable_type[]; //! A pointer to a table of definitions typedef Definition* const defTable_ptr; /*! Definition table structure. * * USAGE NOTE: * * When defining a list of these structures (a definition table) you can * tune your table to be easier for people to use by specifying an * appropriate number of 'relevant characters' out of the name for * scanning. For example the definition name "NICKNAME" could be * written short-hand as "NICK" (4 relevant characters) as long as there * aren't any other names in the definition table starting with "NICK". * This can become a time-saver for users. * * While using this structure a definition can be a segment or a variable, * or even both. Functionality is determined by which values are present * as dictated below. * * If defTable is present (!= NULL) when called as a segment, the array * which it points to will be used. If the segmentHandler is also present, * it will be called prior to switching into that table. If the return * value of the handler is false the switch into that table will not be * made. * * If BOTH variableHandler are present (!= NULL) when called as a * variable, the handler will be called to 'handle' the given variable * pointer. If the handler returns false, the parsing process will * continue but with a warning given to the user. Note that if you are * using a custom handler you will have to type-cast the void *. * * When used within a table, the last entry must have a NULL for the name * variable, however the other variables in this structure can be used * and will act like a 'default' entry, or 'if not found, use this' * entry for segments which are just lists, or have sub-segments which * variable names etc. */ struct Definition { //! Name of definition const char* const name; //! Relevant chars in name const unsigned int relevantChars; //! Data pointer const void* variablePtr; //! Handler (variable) const VariableHandler* variableHandler; //! Table (segment) const defTable_ptr defTable; //! Handler (segment) const SegmentHandler* segmentHandler; }; // struct Definition }; // namespace Config }; // namespace Util }; // namespace AIS #endif // _INCLUDE_LIBAISUTIL_CONFIG_DEFINITIONS_H_ --- NEW FILE: seg-handler.h --- /* $Id: seg-handler.h,v 1.1 2004/12/31 22:58:06 pickle Exp $ * * Copyright (c) 2004 Alien Internet Services * * This file is a part of LibAISutil. * * LibAISutil is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * LibAISutil is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with LibAISutil; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _INCLUDE_LIBAISUTIL_CONFIG_SEG_HANDLER_H_ # define _INCLUDE_LIBAISUTIL_CONFIG_SEG_HANDLER_H_ 1 # include <aisutil/config/handler.h> namespace AIS { namespace Util { namespace Config { /*! * \brief Configuration data segment handler functoid base class * * This functiod is designed for handling transitions into (and * subsequently out of) configuration segments. * * Normally, you will not need to use one of these, because common * segment handlers are provided by the library. However, there are * instances where you need a fairly intuitive interface to a * specific variable and a fake-segment with the data inside being * processed in a specific way is often a great way do it from a * user's perspective. * * Segment handlers can serve two purposes: * - Initialisation of something (such as a variable) prior to * the configuration process continuing to load. * - The handling of the data within the two curly-braces that * contain that particular segment. * * In the case of the latter, you must have a plan in effect for * handling any nested segments (they are now your responsibility). * * You must return with the position indicator pointing at the * position of the terminating curly-brace ('}') of that segment. */ class SegmentHandler : public Handler { protected: //! Default constructor SegmentHandler(void) {}; public: //! Destructor virtual ~SegmentHandler(void) {}; //! The handler virtual const bool handle(void) { return false; /* !!! */ }; }; // class SegmentHandler }; // namespace Config }; // namespace Util }; // namespace AIS #endif // _INCLUDE_LIBAISUTIL_CONFIG_SEG_HANDLER_H_ |
|
From: Simon B. <pi...@us...> - 2004-12-31 22:58:17
|
Update of /cvsroot/libais/libaisutil/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14591/test Modified Files: tests.h Added Files: config.cpp test.conf Log Message: Initial updates for the new configuration parser - WILL NOT COMPLETELY BUILD!! Major architectural changes here!! Yes, it's new years -- HAPPY NEW 2005!!! :) --- NEW FILE: config.cpp --- /* $Id: config.cpp,v 1.1 2004/12/31 22:58:07 pickle Exp $ * * Copyright (c) 2004 Alien Internet Services * * This file is a part of LibAISutil. * * LibAISutil is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * LibAISutil is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with LibAISutil; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include <aisutil/config/config.h> #include <iostream> #include "tests.h" using namespace AIS::Util; // Table of configuration definitions static Config::defTable_type definitionTable = { { 0, 0, 0, 0, 0, 0 } }; /* Error reporting mechanism. * Due to the very nature of the configuration parser, this is how the tests * are actually monitored. The error responces are synchronised with the * test configuration file and are checked based on correct error responces. */ class TestReporter : public Config::ErrorReporter { private: const bool silent; public: TestReporter(const bool _silent) : silent(_silent) {}; ~TestReporter(void) {}; }; // Configuration class itself class TestConfig : public Config::Config { private: // Test variables bool testBool; signed int testSignedInt; unsigned int testUnsignedInt; signed char testSignedChar; unsigned char testUnsignedChar; signed short testSignedShort; unsigned short testUnsighedShort; signed long testSignedLong; unsigned long testUnsignedLong; public: TestConfig(void) : Config::Config(definitionTable) {}; ~TestConfig(void) {}; }; int main(int argc, char **argv) { TEST_STATUS("Creating local error reporting/tracking mechanism"); TestReporter reporter(TEST_VERBOSE); TEST_STATUS("Creating configuration class"); TestConfig configuration; TEST_END; } --- NEW FILE: test.conf --- /* $Id: test.conf,v 1.1 2004/12/31 22:58:07 pickle Exp $ * * Copyright (c) 2004 Alien Internet Services * * This file is a part of LibAISutil. * * LibAISutil is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * LibAISutil is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with LibAISutil; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ bool = true; bool = false; integers = { } Index: tests.h =================================================================== RCS file: /cvsroot/libais/libaisutil/test/tests.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- tests.h 10 Aug 2003 07:24:30 -0000 1.4 +++ tests.h 31 Dec 2004 22:58:07 -0000 1.5 @@ -1,6 +1,6 @@ /* $Id$ * - * Copyright (c) 2003 Alien Internet Services + * Copyright (c) 2003,2004 Alien Internet Services * * This file is a part of LibAISutil. * @@ -25,8 +25,11 @@ #include <iostream> +#define TEST_VERBOSE \ + (argc > 1) + #define TEST_STATUS(x) \ - if (argc > 1) { \ + if (TEST_VERBOSE) { \ std::cout << x << std::endl; \ } |
|
From: Simon B. <pi...@us...> - 2004-12-31 22:58:17
|
Update of /cvsroot/libais/libaisutil/include/aisutil/config/handlers In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14591/include/aisutil/config/handlers Added Files: bool.h integers.h Log Message: Initial updates for the new configuration parser - WILL NOT COMPLETELY BUILD!! Major architectural changes here!! Yes, it's new years -- HAPPY NEW 2005!!! :) --- NEW FILE: bool.h --- /* $Id: bool.h,v 1.1 2004/12/31 22:58:07 pickle Exp $ * * Copyright (c) 2004 Alien Internet Services * * This file is a part of LibAISutil. * * LibAISutil is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * LibAISutil is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with LibAISutil; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _INCLUDE_LIBAISUTIL_CONFIG_HANDLERS_BOOL_H_ # define _INCLUDE_LIBAISUTIL_CONFIG_HANDLERS_BOOL_H_ 1 # include <aisutil/config/var-handler.h> namespace AIS { namespace Util { namespace Config { /*! * \brief Handle a boolean value * * Convert a word into a boolean value, for example "yes", "true" * and "1" all equal a boolean value of \e true. */ class HandleBool : virtual public VariableHandler { public: //! Default constructor HandleBool(void) {}; //! Destructor virtual ~HandleBool(void) {}; //! The handler virtual const bool handle(void) { return false; }; }; // class HandleBool }; // namespace Config }; // namespace Util }; // namespace AIS #endif // _INCLUDE_LIBAISUTIL_CONFIG_HANDLERS_BOOL_H_ --- NEW FILE: integers.h --- /* $Id: integers.h,v 1.1 2004/12/31 22:58:07 pickle Exp $ * * Copyright (c) 2004 Alien Internet Services * * This file is a part of LibAISutil. * * LibAISutil is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * LibAISutil is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with LibAISutil; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _INCLUDE_LIBAISUTIL_CONFIG_HANDLERS_INTEGERS_H_ # define _INCLUDE_LIBAISUTIL_CONFIG_HANDLERS_INTEGERS_H_ 1 # include <aisutil/config/var-handler.h> namespace AIS { namespace Util { namespace Config { /*! * \brief Template for handling integers * * This is a template for handling integers great and small, signed * and unsigned. */ template <typename T> class HandleInteger : virtual public VariableHandler { public: //! Default constructor HandleInteger(void) {}; //! Destructor virtual ~HandleInteger(void) {}; //! The handler virtual const bool handler(void) { return false; }; }; // class HandleInteger typedef HandleInteger<signed char> HandleSignedChar; typedef HandleInteger<unsigned char> HandleUnsignedChar; typedef HandleInteger<signed short> HandleSignedShort; typedef HandleInteger<unsigned short> HandleUnsignedShort; typedef HandleInteger<signed int> HandleSignedInt; typedef HandleInteger<unsigned int> HandleUnsignedInt; typedef HandleInteger<signed long> HandleSignedLong; typedef HandleInteger<unsigned long> HandleUnsignedLong; typedef HandleInteger<signed long long> HandleSignedLongLong; typedef HandleInteger<unsigned long long> HandleUnsignedLongLong; }; // namespace Config }; // namespace Util }; // namespace AIS #endif // _INCLUDE_LIBAISUTIL_CONFIG_HANDLERS_INTEGERS_H_ |
|
From: Simon B. <pi...@us...> - 2004-12-31 22:58:16
|
Update of /cvsroot/libais/libaisutil/src/config In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14591/src/config Added Files: config.cpp handle-misc.cpp Removed Files: data.cpp parser.cpp Log Message: Initial updates for the new configuration parser - WILL NOT COMPLETELY BUILD!! Major architectural changes here!! Yes, it's new years -- HAPPY NEW 2005!!! :) --- data.cpp DELETED --- --- parser.cpp DELETED --- --- NEW FILE: handle-misc.cpp --- /* $Id: handle-misc.cpp,v 1.1 2004/12/31 22:58:07 pickle Exp $ * * Copyright (c) 2002,2003,2004 Alien Internet Services * * This file is a part of LibAISutil. * * LibAISutil is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * LibAISutil is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with LibAISutil; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #ifdef LIBAISUTIL_DEBUG_ASSERT # include <cassert> #endif #include "aisutil/config/handlers/bool.h" using namespace AIS::Util::Config; --- NEW FILE: config.cpp --- /* $Id: config.cpp,v 1.1 2004/12/31 22:58:07 pickle Exp $ * * Copyright (c) 2002,2003,2004 Alien Internet Services * * This file is a part of LibAISutil. * * LibAISutil is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * LibAISutil is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with LibAISutil; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #ifdef LIBAISUTIL_DEBUG_ASSERT # include <cassert> #endif #include "aisutil/config/config.h" #include "aisutil/utils.h" using namespace AIS::Util; |
|
From: Simon B. <pi...@us...> - 2004-12-31 22:58:16
|
Update of /cvsroot/libais/libaisutil/include/aisutil In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14591/include/aisutil Modified Files: config.h Log Message: Initial updates for the new configuration parser - WILL NOT COMPLETELY BUILD!! Major architectural changes here!! Yes, it's new years -- HAPPY NEW 2005!!! :) Index: config.h =================================================================== RCS file: /cvsroot/libais/libaisutil/include/aisutil/config.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- config.h 4 Aug 2003 04:59:51 -0000 1.4 +++ config.h 31 Dec 2004 22:58:06 -0000 1.5 @@ -1,6 +1,6 @@ /* $Id$ * - * Copyright (c) 2002,2003 Alien Internet Services + * Copyright (c) 2002,2003,2004 Alien Internet Services * * This file is a part of LibAISutil. * @@ -30,8 +30,7 @@ * who are lazy! */ -# include <aisutil/config/data.h> -# include <aisutil/config/parser.h> +# include <aisutil/config/config.h> #endif // _INCLUDE_LIBAISUTIL_CONFIG_H_ |
|
From: Simon B. <pi...@us...> - 2004-12-31 22:58:15
|
Update of /cvsroot/libais/libaisutil/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14591/include Modified Files: Makefile.am Log Message: Initial updates for the new configuration parser - WILL NOT COMPLETELY BUILD!! Major architectural changes here!! Yes, it's new years -- HAPPY NEW 2005!!! :) Index: Makefile.am =================================================================== RCS file: /cvsroot/libais/libaisutil/include/Makefile.am,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- Makefile.am 26 Nov 2003 22:50:47 -0000 1.8 +++ Makefile.am 31 Dec 2004 22:58:06 -0000 1.9 @@ -5,8 +5,14 @@ # Include files.. nobase_include_HEADERS=\ - aisutil/config/data.h \ - aisutil/config/parser.h \ + aisutil/config/handlers/bool.h \ + aisutil/config/handlers/integers.h \ + aisutil/config/config.h \ + aisutil/config/definitions.h \ + aisutil/config/errors.h \ + aisutil/config/handler.h \ + aisutil/config/seg-handler.h \ + aisutil/config/var-handler.h \ aisutil/socket/domain-ip.h \ aisutil/socket/domain-ipv4.h \ aisutil/socket/domain-ipv6.h \ |
|
From: Simon B. <pi...@us...> - 2004-12-31 22:58:15
|
Update of /cvsroot/libais/libaisutil In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14591 Modified Files: ChangeLog Makefile.am Log Message: Initial updates for the new configuration parser - WILL NOT COMPLETELY BUILD!! Major architectural changes here!! Yes, it's new years -- HAPPY NEW 2005!!! :) Index: Makefile.am =================================================================== RCS file: /cvsroot/libais/libaisutil/Makefile.am,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- Makefile.am 26 Nov 2003 22:50:47 -0000 1.16 +++ Makefile.am 31 Dec 2004 22:58:05 -0000 1.17 @@ -57,8 +57,8 @@ # Source files.. libaisutil_la_SOURCES=\ - src/config/data.cpp \ - src/config/parser.cpp \ + src/config/config.cpp \ + src/config/handle-misc.cpp \ src/socket/socket.cpp \ src/socket/stateful-type.cpp \ $(LIBAISUTIL_FILE_SOCKET_DOMAIN_IPV4) \ @@ -90,7 +90,8 @@ # Stuff that needs to go into the distribution but isn't implied EXTRA_DIST=\ include/aisutil/aisutilconf.h.in \ - test/README + test/README \ + test/test.conf @@ -106,6 +107,7 @@ # The tests to run TESTS=\ + test-config \ test-peakcount \ test-sha1 \ test-string \ @@ -120,6 +122,8 @@ # Test programs' source files +test_config_SOURCES=\ + test/tests.h test/config.cpp test_peakcount_SOURCES=\ test/tests.h test/peakcount.cpp test_sha1_SOURCES=\ @@ -137,6 +141,8 @@ # Test programs' libraries +test_config_LDADD=\ + libaisutil.la #test_peakcount_LDADD=\ # libaisutil.la test_sha1_LDADD=\ Index: ChangeLog =================================================================== RCS file: /cvsroot/libais/libaisutil/ChangeLog,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- ChangeLog 7 Aug 2004 00:33:17 -0000 1.27 +++ ChangeLog 31 Dec 2004 22:58:05 -0000 1.28 @@ -1,6 +1,4 @@ -Version 1.4 - * Time:: includes some more arithmetic operations. See the manual for more - details +Version 2.0 * Socket routines are now contained the AIS::Util::Socket:: namespace. Some minor base class changed have occured, check the documentation for more details. Mostly, changing the namespace will be the only change required. @@ -14,6 +12,14 @@ wrapper for the Socket:: classes is planned eventually * Socket::* classes now have a much more flexible flag system. Check the manual for more details. + * Reconstruction and major change to the configuration parsing system, + mostly to move this closer to C++ code. Internal changes are likely to + continue but shouldn't effect API users. Note that this should clear up + problems with newer compilers which adhere to the C++ standard which + forbids member-function-pointers to be recast as (void*). The new system + is contained within the AIS::Util::Config:: namespace. + * Time:: includes some more arithmetic operations. See the manual for more + details * SHA1_Digest:: can natively deal with raw data, and std::wstring's * Added PeakCount:: template class * Minor bug fixes |
|
From: Simon B. <pi...@us...> - 2004-08-07 01:06:33
|
Update of /cvsroot/libais/libaisutil/include/aisutil In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19440 Modified Files: sha1.h Log Message: Okay, so I poached & modified this file from KineIRCd (http://kineircd.sf.net/) - updated the copyright info in the boiler plate so it actually matches this package.. oops! Index: sha1.h =================================================================== RCS file: /cvsroot/libais/libaisutil/include/aisutil/sha1.h,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- sha1.h 25 Oct 2003 19:03:06 -0000 1.13 +++ sha1.h 7 Aug 2004 01:06:17 -0000 1.14 @@ -1,16 +1,15 @@ /* $Id$ * - * Copyright (c) 2001,2002,2003 KineIRCd Development Team - * (See DEV-TEAM file for details) + * Copyright (c) 2001,2002,2003,2004 Alien Internet Services * - * This file is a part of KineIRCd. + * This file is a part of LibAISutil. * - * KineIRCd is free software; you can redistribute it and/or modify + * LibAISutil is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * - * KineIRCd is distributed in the hope that it will be useful, + * LibAISutil is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. |
|
From: Simon B. <pi...@us...> - 2004-08-07 00:59:35
|
Update of /cvsroot/libais/www/doxygen/libaisutil In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18328 Modified Files: namespaces.doxy Log Message: added information on the AIS::Util::Config namespace Index: namespaces.doxy =================================================================== RCS file: /cvsroot/libais/www/doxygen/libaisutil/namespaces.doxy,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- namespaces.doxy 10 Aug 2003 07:11:44 -0000 1.2 +++ namespaces.doxy 7 Aug 2004 00:59:26 -0000 1.3 @@ -17,6 +17,16 @@ * http://libais.sourceforge.net/ */ +/*! \namespace AIS::Util::Config + * \brief Configuration parser routines + * + * The configuration parser routines encompass a complex, flexible system + * designed for absolutely modular processing of C-style configuration + * files, using either "prepackaged" variable handlers for numbers and + * strings, or "BYO" variable handlers for those bizarre data types you've + * invented for your software. + */ + /*! \namespace AIS::Util::Socket * \brief %Socket routines * |
|
From: Simon B. <pi...@us...> - 2004-08-07 00:33:26
|
Update of /cvsroot/libais/libaisutil In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14525 Modified Files: ChangeLog Log Message: Updated changelog - forgot to during last commit Index: ChangeLog =================================================================== RCS file: /cvsroot/libais/libaisutil/ChangeLog,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- ChangeLog 26 Nov 2003 22:50:47 -0000 1.26 +++ ChangeLog 7 Aug 2004 00:33:17 -0000 1.27 @@ -17,6 +17,7 @@ * SHA1_Digest:: can natively deal with raw data, and std::wstring's * Added PeakCount:: template class * Minor bug fixes + * Minor C++ formalities Version 1.3 |
|
From: Simon B. <pi...@us...> - 2004-08-02 22:27:30
|
Update of /cvsroot/libais/libaisutil/include/aisutil/string In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19513/string Modified Files: mask.h string.h tokens.h Log Message: template <class T> -=> template <typename T> Index: mask.h =================================================================== RCS file: /cvsroot/libais/libaisutil/include/aisutil/string/mask.h,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- mask.h 8 Aug 2003 14:42:57 -0000 1.13 +++ mask.h 2 Aug 2004 22:27:20 -0000 1.14 @@ -1,6 +1,6 @@ /* $Id$ * - * Copyright (c) 1996,1998,2001,2003 Alien Internet Services + * Copyright (c) 1996,1998,2001,2003,2004 Alien Internet Services * * This file is a part of LibAISutil. * @@ -59,7 +59,7 @@ * * \param mask A string to be stored (should be a mask) */ - template <class T> + template <typename T> StringMask(const T& mask) : String(mask) {}; Index: tokens.h =================================================================== RCS file: /cvsroot/libais/libaisutil/include/aisutil/string/tokens.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- tokens.h 5 Aug 2003 15:17:51 -0000 1.9 +++ tokens.h 2 Aug 2004 22:27:20 -0000 1.10 @@ -1,6 +1,6 @@ /* $Id$ * - * Copyright (c) 1999,2000,2002,2003 Alien Internet Services + * Copyright (c) 1999,2000,2002,2003,2004 Alien Internet Services * * This file is a part of LibAISutil. * @@ -53,7 +53,7 @@ * If this is not provided, tokenisation will begin at the start * of the string. */ - template <class T> + template <typename T> StringTokens(const T& string, const String::size_type pos = 0) : String(string), Index: string.h =================================================================== RCS file: /cvsroot/libais/libaisutil/include/aisutil/string/string.h,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- string.h 5 Aug 2003 11:10:43 -0000 1.11 +++ string.h 2 Aug 2004 22:27:20 -0000 1.12 @@ -1,6 +1,6 @@ /* $Id$ * - * Copyright (c) 1996,1999,2001,2002,2003 Alien Internet Services + * Copyright (c) 1996,1999,2001,2002,2003,2004 Alien Internet Services * * This file is a part of LibAISutil. * @@ -52,11 +52,11 @@ //! The magic constructors String(void) : std::string("") {}; String(char c) : std::string(&c) {}; - template <class Ta> + template <typename Ta> String(const Ta& a) : std::string(a) {}; - template <class Ta, class Tb> + template <typename Ta, typename Tb> String(const Ta& a, const Tb& b) : std::string(a, b) {}; @@ -94,7 +94,7 @@ * \param input Something to convert to a string * \return A string representing whatever was giving as the \p input */ - template <class T> + template <typename T> static const std::string convert(const T& input) { std::ostringstream out; |
|
From: Simon B. <pi...@us...> - 2004-08-02 22:27:30
|
Update of /cvsroot/libais/libaisutil/include/aisutil/socket In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19513/socket Modified Files: domain-ipv4.h domain-ipv6.h domain-ipx.h Log Message: template <class T> -=> template <typename T> Index: domain-ipx.h =================================================================== RCS file: /cvsroot/libais/libaisutil/include/aisutil/socket/domain-ipx.h,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- domain-ipx.h 18 Aug 2003 22:20:43 -0000 1.12 +++ domain-ipx.h 2 Aug 2004 22:27:20 -0000 1.13 @@ -1,6 +1,6 @@ /* $Id$ * - * Copyright (c) 2002,2003 Alien Internet Services + * Copyright (c) 2002,2003,2004 Alien Internet Services * * This file is a part of LibAISutil. * @@ -138,7 +138,7 @@ * \overload * \copydoc setLocalAddress(const std::string& address) */ - template <class T> + template <typename T> const bool setLocalAddress(const T& address) { return setAddress(localAddress, address); }; @@ -152,7 +152,7 @@ * \overload * \copydoc setRemoteAddress(const std::string& address) */ - template <class T> + template <typename T> const bool setRemoteAddress(const T& address) { return setAddress(remoteAddress, address); }; Index: domain-ipv6.h =================================================================== RCS file: /cvsroot/libais/libaisutil/include/aisutil/socket/domain-ipv6.h,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- domain-ipv6.h 18 Aug 2003 22:20:42 -0000 1.15 +++ domain-ipv6.h 2 Aug 2004 22:27:20 -0000 1.16 @@ -1,6 +1,6 @@ /* $Id$ * - * Copyright (c) 2002,2003 Alien Internet Services + * Copyright (c) 2002,2003,2004 Alien Internet Services * * This file is a part of LibAISutil. * @@ -154,7 +154,7 @@ * \overload * \copydoc setLocalAddress(const std::string& address) */ - template <class T> + template <typename T> const bool setLocalAddress(const T& address) { return setAddress(localAddress, address); }; @@ -168,7 +168,7 @@ * \overload * \copydoc setRemoteAddress(const std::string& address) */ - template <class T> + template <typename T> const bool setRemoteAddress(const T& address) { return setAddress(remoteAddress, address); }; Index: domain-ipv4.h =================================================================== RCS file: /cvsroot/libais/libaisutil/include/aisutil/socket/domain-ipv4.h,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- domain-ipv4.h 18 Aug 2003 22:20:42 -0000 1.15 +++ domain-ipv4.h 2 Aug 2004 22:27:20 -0000 1.16 @@ -1,6 +1,6 @@ /* $Id$ * - * Copyright (c) 2002,2003 Alien Internet Services + * Copyright (c) 2002,2003,2004 Alien Internet Services * * This file is a part of LibAISutil. * @@ -156,7 +156,7 @@ * \overload * \copydoc setLocalAddress(const std::string& address) */ - template <class T> + template <typename T> const bool setLocalAddress(const T& address) { return setAddress(localAddress, address); }; @@ -170,7 +170,7 @@ * \overload * \copydoc setRemoteAddress(const std::string& address) */ - template <class T> + template <typename T> const bool setRemoteAddress(const T& address) { return setAddress(remoteAddress, address); }; |
|
From: Simon B. <pi...@us...> - 2004-08-02 22:27:30
|
Update of /cvsroot/libais/libaisutil/include/aisutil In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19513 Modified Files: time.h Log Message: template <class T> -=> template <typename T> Index: time.h =================================================================== RCS file: /cvsroot/libais/libaisutil/include/aisutil/time.h,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- time.h 31 Jul 2004 14:48:16 -0000 1.14 +++ time.h 2 Aug 2004 22:27:19 -0000 1.15 @@ -231,7 +231,7 @@ * \param rhs The time to add to this time * \return A reference to this time instance after the addition */ - template <class T> + template <typename T> const Time& operator+=(const T& rhs) { return ((*this) = (*this) + rhs); }; @@ -255,7 +255,7 @@ * \param rhs The time to subtract from this time * \return A reference to this time instance after the subtraction */ - template <class T> + template <typename T> const Time& operator-=(const T& rhs) { return ((*this) = (*this) - rhs); }; @@ -297,7 +297,7 @@ * \param rhs The amount to divide this time by * \return The divided time as a Time structure */ - template <class T> + template <typename T> const Time operator/(const T& rhs) const { const double result = (*this) / rhs; @@ -311,7 +311,7 @@ * \param rhs The amount to divide from this time * \return A reference to this time instance after the division */ - template <class T> + template <typename T> const Time& operator/=(const T& rhs) { return ((*this) = (*this) / rhs); }; @@ -343,7 +343,7 @@ * time * \retval false The given parameter is considered equal to this time */ - template <class T> + template <typename T> const bool operator!=(const T& rhs) const { return (!((*this) == rhs)); }; @@ -399,7 +399,7 @@ * \retval true The given value is greater than or equal to this Time * \retval false The given value is less than this Time */ - template <class T> + template <typename T> const bool operator>=(const T& rhs) const { return (!((*this) < rhs)); }; @@ -413,7 +413,7 @@ * \retval true The given value is less than or equal to this Time * \retval false The given value is greater than this Time */ - template <class T> + template <typename T> const bool operator<=(const T& rhs) const { return (!((*this) > rhs)); }; |
|
From: Simon B. <pi...@us...> - 2004-08-01 23:40:54
|
Update of /cvsroot/libais/libaisutil/include/aisutil/config/handlers In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23694/handlers Log Message: Directory /cvsroot/libais/libaisutil/include/aisutil/config/handlers added to the repository |
|
From: Simon B. <pi...@us...> - 2004-08-01 23:29:09
|
Update of /cvsroot/libais/libaisutil/src/config/handlers In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22200/handlers Log Message: Directory /cvsroot/libais/libaisutil/src/config/handlers added to the repository |
|
From: Simon B. <pi...@us...> - 2004-07-31 14:48:25
|
Update of /cvsroot/libais/libaisutil/include/aisutil In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1237/include/aisutil Modified Files: time.h Log Message: Fixed (hopefully) a casting issue that was making gcc 3.4.0 get grumpy :( Index: time.h =================================================================== RCS file: /cvsroot/libais/libaisutil/include/aisutil/time.h,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- time.h 8 Aug 2003 06:38:04 -0000 1.13 +++ time.h 31 Jul 2004 14:48:16 -0000 1.14 @@ -1,6 +1,6 @@ /* $Id$ * - * Copyright (c) 1996,2003 Alien Internet Services + * Copyright (c) 1996,2003,2004 Alien Internet Services * * This file is a part of LibAISutil. * @@ -301,7 +301,8 @@ const Time operator/(const T& rhs) const { const double result = (*this) / rhs; - return Time((result / max_nsec), (result % max_nsec)); + return Time((result / max_nsec), + ((const long int)result % max_nsec)); }; /*! |
|
From: Simon B. <pi...@us...> - 2004-07-31 14:26:12
|
Update of /cvsroot/libais/libaisutil/config In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30130/config Added Files: aclocal.m4 Removed Files: acinclude.m4 Log Message: Debris from the latest war with the GNU build tools --- NEW FILE: aclocal.m4 --- sinclude(libtool.m4) --- acinclude.m4 DELETED --- |
|
From: Simon B. <pi...@us...> - 2004-07-31 14:26:12
|
Update of /cvsroot/libais/libaisutil In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30130 Modified Files: configure.ac Log Message: Debris from the latest war with the GNU build tools Index: configure.ac =================================================================== RCS file: /cvsroot/libais/libaisutil/configure.ac,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- configure.ac 21 Jul 2003 20:58:18 -0000 1.18 +++ configure.ac 31 Jul 2004 14:26:03 -0000 1.19 @@ -1,7 +1,7 @@ dnl $Id$ dnl AutoConf configuration script for LibAISutil dnl -dnl Copyright (c) 2001,2002,2003 Alien Internet Services +dnl Copyright (c) 2001,2002,2003,2004 Alien Internet Services dnl dnl This file is a part of LibAISutil. dnl @@ -25,10 +25,10 @@ dnl ------------------------------------------------------------------------- dnl Initialise the autoconf/automake things AC_INIT([LibAISutil], [1.3.cvs], [lib...@al...]) +AC_CONFIG_AUX_DIR(config) AM_INIT_AUTOMAKE([1.6.1 foreign no-installinfo no-installman nostdinc subdir-objects]) -AC_COPYRIGHT([Portions Copyright (c) 2001,2002,2003 Alien Internet Services]) +AC_COPYRIGHT([Portions Copyright (c) 2001,2002,2003,2004 Alien Internet Services]) AC_PREREQ(2.57) -AC_CONFIG_AUX_DIR(config) AM_CONFIG_HEADER(include/config.h) AC_REVISION([$Revision$]) @@ -85,6 +85,7 @@ dnl Checking compiler and system characteristics dnl ------------------------------------------------------------------------- dnl AC_AIX +AC_GNU_SOURCE dnl AC_MINIX dnl AC_ISC_POSIX AC_SYS_LONG_FILE_NAMES |
|
From: <pi...@us...> - 2003-11-27 17:11:12
|
Update of /cvsroot/libais/libaisutil/test
In directory sc8-pr-cvs1:/tmp/cvs-serv6795/test
Modified Files:
peakcount.cpp
Log Message:
Added a value_type (just like many STL headers have - it's handy, afterall
:) and added like-type addition/subtraction stuff which really should have
been in there when I first implemented it.. But hey, necessity is the mother
of all invention, and back then I never needed to merge counters
Index: peakcount.cpp
===================================================================
RCS file: /cvsroot/libais/libaisutil/test/peakcount.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- peakcount.cpp 26 Nov 2003 22:50:48 -0000 1.1
+++ peakcount.cpp 27 Nov 2003 17:11:09 -0000 1.2
@@ -78,5 +78,16 @@
(pcA.getValue() != 135) ||
(pcA.getPeak() != 456));
+ TEST_STATUS("Creating a new PeakCount<int>:: object (initialised)");
+ PeakCount < int > pcB(654, 321); // peak is lower than value intentionally
+ TEST_FAIL_IF((pcB.getValue() != 654) ||
+ (pcB.getPeak() != 654) ||
+ (pcB != 654));
+
+ TEST_STATUS("Adding PeakCount's together");
+ PeakCount < int > pcC = pcA + pcB;
+ TEST_FAIL_IF((pcC.getValue() != (pcA.getValue() + pcB.getValue())) ||
+ (pcC.getPeak() != (pcA.getPeak() + pcB.getPeak())));
+
TEST_END;
}
|
|
From: <pi...@us...> - 2003-11-27 17:11:12
|
Update of /cvsroot/libais/libaisutil/include/aisutil
In directory sc8-pr-cvs1:/tmp/cvs-serv6795/include/aisutil
Modified Files:
peakcount.h
Log Message:
Added a value_type (just like many STL headers have - it's handy, afterall
:) and added like-type addition/subtraction stuff which really should have
been in there when I first implemented it.. But hey, necessity is the mother
of all invention, and back then I never needed to merge counters
Index: peakcount.h
===================================================================
RCS file: /cvsroot/libais/libaisutil/include/aisutil/peakcount.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- peakcount.h 26 Nov 2003 22:50:48 -0000 1.1
+++ peakcount.h 27 Nov 2003 17:11:09 -0000 1.2
@@ -47,7 +47,11 @@
* twice the size of the given type.
*/
template < class T > class PeakCount {
- private:
+ public:
+ //! The type used for the value and peak numbers
+ typedef T value_type;
+
+ private:
//! My type
typedef PeakCount < T > my_type;
@@ -125,6 +129,19 @@
};
/*!
+ * \brief Addition operator
+ *
+ * Note that adding two counters together will combine both
+ * the values and peak values together, in effect merging the
+ * two counters.
+ *
+ * \param rhs Another counter to add to this counter
+ * \return The result of the addition
+ */
+ const my_type operator+(const my_type& rhs)
+ { return my_type(value + rhs.value, peak + rhs.peak); };
+
+ /*!
* \brief Addition assignment operator
*
* \param rhs The number to add to the \a value
@@ -139,6 +156,20 @@
};
/*!
+ * \brief Addition assignment operator
+ *
+ * \param rhs The counter to add to this one
+ * \return A reference to this instance after the addition
+ */
+ const my_type& operator+=(const my_type& rhs)
+ {
+ value += rhs.value;
+ peak += rhs.peak;
+ return (*this);
+ };
+
+
+ /*!
* \brief Prefix increment operator
*
* \return A reference to this instance after the addition
@@ -173,6 +204,17 @@
};
/*!
+ * \brief Subtraction operator
+ *
+ * \param rhs Another counter to subtract from this one
+ * \return The result of the addition
+ */
+ const my_type operator-(const my_type& rhs)
+ {
+ return my_type(value - rhs.value, peak - rhs.peak);
+ };
+
+ /*!
* \brief Subtraction assignment operator
*
* \param rhs The number to subtract from the \a value
@@ -184,6 +226,20 @@
return (*this);
};
+ /*!
+ * \brief Subtraction assignment operator
+ *
+ * \param rhs Another counter to subtract from this one
+ * \return A reference to this instance after the subtraction
+ */
+ const my_type& operator-=(const my_type& rhs)
+ {
+ value -= rhs.value;
+ peak -= rhs.peak;
+ return (*this);
+ };
+
+
/*!
* \brief Prefix decrement operator
*
|
|
From: <pi...@us...> - 2003-11-26 22:50:52
|
Update of /cvsroot/libais/libaisutil/include/aisutil
In directory sc8-pr-cvs1:/tmp/cvs-serv19509/include/aisutil
Added Files:
peakcount.h
Log Message:
Added the PeakCount:: class - dusted off some code from 1997 which was
somewhat useful back then, cleaned up some ugly bits and wrote pretty
comments for doxygen.
Also wrote a test program for it, fitting in with the other test programs
used for make check.
--- NEW FILE: peakcount.h ---
/* $Id: peakcount.h,v 1.1 2003/11/26 22:50:48 pickle Exp $
*
* Copyright (c) 1997,2003 Alien Internet Services
*
* This file is a part of LibAISutil.
*
* LibAISutil is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* LibAISutil is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LibAISutil; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _INCLUDE_AISUTIL_PEAKCOUNT_H_
# define _INCLUDE_AISUTIL_PEAKCOUNT_H_ 1
/*! \file
* \brief A simple floating counter with an associated peak value
*
* Basic floating counter with peak value template
*/
# include <algorithm>
namespace AIS {
namespace Util {
/*!
* \brief Basic floating counter with peak value template
*
* It's often required to maintain a floating counter for statistical
* reasons, such as the number of people in a room. This number can
* rise and fall, and often the highest value (the "peak" value) is
* useful to know.
*
* This template feigns the type you give it (normally an integer or
* a floating point number) while adding a peak value you can access.
*
* Note that the memory used per instance of this class will be exactly
* twice the size of the given type.
*/
template < class T > class PeakCount {
private:
//! My type
typedef PeakCount < T > my_type;
//! The current value
T value;
//! The peak value
T peak;
public:
/*!
* \brief Constructor
*
* Create the new counter, optionally giving it a pre-existing value
* and also a peak value if necessary. Note that if the peak value
* given is less than the current value given, the current value
* will over-ride the given peak value.
*
* \param _value The current value
* \param _peak The peak value
*/
PeakCount(const T& _value = 0,
const T& _peak = 0)
: value(_value),
peak(std::max(_value, _peak))
{};
/*!
* \brief Return the current value
*
* \return The current value
*/
const T& getValue(void) const
{ return value; };
/*!
* \brief Return the peak value
*
* \return The highest value known (the peak)
*/
const T& getPeak(void) const
{ return peak; };
/*!
* \brief Return the current value in its native form
*
* In order to act like the given type, this class can convert back
* to that type naturally without having to always call getValue()
* explicitly.
*
* \return The current value
*/
operator T(void) const
{ return value; };
/*!
* \brief Addition operator
*
* If the number given (\p rhs) will shift the \a value to that
* greater than the current \a peak value, the \a peak value will be
* changed to equal the \a value.
*
* \param rhs The number to add to the \a value
* \return The result of the addition
*/
const my_type operator+(const T& rhs)
{
my_type newValue(*this);
if ((newValue.value += rhs) > newValue.peak) {
newValue.peak = newValue.value;
}
return newValue;
};
/*!
* \brief Addition assignment operator
*
* \param rhs The number to add to the \a value
* \return A reference to this instance after the addition
*/
const my_type& operator+=(const T& rhs)
{
if ((value += rhs) > peak) {
peak = value;
}
return (*this);
};
/*!
* \brief Prefix increment operator
*
* \return A reference to this instance after the addition
*/
const my_type& operator++(void)
{ return ((*this) += T(1)); };
/*!
* \brief Postfix increment operator
*
* \return A copy of this instance as it was before the addition
*/
const my_type operator++(int i)
{
my_type oldValue(*this);
++(*this);
return oldValue;
};
/*!
* \brief Subtraction operator
*
* \param rhs The number to subtract from the \a value
* \return The result of the addition
*/
const my_type operator-(const T& rhs)
{
my_type newValue(*this);
newValue.value -= rhs;
return newValue;
};
/*!
* \brief Subtraction assignment operator
*
* \param rhs The number to subtract from the \a value
* \return A reference to this instance after the subtraction
*/
const my_type& operator-=(const T& rhs)
{
value -= rhs;
return (*this);
};
/*!
* \brief Prefix decrement operator
*
* \return A reference to this instance after the subtraction
*/
const my_type& operator--(void)
{
--value;
return (*this);
};
/*!
* \brief Postfix decrement operator
*
* \return A copy of this instance as it was before the subtraction
*/
const my_type operator--(int i)
{
my_type oldValue(*this);
--value;
return oldValue;
};
/*!
* \brief Assignment operator
*
* \return A reference to this instance after the assignment
*/
const my_type& operator=(const my_type& rhs)
{
value = rhs.value;
return (*this);
};
}; // struct PeakCount
}; // namespace Util
}; // namespace AIS
#endif // _INCLUDE_AISUTIL_PEAKCOUNT_H_
|
|
From: <pi...@us...> - 2003-11-26 22:50:52
|
Update of /cvsroot/libais/libaisutil/include In directory sc8-pr-cvs1:/tmp/cvs-serv19509/include Modified Files: Makefile.am Log Message: Added the PeakCount:: class - dusted off some code from 1997 which was somewhat useful back then, cleaned up some ugly bits and wrote pretty comments for doxygen. Also wrote a test program for it, fitting in with the other test programs used for make check. Index: Makefile.am =================================================================== RCS file: /cvsroot/libais/libaisutil/include/Makefile.am,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- Makefile.am 7 Aug 2003 06:54:53 -0000 1.7 +++ Makefile.am 26 Nov 2003 22:50:47 -0000 1.8 @@ -24,8 +24,9 @@ aisutil/string/mask.h \ aisutil/string/string.h \ aisutil/string/tokens.h \ + aisutil/aisutilconf.h \ aisutil/config.h \ - aisutil/aisutilconf.h \ + aisutil/peakcount.h \ aisutil/sha1.h \ aisutil/socket.h \ aisutil/string.h \ |
|
From: <pi...@us...> - 2003-11-26 22:50:51
|
Update of /cvsroot/libais/libaisutil/test
In directory sc8-pr-cvs1:/tmp/cvs-serv19509/test
Added Files:
peakcount.cpp
Log Message:
Added the PeakCount:: class - dusted off some code from 1997 which was
somewhat useful back then, cleaned up some ugly bits and wrote pretty
comments for doxygen.
Also wrote a test program for it, fitting in with the other test programs
used for make check.
--- NEW FILE: peakcount.cpp ---
/* $Id: peakcount.cpp,v 1.1 2003/11/26 22:50:48 pickle Exp $
*
* Copyright (c) 2003 Alien Internet Services
*
* This file is a part of LibAISutil.
*
* LibAISutil is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* LibAISutil is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LibAISutil; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <aisutil/peakcount.h>
#include "tests.h"
using namespace AIS::Util;
int main(int argc, char **argv)
{
TEST_STATUS("Creating a new PeakCount<int>:: object (zeroed)");
PeakCount < int > pcA;
TEST_FAIL_IF((pcA.getValue() != 0) ||
(pcA.getPeak() != 0) ||
(pcA != 0));
TEST_STATUS("operator+");
TEST_FAIL_IF(((pcA + 123).getValue() != 123) ||
(pcA.getValue() != 0) ||
(pcA.getPeak() != 0));
TEST_STATUS("operator+=");
TEST_FAIL_IF(((pcA += 456).getValue() != 456) ||
(pcA.getValue() != 456) ||
(pcA.getPeak() != 456));
TEST_STATUS("operator-");
TEST_FAIL_IF(((pcA - 123).getValue() != 333) ||
(pcA.getValue() != 456) ||
(pcA.getPeak() != 456));
TEST_STATUS("operator-=");
TEST_FAIL_IF(((pcA -= 321).getValue() != 135) ||
(pcA.getValue() != 135) ||
(pcA.getPeak() != 456));
TEST_STATUS("operator++ prefix");
TEST_FAIL_IF(((++pcA).getValue() != 136) ||
(pcA.getValue() != 136) ||
(pcA.getPeak() != 456));
TEST_STATUS("operator++ postfix");
TEST_FAIL_IF(((pcA++).getValue() != 136) ||
(pcA.getValue() != 137) ||
(pcA.getPeak() != 456));
TEST_STATUS("operator-- prefix");
TEST_FAIL_IF(((--pcA).getValue() != 136) ||
(pcA.getValue() != 136) ||
(pcA.getPeak() != 456));
TEST_STATUS("operator-- postfix");
TEST_FAIL_IF(((pcA--).getValue() != 136) ||
(pcA.getValue() != 135) ||
(pcA.getPeak() != 456));
TEST_END;
}
|
|
From: <pi...@us...> - 2003-11-26 22:50:51
|
Update of /cvsroot/libais/libaisutil
In directory sc8-pr-cvs1:/tmp/cvs-serv19509
Modified Files:
ChangeLog Makefile.am
Log Message:
Added the PeakCount:: class - dusted off some code from 1997 which was
somewhat useful back then, cleaned up some ugly bits and wrote pretty
comments for doxygen.
Also wrote a test program for it, fitting in with the other test programs
used for make check.
Index: ChangeLog
===================================================================
RCS file: /cvsroot/libais/libaisutil/ChangeLog,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- ChangeLog 25 Oct 2003 19:03:06 -0000 1.25
+++ ChangeLog 26 Nov 2003 22:50:47 -0000 1.26
@@ -15,6 +15,7 @@
* Socket::* classes now have a much more flexible flag system. Check the
manual for more details.
* SHA1_Digest:: can natively deal with raw data, and std::wstring's
+ * Added PeakCount:: template class
* Minor bug fixes
Index: Makefile.am
===================================================================
RCS file: /cvsroot/libais/libaisutil/Makefile.am,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- Makefile.am 5 Aug 2003 15:30:07 -0000 1.15
+++ Makefile.am 26 Nov 2003 22:50:47 -0000 1.16
@@ -106,6 +106,7 @@
# The tests to run
TESTS=\
+ test-peakcount \
test-sha1 \
test-string \
test-stringmask \
@@ -119,6 +120,8 @@
# Test programs' source files
+test_peakcount_SOURCES=\
+ test/tests.h test/peakcount.cpp
test_sha1_SOURCES=\
test/tests.h test/sha1.cpp
test_string_SOURCES=\
@@ -134,6 +137,8 @@
# Test programs' libraries
+#test_peakcount_LDADD=\
+# libaisutil.la
test_sha1_LDADD=\
libaisutil.la
test_string_LDADD=\
|
|
From: <pi...@us...> - 2003-10-25 19:08:24
|
Update of /cvsroot/libais/libaisutil/include/aisutil In directory sc8-pr-cvs1:/tmp/cvs-serv995/include/aisutil Modified Files: sha1.h Log Message: Added raw data and std::wstring support to the SHA1 digest constructor thingies Index: sha1.h =================================================================== RCS file: /cvsroot/libais/libaisutil/include/aisutil/sha1.h,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- sha1.h 4 Aug 2003 04:59:51 -0000 1.12 +++ sha1.h 25 Oct 2003 19:03:06 -0000 1.13 @@ -70,10 +70,31 @@ * * Construct a new digest from the given \p data. The \p data will be * used to generate the digest contained within this structure. - * + * * \param data A raw string of octets to \e hash + * \param length The length of the data (in bytes) + */ + explicit SHA1_Digest(const void* const data, unsigned int length); + + /*! + * \brief Constructor + * + * Construct a new digest from the given \p data. The \p data will be + * used to generate the digest contained within this structure. + * + * \param data A byte string of octets to \e hash */ explicit SHA1_Digest(const std::string& data); + + /*! + * \brief Constructor + * + * Construct a new digest from the given \p data. The \p data will be + * used to generate the digest contained within this structure. + * + * \param data A wide-string of to \e hash + */ + explicit SHA1_Digest(const std::wstring& data); //! Destructor ~SHA1_Digest(void) |