Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
clop.C File Reference
#include <iostream>
#include <list>
#include <vector>
#include <string>
#include "clop.H"
Include dependency graph for clop.C:

Go to the source code of this file.

Functions

const string stripdir (const string &pname)
 
void AddOp (const string &lo, const char &so)
 
bool CheckOps (const vector< string > &args, string &badop)
 
bool GetOp (const string &ops, const vector< string > &args)
 
bool GetOp (const string &ops, string &rv, const vector< string > &args)
 
vector< string > Vectize (const char **in)
 
vector< string > Vectize (const char **in, int n)
 

Variables

list< clopcloption_list
 

Function Documentation

void AddOp ( const string &  lo,
const char &  so 
)

Definition at line 52 of file clop.C.

References cloption_list.

53 {
54  cloption_list.push_back(clop(lo,so));
55 }
*********************************************************************Illinois Open Source License ****University of Illinois NCSA **Open Source License University of Illinois All rights reserved ****Developed free of to any person **obtaining a copy of this software and associated documentation to deal with the Software without including without limitation the rights to and or **sell copies of the and to permit persons to whom the **Software is furnished to do so
Definition: roccomf90.h:20
list< clop > cloption_list
Definition: clop.C:38
Definition: clop.H:31
bool CheckOps ( const vector< string > &  args,
string &  badop 
)

Definition at line 61 of file clop.C.

References cloption_list.

62 {
63  vector<string>::const_iterator ai = args.begin();
64  ai++;
65  while(ai != args.end()){
66  string option_string;
67  bool found = false;
68  bool longo = false;
69  if((*ai)[0] == '-'){
70  if((*ai)[1] == '-'){
71  longo = true;
72  option_string = (*ai).substr(2);
73  }
74  list<clop>::const_iterator oi = cloption_list.begin();
75  while(oi != cloption_list.end() && !found){
76  if(longo){
77  if(oi->longop() == option_string)
78  found = true;
79  }
80  else
81  if((*ai)[1] == oi->shortop())
82  found = true;
83  oi++;
84  }
85  if(!found){
86  badop = *ai;
87  return(false);
88  }
89  }
90  ai++;
91  }
92  return(true);
93 }
list< clop > cloption_list
Definition: clop.C:38
bool GetOp ( const string &  ops,
const vector< string > &  args 
)

Definition at line 97 of file clop.C.

References cloption_list.

98 {
99  list<clop>::const_iterator oi = cloption_list.begin();
100  bool found = false;
101  while(oi != cloption_list.end() && !found){
102  if(*oi == ops)
103  found = true;
104  else
105  oi++;
106  }
107  if(!found)
108  return(false);
109  vector<string>::const_iterator ai = args.begin();
110  while(ai != args.end()){
111  if((*ai)[0] == '-'){
112  if((*ai)[1] != '-'){
113  if((*ai)[1] == oi->shortop()){
114  return true;
115  }
116  }
117  else if((*ai)[1] == '-'){
118  string op((*ai).substr(2));
119  if(op == oi->longop()){
120  return true;
121  }
122  }
123  }
124  ai++;
125  }
126  return false;
127 }
list< clop > cloption_list
Definition: clop.C:38
bool GetOp ( const string &  ops,
string &  rv,
const vector< string > &  args 
)

Definition at line 132 of file clop.C.

References cloption_list.

133 {
134  rv.erase();
135  list<clop>::const_iterator oi = cloption_list.begin();
136  bool found = false;
137  while(oi != cloption_list.end() && !found){
138  if(*oi == ops)
139  found = true;
140  else
141  oi++;
142  }
143  if(!found){
144  return(false);
145  }
146  vector<string>::const_iterator ai = args.begin();
147  while(ai != args.end()){
148  if((*ai)[0] == '-'){
149  if((*ai)[1] != '-'){
150  if((*ai)[1] == oi->shortop()){
151  ai++;
152  if(ai == args.end())
153  return true;
154  else {
155  if((*ai)[0] != '-')
156  rv = *ai;
157  return true;
158  }
159  }
160  }
161  else if((*ai)[1] == '-'){
162  string op((*ai).substr(2));
163  if(op == oi->longop()){
164  ai++;
165  if(ai == args.end())
166  return true;
167  else {
168  if((*ai)[0] != '-')
169  rv = *ai;
170  return true;
171  }
172  }
173  }
174  }
175  ai++;
176  }
177  return false;
178 }
list< clop > cloption_list
Definition: clop.C:38
const string stripdir ( const string &  pname)

Definition at line 41 of file clop.C.

References x.

42 {
43  string retval;
44  string::size_type x = pname.find("/");
45  if(x == string::npos)
46  return(pname);
47  return(pname.substr(pname.find_last_of("/")+1));
48 }
void int int REAL * x
Definition: read.cpp:74
vector<string> Vectize ( const char **  in)

Definition at line 182 of file clop.C.

References i.

Referenced by main().

183 {
184  vector<string> retVal;
185  int i = 0;
186  while(in[i] != NULL)
187  retVal.push_back(in[i++]);
188  return retVal;
189 }
blockLoc i
Definition: read.cpp:79

Here is the caller graph for this function:

vector<string> Vectize ( const char **  in,
int  n 
)

Definition at line 192 of file clop.C.

References i.

193 {
194  vector<string> retVal;
195  if(n <= 0) return retVal;
196  int i = 0;
197  while((in[i] != NULL) && i < n)
198  retVal.push_back(in[i++]);
199  return retVal;
200 }
blockLoc i
Definition: read.cpp:79
const NT & n

Variable Documentation

list<clop> cloption_list

Definition at line 38 of file clop.C.

Referenced by AddOp(), CheckOps(), and GetOp().