作者ric2k1 (Ric)
看板EE_DSnP
标题Re: [问题] 看不懂程式码的意义
时间Wed Nov 15 23:35:09 2006
※ 引述《ijb ()》之铭言:
: CmdParser::parseCmd(String& option)
: {
: ....
: ....
: string cmd = str.substr(0, n); <--- 从option来的
这里为什麽会跟 "option" 有关啊?
: CmdExec* e = getCmd(cmd);
: if(....)
: else if (n != string::npos) {
: size_t opt = str.find_first_not_of(' ',n); <--- 想请问这句话的意思
请参照 SGI STL 中 string 的 document...
: ....
: ....
: option=str.substr(opt);
: 意思是指 option = cmd的一部份 = option的一部份 ??
什麽??
Anyway, "option" 是 "str" 的一部分...
: 如果是这样str.find_first_not_of(' ',n)的用意是取第一个空白字元後的command吗?
: ^^
不是... 请参照 SGI STL 中 string 的 document...
: 所以TODO的getCmd,针对一连串的指令时,如madd a b 6 23 12
: 要怎麽写对应的状况??在这时候就可以给错了吗?
根据 reference code, "getCmd" 被呼叫时, 参数 "cmd" 只有 command part (e.g.
"madd")... 不晓得为什麽会有你说的这种情况?
: 拉里拉杂的....呃,连我自己都快看不懂了,真囧....
Good luck...
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 59.121.131.138