Main Page   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

makeutilities.h

Go to the documentation of this file.
00001 /******** makeutilities.h **********
00002 $Revision $
00003 $Author: pbergen $
00004 $Date: 2001/05/13 21:56:03 $
00005 ***********************************/
00006 #ifndef _MAKEUTILITIES_H_
00007 #define _MAKEUTILITIES_H_
00008 
00009 #include <stdio.h>
00010 #include <string.h>
00011 
00017 class MakeUtilities
00018 {
00019  public:
00023   MakeUtilities()
00024     {
00025     }
00026 
00030   ~MakeUtilities()
00031     {
00032     }
00033 
00042   static char *strchrReverse(const char *buf,char c)
00043     {
00044       if (!buf || !*buf)
00045         {
00046           return NULL;
00047         }
00048       char *p=(char *)buf+strlen(buf);
00049       while (*p!=c && p>=buf)
00050         {
00051           p--;
00052         }
00053       if (p<buf)
00054         {
00055           return NULL;
00056         }
00057       return p;
00058     }
00059   
00066   static char *getStrCopy(const char *buf, int extraBytes=0)
00067     {
00068       if (!buf)
00069         {
00070           return NULL;
00071         }
00072       char *p=new char[1+strlen(buf)+extraBytes];
00073       strcpy(p,buf);
00074       return p;
00075     }
00076 
00084   static char *changeExtension(const char *fileName, const char *ext)
00085     {
00086       char *newName=MakeUtilities::getStrCopy(fileName,strlen(ext)+1);
00087       char *p=MakeUtilities::strchrReverse(newName,'.');
00088       if (!p)
00089         {
00090           p=newName+strlen(newName)+1;
00091           *p='.';
00092         }
00093       p[1]=0;
00094       strcat(newName,ext);
00095       return newName;
00096     }
00097 };
00098 
00099 #endif
00100 /********************************************
00101 $Log: makeutilities.h,v $
00102 Revision 1.2  2001/05/13 21:56:03  pbergen
00103 Improved dot output.
00104 
00105 Revision 1.3  2001/05/08 14:21:28  pb
00106 Works 100% and lots of new features.
00107 
00108 Revision 1.2  2001/04/28 14:35:10  pb
00109 Added dot-output.
00110 
00111 Revision 1.1  2001/04/28 10:11:19  pb
00112 A -perhaps- working version.
00113 ********************************************/

Generated at Mon May 14 00:45:43 2001 for Maker by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001