9 o <<
"********" << std::endl;
10 o <<
"a_unit:" << std::endl;
11 o <<
"********" << std::endl;
12 o <<
"This is a 'unit' class" << std::endl;
14 o <<
"Create a unit:" << std::endl;
15 o <<
"a_unit u" << std::endl;
17 o <<
"Commands:" << std::endl;
18 o <<
"name _name: set full name of unit (example: meter)" << std::endl;
19 o <<
"name: get full name of unit" << std::endl;
20 o <<
"short_name _name: set short name of unit (example: m)" << std::endl;
21 o <<
"short_name: get short name of unit (example: m)" << std::endl;
22 o <<
"ratio _val: set value of 'basic unit' in this custom unit" << std::endl;
23 o <<
"ratio: get value of 'basic unit' in this custom unit" << std::endl;
24 o <<
"print: print parameters" << std::endl;
35 std::istringstream in(line.c_str());
36 std::vector<std::string> vals;
38 std::ostringstream out;
43 if ((!quote)&&(s2.substr(0,1)==
"\""))
50 s3 = s2.substr(1,s2.length()-1);
51 std::string::size_type ii=-1;
52 ii = s3.find_first_of(
"\"");
58 vals.push_back(out.str());
71 s3 = s2.substr(s2.length()-1,1);
76 out <<
" " << s2.substr(0,s2.length()-1);
77 vals.push_back(out.str());
98 std::istringstream in2(out.str().c_str());
104 o <<
"\"" << this->
name() <<
"\" \"";
106 o << this->
ratio() <<
" ";
112 name_ =
"Basic Unit";
static const std::string help()
virtual void write(std::ostream &o) const
static const std::string help()
std::string short_name() const
virtual void read(std::istream &i)
std::cin getline(buf, 256)