Changeset 4223 in orxonox.OLD for orxonox/branches/physics/src/lib
- Timestamp:
- May 19, 2005, 7:45:28 PM (20 years ago)
- Location:
- orxonox/branches/physics/src/lib
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/physics/src/lib/Makefile.in
r4178 r4223 183 183 esac; \ 184 184 done; \ 185 echo ' cd $(top_srcdir) && $(AUTOMAKE) -- foreignsrc/lib/Makefile'; \185 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/Makefile'; \ 186 186 cd $(top_srcdir) && \ 187 $(AUTOMAKE) -- foreignsrc/lib/Makefile187 $(AUTOMAKE) --gnu src/lib/Makefile 188 188 .PRECIOUS: Makefile 189 189 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status -
orxonox/branches/physics/src/lib/graphics/Makefile.in
r4178 r4223 177 177 esac; \ 178 178 done; \ 179 echo ' cd $(top_srcdir) && $(AUTOMAKE) -- foreignsrc/lib/graphics/Makefile'; \179 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/graphics/Makefile'; \ 180 180 cd $(top_srcdir) && \ 181 $(AUTOMAKE) -- foreignsrc/lib/graphics/Makefile181 $(AUTOMAKE) --gnu src/lib/graphics/Makefile 182 182 .PRECIOUS: Makefile 183 183 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status -
orxonox/branches/physics/src/lib/graphics/importer/Makefile.in
r4178 r4223 235 235 esac; \ 236 236 done; \ 237 echo ' cd $(top_srcdir) && $(AUTOMAKE) -- foreignsrc/lib/graphics/importer/Makefile'; \237 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/graphics/importer/Makefile'; \ 238 238 cd $(top_srcdir) && \ 239 $(AUTOMAKE) -- foreignsrc/lib/graphics/importer/Makefile239 $(AUTOMAKE) --gnu src/lib/graphics/importer/Makefile 240 240 .PRECIOUS: Makefile 241 241 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status -
orxonox/branches/physics/src/lib/gui/Makefile.in
r4178 r4223 179 179 esac; \ 180 180 done; \ 181 echo ' cd $(top_srcdir) && $(AUTOMAKE) -- foreignsrc/lib/gui/Makefile'; \181 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/gui/Makefile'; \ 182 182 cd $(top_srcdir) && \ 183 $(AUTOMAKE) -- foreignsrc/lib/gui/Makefile183 $(AUTOMAKE) --gnu src/lib/gui/Makefile 184 184 .PRECIOUS: Makefile 185 185 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status -
orxonox/branches/physics/src/lib/gui/console/Makefile.in
r4178 r4223 205 205 esac; \ 206 206 done; \ 207 echo ' cd $(top_srcdir) && $(AUTOMAKE) -- foreignsrc/lib/gui/console/Makefile'; \207 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/gui/console/Makefile'; \ 208 208 cd $(top_srcdir) && \ 209 $(AUTOMAKE) -- foreignsrc/lib/gui/console/Makefile209 $(AUTOMAKE) --gnu src/lib/gui/console/Makefile 210 210 .PRECIOUS: Makefile 211 211 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status -
orxonox/branches/physics/src/lib/gui/gui/Makefile.in
r4178 r4223 265 265 esac; \ 266 266 done; \ 267 echo ' cd $(top_srcdir) && $(AUTOMAKE) -- foreignsrc/lib/gui/gui/Makefile'; \267 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/gui/gui/Makefile'; \ 268 268 cd $(top_srcdir) && \ 269 $(AUTOMAKE) -- foreignsrc/lib/gui/gui/Makefile269 $(AUTOMAKE) --gnu src/lib/gui/gui/Makefile 270 270 .PRECIOUS: Makefile 271 271 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status -
orxonox/branches/physics/src/lib/util/substring.cc
r4178 r4223 22 22 #include "substring.h" 23 23 24 #include <string.h> 25 #include <assert.h> 26 24 27 SubString::SubString( const char* string) 25 28 { 26 29 n = 0; 27 30 28 31 assert( string != NULL); 29 32 30 33 for( int i = 0; i < strlen(string); i++) if( string[i] == ',') n++; 31 34 32 35 n += 1; 33 36 34 strings = new char*[n]; 37 strings = new char*[n]; 38 39 assert (strings != NULL); 35 40 36 assert( strings != NULL); 41 int i = 0; 42 int l = 0; 37 43 38 int i = 0; 39 int l = 0; 44 const char* offset = string; 45 char* end = strchr( string, ','); 46 while( end != NULL) 47 { 48 assert( i < n); 49 l = end - offset; 50 strings[i] = new char[l + 1]; 51 assert( strings[i] != NULL); 52 strncpy( strings[i], offset, l); 53 strings[i][l] = 0; 54 i++; 55 end++; 56 offset = end; 57 end = strchr( offset, ','); 58 } 40 59 41 const char* offset = string; 42 char* end = strchr( string, ','); 43 while( end != NULL) 44 { 45 assert( i < n); 46 l = end - offset; 47 strings[i] = new char[l + 1]; 48 assert( strings[i] != NULL); 49 strncpy( strings[i], offset, l); 50 strings[i][l] = 0; 51 i++; 52 end++; 53 offset = end; 54 end = strchr( offset, ','); 55 } 56 57 strings[i] = new char[l + 1]; 58 l = strlen( offset); 59 strncpy( strings[i], offset, l); 60 strings[i][l] = 0; 60 strings[i] = new char[l + 1]; 61 l = strlen( offset); 62 strncpy( strings[i], offset, l); 63 strings[i][l] = 0; 61 64 } 62 65 … … 66 69 SubString::~SubString() 67 70 { 68 69 70 71 71 for( int i = 0; i < n; i++) 72 { 73 delete strings[i]; 74 } 72 75 73 76 delete strings; 74 77 } 75 78 … … 78 81 \returns the amount of substrings 79 82 */ 80 int SubString::get N()83 int SubString::getCount() 81 84 { 82 85 return n; 83 86 } 84 87 … … 90 93 const char* SubString::getString( int i) 91 94 { 92 93 95 if( i < n && i >= 0) return strings[i]; 96 else return NULL; 94 97 } -
orxonox/branches/physics/src/lib/util/substring.h
r4178 r4223 1 1 /*! 2 3 2 \file substring.h 3 \brief a small class to get the parts of a string separated by commas 4 4 */ 5 5 … … 7 7 #define _SUBSTRING_H 8 8 9 #include "stdincl.h"10 11 9 class SubString 12 10 { 13 11 public: 14 12 15 16 13 SubString( const char* string); 14 ~SubString(); 17 15 18 int getN();19 16 int getCount(); 17 const char* getString( int i); 20 18 21 22 23 19 private: 20 char** strings; 21 int n; 24 22 }; 25 23
Note: See TracChangeset
for help on using the changeset viewer.