Haha, no, not homework. Just a project I'm working on. :)
Thanks for that extensive piece of code. I'll try to give it a shot
tomorrow.. Right now, I'm going to go to sleep.
Thanks again. :)
2008/8/21 Warren Young <mysqlpp@stripped>
> Alex wrote:
>
>>
>> So you can understand that I wouldn't be able to directly refer to the
>> specific command the user wants help for as the vector is split up in
>> numbers.
>>
>
> I understand no such thing. The answer is simple either way:
>
> Query q = conn.query("SELECT * FROM command WHERE NAME =");
> q << quote << myCommandName;
> StoreQueryResult res = q.store();
> if (res) {
> // have help for this command
> }
> else {
> // don't have help for this command
> }
>
> Or:
>
> class command {
> public:
> command(const char* name, const char* help = 0,
> const char* syntax = 0) :
> name_(name),
> help_(help ? help : ""),
> syntax_(syntax ? syntax : "")
> {
> }
> ....
> bool operator==(const command& rhs)
> {
> return name_ == rhs.name_;
> }
> private:
> string name_, help_, syntax_;
> };
>
> vector<commands> vc;
>
> // populate vector of command objects somehow
>
> vector<commands>::iterator it = find(vc.begin(), vc.end(),
> command(myCommandName));
> if (it != vc.end()) {
> // have help for this command
> }
> else {
> // don't have help for this command
> }
>
> So, is this a homework problem, or what?
>
>
> --
> MySQL++ Mailing List
> For list archives: http://lists.mysql.com/plusplus
> To unsubscribe:
> http://lists.mysql.com/plusplus?unsub=1
>
>
--
GamerzWoW - http://www.gamerzwow.net