source: trunk/examples/advanced/radiation_monitor/generalPurpose/src/RadmonTokenizer.cc@ 1345

Last change on this file since 1345 was 807, checked in by garnier, 17 years ago

update

File size: 2.8 KB
Line 
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26//
27// File name: RadmonTokenizer.cc
28// Creation date: Sep 2005
29// Main author: Riccardo Capra <capra@ge.infn.it>
30//
31// Id: $Id: RadmonTokenizer.cc,v 1.3 2006/06/29 16:14:49 gunter Exp $
32// Tag: $Name: $
33//
34
35// Include files
36#include "RadmonTokenizer.hh"
37
38G4String RadmonTokenizer :: operator()(const char * separators, const char * quotations)
39{
40 size_t i;
41 char c;
42
43 while (position<data.size())
44 {
45 i=0;
46 c=data[position];
47
48 while (separators[i]!=0)
49 {
50 if (c==separators[i])
51 break;
52
53 i++;
54 }
55
56 if (separators[i]==0)
57 break;
58
59 position++;
60 }
61
62 if (position>=data.size())
63 return G4String();
64
65 i=0;
66 while (quotations[i]!=0)
67 {
68 if (c==quotations[i])
69 break;
70
71 i++;
72 }
73
74 char pattern[2];
75
76 if (quotations[i]!=0)
77 {
78 pattern[0]=quotations[i];
79 pattern[1]=0;
80
81 separators=pattern;
82 position++;
83 }
84
85 str_size start(position);
86
87 while (position<data.size())
88 {
89 i=0;
90 c=data[position];
91
92 while (separators[i]!=0)
93 {
94 if (c==separators[i])
95 break;
96
97 i++;
98 }
99
100 if (separators[i]!=0)
101 break;
102
103 position++;
104 }
105
106 str_size stop(position);
107 position++;
108
109 return data(start, stop-start);
110}
Note: See TracBrowser for help on using the repository browser.