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

Tools/StringFunctions.cpp

Go to the documentation of this file.
00001 /**
00002 * @file StringFunctions.cpp
00003 *
00004 * Implementation of common string functions
00005 *
00006 * @author Uwe Düffert
00007 */
00008 
00009 #include "StringFunctions.h"
00010 #include <string.h>
00011 
00012 void getYabslString(char* dstYabsl, const char* src)
00013 {
00014 /** @todo Header/Xabsl interpretation differences:
00015 * tail-mode.TAIL-center/left/right-*
00016 * top.left/right-ONLY
00017 * *-paw-kick-forward vs. paw-kick-with-*-forward
00018 * start-me-UP
00019 * HEAD-CONTROL-MODE.*
00020   */
00021   unsigned int i=0;
00022   unsigned int j=0;
00023   char lastChar='A';
00024   int charsSinceLastMinus=0;
00025   while (i<strlen(src))
00026   {
00027     if (((lastChar<'A')||(lastChar>'Z'))&&(src[i]>='A')&&(src[i]<='Z'))
00028     {
00029       lastChar=src[i]|0x20; 
00030       if (charsSinceLastMinus > 1)
00031       {
00032         dstYabsl[j++]='_';
00033         charsSinceLastMinus=0;
00034       }
00035       dstYabsl[j++]=src[i++]|0x20;
00036       dstYabsl[j]=0;
00037       charsSinceLastMinus++;
00038     }
00039     else
00040     {
00041       lastChar=src[i];
00042       dstYabsl[j++]=src[i++];
00043       dstYabsl[j]=0;
00044       charsSinceLastMinus++;
00045     }
00046   }
00047 }
00048 
00049 void getXmlString(char* dstYabsl, const char* src)
00050 {
00051 /** @todo Header/Xabsl interpretation differences:
00052 * tail-mode.TAIL-center/left/right-*
00053 * top.left/right-ONLY
00054 * *-paw-kick-forward vs. paw-kick-with-*-forward
00055 * start-me-UP
00056 * HEAD-CONTROL-MODE.*
00057   */
00058   unsigned int i=0;
00059   unsigned int j=0;
00060   char lastChar='A';
00061   int charsSinceLastMinus=0;
00062   while (i<strlen(src))
00063   {
00064     if (((lastChar<'A')||(lastChar>'Z'))&&(src[i]>='A')&&(src[i]<='Z'))
00065     {
00066       lastChar=src[i]|0x20; 
00067       if (charsSinceLastMinus > 1)
00068       {
00069         dstYabsl[j++]='-';
00070         charsSinceLastMinus=0;
00071       }
00072       dstYabsl[j++]=src[i++]|0x20;
00073       dstYabsl[j]=0;
00074       charsSinceLastMinus++;
00075     }
00076     else
00077     {
00078       lastChar=src[i];
00079       dstYabsl[j++]=src[i++];
00080       dstYabsl[j]=0;
00081       charsSinceLastMinus++;
00082     }
00083   }
00084 }

Generated on Mon Mar 20 22:00:09 2006 for GT2005 by doxygen 1.3.6