Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

ArArgumentBuilder.h

00001 /*
00002 ActivMedia Robotics Interface for Applications (ARIA)
00003 Copyright (C) 2004,2005 ActivMedia Robotics, LLC
00004 
00005 
00006      This program is free software; you can redistribute it and/or modify
00007      it under the terms of the GNU General Public License as published by
00008      the Free Software Foundation; either version 2 of the License, or
00009      (at your option) any later version.
00010 
00011      This program is distributed in the hope that it will be useful,
00012      but WITHOUT ANY WARRANTY; without even the implied warranty of
00013      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014      GNU General Public License for more details.
00015 
00016      You should have received a copy of the GNU General Public License
00017      along with this program; if not, write to the Free Software
00018      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 
00020 If you wish to redistribute ARIA under different terms, contact 
00021 ActivMedia Robotics for information about a commercial version of ARIA at 
00022 robots@activmedia.com or 
00023 ActivMedia Robotics, 19 Columbia Drive, Amherst, NH 03031; 800-639-9481
00024 
00025 */
00026 
00027 #ifndef ARARGUMENTBUILDER_H
00028 #define ARARGUMENTBUILDER_H
00029 
00030 #include "ariaTypedefs.h"
00031 
00033 class ArArgumentBuilder
00034 {
00035 public:
00037   ArArgumentBuilder(size_t argvLen = 512);
00039   ArArgumentBuilder(const ArArgumentBuilder &builder);
00041   virtual ~ArArgumentBuilder();
00042 #ifndef SWIG
00043 
00044   void add(const char *str, ...);
00045 #endif
00046 
00047   void addPlain(const char *str, int position = -1);
00049   void addStrings(char **argv, int argc, int position = -1);
00051   void addStrings(int argc, char **argv, int position = -1);
00053   const char *getFullString(void) const;
00055   void setFullString(const char *str);
00057   const char *getExtraString(void) const;
00059   void setExtraString(const char *str);
00061   void log(void) const;
00063   size_t getArgc(void) const;
00065   char** getArgv(void) const;
00067   const char* getArg(size_t whichArg) const;
00069   bool isArgBool(size_t whichArg) const;
00071   bool getArgBool(size_t whichArg) const;
00073   bool isArgInt(size_t whichArg) const;
00075   int getArgInt(size_t whichArg) const;
00077   bool isArgDouble(size_t whichArg) const;
00079   double getArgDouble(size_t whichArg) const;
00081   void removeArg(size_t which);
00083   void compressQuoted(bool stripQuotationMarks = false);
00084 protected:
00085   void ArArgumentBuilder::internalAdd(const char *str, 
00086                                                int position = -1);
00087   size_t getArgvLen(void) const { return myArgvLen; }
00088   // how many arguments we had originally (so we can delete 'em)
00089   size_t myOrigArgc;
00090   // how many arguments we have
00091   size_t myArgc;
00092   // argument list
00093   char **myArgv;
00094   // argv length
00095   size_t myArgvLen;
00096   // the extra string (utility thing)
00097   std::string myExtraString;
00098   // the full string
00099   std::string myFullString;
00100   // whether this is our first add or not
00101   bool myFirstAdd;
00102 };
00103 
00104 #endif // ARARGUMENTBUILDER_H

Generated on Wed Oct 19 12:56:34 2005 for Aria by  doxygen 1.4.0