~ace17/shrutictrl/trunk

« back to all changes in this revision

Viewing changes to common.cpp

  • Committer: Sebastien Alaiwan
  • Date: 2015-12-25 21:09:48 UTC
  • Revision ID: sebastien.alaiwan@gmail.com-20151225210948-vdgjq6dwzz0se0vm
Use Array

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
{
10
10
  try
11
11
  {
12
 
    queue<string> args;
 
12
    vector<string> args;
13
13
    for(int i=0;i < argc;++i)
14
 
      args.push(argv[i]);
15
 
    safe_main(args);
 
14
      args.push_back(argv[i]);
 
15
    safe_main(asArray(args));
16
16
  }
17
17
  catch(runtime_error const& e)
18
18
  {
20
20
  }
21
21
}
22
22
 
23
 
string getString(queue<string>& args)
 
23
string getString(Array<string>& args)
24
24
{
25
25
  if(args.empty())
26
26
    throw runtime_error("Incomplete command line");
27
 
  string s = args.front();
28
 
  args.pop();
 
27
  string s = args[0];
 
28
  args = args.sub(1);
29
29
  return s;
30
30
}
31
31
 
32
 
int getInt(queue<string>& args)
 
32
int getInt(Array<string>& args)
33
33
{
34
34
  return atoi(getString(args).c_str());
35
35
}