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

ArArgumentBuilder.h

00001 /*
00002 MobileRobots Advanced Robotics Interface for Applications (ARIA)
00003 Copyright (C) 2004, 2005 ActivMedia Robotics LLC
00004 Copyright (C) 2006, 2007 MobileRobots Inc.
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 MobileRobots for information about a commercial version of ARIA at 
00022 robots@mobilerobots.com or 
00023 MobileRobots Inc, 19 Columbia Drive, Amherst, NH 03031; 800-639-9481
00024 */
00025 
00026 #ifndef ARARGUMENTBUILDER_H
00027 #define ARARGUMENTBUILDER_H
00028 
00029 #include "ariaTypedefs.h"
00030 
00032 class ArArgumentBuilder
00033 {
00034 public:
00036   AREXPORT ArArgumentBuilder(size_t argvLen = 512, char extraSpaceChar = '\0');
00038   AREXPORT ArArgumentBuilder(const ArArgumentBuilder &builder);
00040   AREXPORT virtual ~ArArgumentBuilder();
00041 #ifndef SWIG
00042 
00045   AREXPORT void add(const char *str, ...);
00046 #endif
00047 
00048   AREXPORT void addPlain(const char *str, int position = -1);
00050   AREXPORT void addPlainAsIs(const char *str, int position = -1);
00052   AREXPORT void addStrings(char **argv, int argc, int position = -1);
00054   AREXPORT void addStrings(int argc, char **argv, int position = -1);
00056   AREXPORT void addStringsAsIs(int argc, char **argv, int position = -1);
00058   AREXPORT const char *getFullString(void) const;
00060   AREXPORT void setFullString(const char *str);
00062   AREXPORT const char *getExtraString(void) const;
00064   AREXPORT void setExtraString(const char *str);
00066   AREXPORT void log(void) const;
00068   AREXPORT size_t getArgc(void) const;
00070   AREXPORT char** getArgv(void) const;
00072   AREXPORT const char* getArg(size_t whichArg) const;
00074   AREXPORT bool isArgBool(size_t whichArg) const;
00076   AREXPORT bool getArgBool(size_t whichArg) const;
00078   AREXPORT bool isArgInt(size_t whichArg) const;
00080   AREXPORT int getArgInt(size_t whichArg) const;
00082   AREXPORT bool isArgDouble(size_t whichArg) const;
00084   AREXPORT double getArgDouble(size_t whichArg) const;
00086   AREXPORT void removeArg(size_t which);
00088   AREXPORT void compressQuoted(bool stripQuotationMarks = false);
00089 protected:
00090   AREXPORT void internalAdd(const char *str, int position = -1);
00091   AREXPORT void internalAddAsIs(const char *str, int position = -1);
00092   size_t getArgvLen(void) const { return myArgvLen; }
00093   // how many arguments we had originally (so we can delete 'em)
00094   size_t myOrigArgc;
00095   // how many arguments we have
00096   size_t myArgc;
00097   // argument list
00098   char **myArgv;
00099   // argv length
00100   size_t myArgvLen;
00101   // the extra string (utility thing)
00102   std::string myExtraString;
00103   // the full string
00104   std::string myFullString;
00105   // whether this is our first add or not
00106   bool myFirstAdd;
00107   // a character to alternately treat as a space
00108   char myExtraSpace;
00109 };
00110 
00111 #endif // ARARGUMENTBUILDER_H

Generated on Tue Feb 20 10:51:38 2007 for Aria by  doxygen 1.4.0