2011년 3월 9일 수요일

txt2ushort


class txt2ushort {
public:
 void push_back(const char * text)
 {
  unsigned short f = (unsigned short) atoi(text);
  m_vf.push_back(f);

  char * p = (char *) text;
  while (*p)
  {
   if (*p == 0x20)
   {
    f = (unsigned short) atoi(p);
    m_vf.push_back(f);
   }

   p++;
  }
 }

 void clear()
 {
  m_vf.clear();
 }

 unsigned short * data()
 {
  return m_vf.data();
 }

 std::vector & get()
 {
  return m_vf;
 }

private:
 std::vector m_vf;
};

댓글 없음: