Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7403 in orxonox.OLD for trunk/src/lib/lang


Ignore:
Timestamp:
Apr 27, 2006, 5:49:12 PM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: more exists functions to ClassList, and improved shellcompletion

Location:
trunk/src/lib/lang
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/lang/class_list.cc

    r7396 r7403  
    249249    if (cl != NULL)
    250250    {
    251       std::list<BaseObject*>::const_iterator bo = find (cl->objectList.begin(), cl->objectList.end(), object);
     251      std::list<BaseObject*>::const_iterator bo = std::find (cl->objectList.begin(), cl->objectList.end(), object);
    252252      return (bo != cl->objectList.end());
    253253    }
     
    258258    for (cl = ClassList::classList->begin(); cl != ClassList::classList->end(); cl++)
    259259    {
    260       std::list<BaseObject*>::const_iterator bo = find ((*cl).objectList.begin(), (*cl).objectList.end(), object);
     260      std::list<BaseObject*>::const_iterator bo = std::find ((*cl).objectList.begin(), (*cl).objectList.end(), object);
    261261      if (bo != (*cl).objectList.end())
    262262        return true;
     
    265265  return false;
    266266}
     267
     268bool ClassList::exists(const std::string& className, const std::string& objectName)
     269{
     270  ClassList* cl = ClassList::getClassList(className);
     271  if (likely(cl != NULL))
     272  {
     273    std::list<BaseObject*>::iterator bo;
     274    for (bo = cl->objectList.begin(); bo != cl->objectList.end(); bo++)
     275      if ((*bo)->getName() != NULL && objectName == (*bo)->getName())
     276        return true;
     277  }
     278  return false;
     279}
     280
    267281
    268282/**
  • trunk/src/lib/lang/class_list.h

    r7221 r7403  
    4747    static BaseObject*                    getObject(const std::string& name, ClassID classID = CL_NULL);
    4848    static bool                           exists(const BaseObject* object, ClassID classID = CL_NULL);
     49    static bool                           exists(const std::string& className, const std::string& objectName);
    4950
    5051    void                                  sendBack(std::list<BaseObject*>::const_iterator it);
Note: See TracChangeset for help on using the changeset viewer.