qstrlist.h

来自「pixil 最新的嵌入linux 應用程序集,別的地方很難下載」· C头文件 代码 · 共 78 行

H
78
字号
#ifndef QSTRLIST_H#define QSTRLIST_H#include "qstring.h"#include "qarray.h"#include "qcollection.h"#include <vector>class QStrList : public vector<char *>, public QCollection{ protected:  int m_nCurrent;  bool m_bDeepCopies; public:  QStrList(bool deepCopies=true) { m_nCurrent=0; m_bDeepCopies = deepCopies; }  virtual ~QStrList() { }  void append(const char * t) { push_back((char *)t); }  int count() const { return size(); }  bool isEmpty() const { return empty(); }  char * next() {     if(m_nCurrent<(size()-1))      return (*this)[++m_nCurrent];    else      return NULL;  }  int find(const char * c)     {       int i;      for(i=0; i<size(); i++) {	if(!strcmp((*this)[i],c)) {	  m_nCurrent = i;	  	  return i;	}      }        return -1;    }  char *  at(int & i) {     if(i<(size()-1)) {      m_nCurrent = i;      return (*this)[i];    } else {      return NULL;    }  }  int size() const { return (int)vector<char*>::size(); }  char * getLast() const {    if(size())      return (*this)[size()-1];    else      return NULL;  }  char * getFirst() const {    if(size())      return (*this)[0];    else      return NULL;  }  char * first() {    if(size()) {      m_nCurrent = 0;;      return (*this)[0];    } else {      return NULL;    }  }};#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?