basic/geometry/vrml_reader/utility.cpp

Go to the documentation of this file.
00001 #include <string.h>
00002 #include "utility.h"
00003 
00004 static char whiteSpace[] = " \t\x0D\x0A";
00005 
00006 void EatNotWhite( char*& buffer )
00007 {
00008         while( strchr( whiteSpace, *buffer ) == NULL )
00009         {
00010                 buffer++;
00011         }
00012 }
00013 
00014 void EatWhite( char*& buffer )
00015 {
00016         while( strchr( whiteSpace, *buffer ) != NULL )
00017         {
00018                 buffer++;
00019         }
00020 }
00021 
00022 void RemoveAllCommentsFromBuffer( char* buffer, const int size )
00023 {
00024         //comments exsit from a # character to the end of a line
00025         bool replace = false;
00026         char* index;
00027         for( index = buffer; index != buffer + size; index++ )
00028         {
00029                 if( *index == '#' )
00030                 {
00031                         replace = true;
00032                 }
00033                 if( *index == '\n' )            //this is the linefeed character
00034                 {
00035                         replace = false;
00036                 }
00037                 if( replace == true )
00038                 {
00039                         *index = ' ';
00040                 }
00041         }
00042         return;
00043 }
00044 

Generated on Sat Apr 1 21:30:33 2006 for Motion Planning Kernel by  doxygen 1.4.6-NO