Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4InteractorMessenger.cc File Reference
#include <string.h>
#include <stdlib.h>
#include "G4UIdirectory.hh"
#include "G4UIcommand.hh"
#include "G4VInteractiveSession.hh"
#include "G4InteractorMessenger.hh"
Include dependency graph for G4InteractorMessenger.cc:

Go to the source code of this file.

Macros

#define STRDUP(str)   ((str) != NULL ? (strcpy((char*)malloc((unsigned)strlen(str) + 1), str)) : (char*)NULL)
 
#define STRDEL(str)   {if((str)!=NULL) {free(str);str=NULL;}}
 

Functions

static G4bool GetValues (G4String, int, G4String *)
 

Macro Definition Documentation

#define STRDEL (   str)    {if((str)!=NULL) {free(str);str=NULL;}}

Definition at line 38 of file G4InteractorMessenger.cc.

#define STRDUP (   str)    ((str) != NULL ? (strcpy((char*)malloc((unsigned)strlen(str) + 1), str)) : (char*)NULL)

Definition at line 37 of file G4InteractorMessenger.cc.

Function Documentation

G4bool GetValues ( G4String  newValue,
int  paramn,
G4String params 
)
static

Definition at line 165 of file G4InteractorMessenger.cc.

170 {
171  char* value = STRDUP(newValue.data());
172  if(value==NULL) return false;
173  char* tok = strtok(value," ");
174  for( int i=0; i<paramn;i++ ) {
175  if(tok==NULL) {
176  STRDEL(value);
177  return false;
178  }
179  G4String token = tok;
180  if( token(0)=='"' ) {
181  while( token(token.length()-1) != '"' ) {
182  tok = strtok(NULL," ");
183  if( (tok==NULL) || (*tok=='\0')) {
184  STRDEL(value);
185  return false;
186  }
187  token += " ";
188  token += tok;
189  }
190  token = (G4String)token.strip(G4String::both,'"');
191  }
192  if( token.isNull() ) {
193  STRDEL(value);
194  return false;
195  } else {
196  params[i] = token;
197  }
198  tok = strtok(NULL," ");
199  }
200  STRDEL(value);
201  return true;
202 }
G4String strip(G4int strip_Type=trailing, char c=' ')
const XML_Char int const XML_Char * value
Definition: expat.h:331
const char * data() const
#define STRDUP(str)
#define STRDEL(str)
G4bool isNull() const

Here is the call graph for this function:

Here is the caller graph for this function: