]> rtime.felk.cvut.cz Git - boost-statechart-viewer.git/blobdiff - src/stringoper.h
Add support for orthogonal states.
[boost-statechart-viewer.git] / src / stringoper.h
index e2727da893836a8d873b8a165442f943db295c86..b2a9095df5077789e371690afc9f83f54f8c9878 100644 (file)
@@ -88,6 +88,24 @@ string cut_namespaces(string line) /** Cut namespaces from the declarations. */
        return line.substr(i+1);
 }
 
+string cut_namespaces(string line, int ortho) /** Cut namespaces ORTHOGONAL STATES. */
+{
+       int i;
+       int brackets = 0;
+       for(i = line.length()-1;i>0;i--)
+       {
+               if(line[i]=='<') brackets+=1;
+               if(line[i]=='>') brackets-=1;
+               if(line[i]==':' && line[i-1]==':')
+               {
+                       if(brackets == 0) break;
+                       else i--;
+               }
+       }
+       if(i==0) return line;
+       return line.substr(0,i-1);
+}
+
 bool is_derived(const string line) /** Test whether this struct or class is derived */
 {
        unsigned i;
@@ -234,7 +252,7 @@ bool test_model(const string line, const string model) /** Test the string to ha
 string get_params(string line) /** Return parameters of the specified transition */
 {
        int pos_front = line.find("<")+1;
-       int pos_end = line.find(">");
+       int pos_end = line.rfind(">");
        return line.substr(pos_front,pos_end-pos_front);
 }