4 #ifndef ROOT_TSchemaRuleProcessor 5 #define ROOT_TSchemaRuleProcessor 18 #ifndef R__TSCHEMATYPE_H 29 std::list<std::string>&
result,
34 std::string::size_type curr;
35 std::string::size_type last = 0;
36 std::string::size_type size;
41 while( last != source.size() ) {
42 curr = source.find( delimiter, last );
44 if( curr == std::string::npos ) {
45 curr = source.size()-1;
48 else size = curr-last;
50 elem =
Trim( source.substr( last, size ) );
52 result.push_back( elem );
59 std::list<std::pair<ROOT::Internal::TSchemaType,std::string> >&
result)
65 std::string::size_type curr;
66 std::string::size_type last = 0;
67 std::string::size_type size;
74 while( last != source.size() ) {
76 curr = source.find(
';', last );
78 if( curr == std::string::npos ) {
79 curr = source.size()-1;
82 else size = curr-last;
85 elem =
Trim( source.substr( last, size ) );
87 unsigned int level = 0;
91 for(std::string::size_type j=elem.size(); j>0; --j) {
92 std::string::size_type i = j-1;
93 if (elem[i]==
'<') { ++level; }
94 else if (elem[i]==
'>') {
if (level==0) {
continue; } ; --level; }
95 else if (level == 0 && isspace(elem[i])) {
96 type = elem.substr( 0, i );
98 while( elem[i]==
'*' || elem[i]==
'&' || isspace(elem[i]) ) {
100 if (strcmp(
"const",elem.c_str()+i)==0 && (i+5)>elem.size()
101 && ( elem[i+5]==
'*' || elem[i+5]==
'&' || isspace(elem[i+5])) ) {
104 }
else if (elem[i]==
'*' || elem[i]==
'&') {
108 std::string::size_type endvar = i;
109 while( endvar!=elem.size() && elem[endvar] !=
'[' ) {
112 if (endvar != elem.size() ) {
113 dims =
Trim( elem.substr(endvar, elem.size()-endvar) );
115 elem =
Trim( elem.substr(i, endvar-i) );
126 static std::string
Trim(
const std::string& source )
131 std::string::size_type start, end;
132 for( start = 0; start < source.size(); ++start) {
133 if ( isspace(source[start]) ) {
135 }
else if ( source[start] ==
'\\' && (start+1)<source.size() && (source[start+1]==
'\n' || source[start+1]==
'\r') ) {
143 if( start == source.size() )
145 for( end = source.size()-1; end > start; --end ) {
146 if ( (source[end]==
'\n' || source[end]==
'\r') && end > (start+1) && source[end-1] ==
'\\' ) {
149 }
else if ( isspace(source[end]) ) {
156 return source.substr( start, end-start+1 );
161 std::pair<Int_t, Int_t>&
result )
172 std::string::size_type hyphenI;
176 std::string version =
Trim( source );
178 if( version.empty() )
184 if( version ==
"*" ) {
186 result.second = 50000;
194 hyphenI = version.find(
'-' );
195 if( hyphenI == std::string::npos &&
IsANumber( version ) ) {
196 result.first = result.second = atoi( version.c_str() );
204 second =
Trim( version.substr( 1 ) );
207 result.second = atoi( second.c_str() );
215 if( hyphenI == version.size()-1 ) {
216 first =
Trim( version.substr( 0, version.size()-1 ) );
218 result.first = atoi( first.c_str() );
219 result.second = 50000;
227 first =
Trim( version.substr( 0, hyphenI ) );
228 second =
Trim( version.substr( hyphenI+1, version.size()-hyphenI-1 ) );
230 result.first = atoi( first.c_str() );
231 result.second = atoi( second.c_str() );
246 std::string::size_type i;
247 for( i = 0; i < source.size(); ++i )
248 if( !isdigit( source[i] ) )
255 #endif // defined(__CINT__) 257 #endif // ROOT_TSchemaRuleProcessor This namespace contains pre-defined functions to be used in conjuction with TExecutor::Map and TExecu...
static bool IsANumber(const std::string &source)
static void SplitDeclaration(const std::string &source, std::list< std::pair< ROOT::Internal::TSchemaType, std::string > > &result)
static void SplitList(const std::string &source, std::list< std::string > &result, char delimiter=',')
static std::string Trim(const std::string &source)
static bool ProcessVersion(const std::string &source, std::pair< Int_t, Int_t > &result)