view src/win32/StringTokenizer.cpp @ 8:08a8e09ca414

add files required by automake
author Robert McIntyre <rlm@mit.edu>
date Sat, 03 Mar 2012 10:54:39 -0600
parents f9f4f1b99eed
children
line wrap: on
line source
1 // StringTokenizer.cpp: implementation of the StringTokenizer class.
2 //
3 //////////////////////////////////////////////////////////////////////
5 #include "stdafx.h"
6 #include "StringTokenizer.h"
8 //////////////////////////////////////////////////////////////////////
9 // Construction/Destruction
10 //////////////////////////////////////////////////////////////////////
12 StringTokenizer::StringTokenizer(CString str, CString del)
13 {
14 m_right = str;
15 m_delim = del;
16 }
18 StringTokenizer::~StringTokenizer()
19 {}
21 const char *StringTokenizer::next()
22 {
23 int index = m_right.FindOneOf(m_delim);
25 while (index == 0)
26 {
27 m_right = m_right.Right(m_right.GetLength()-1);
28 index = m_right.FindOneOf(m_delim);
29 }
30 if (index == -1)
31 {
32 if (m_right.IsEmpty())
33 return NULL;
34 m_token = m_right;
35 m_right.Empty();
36 return m_token;
37 }
39 m_token = m_right.Left(index);
40 m_right = m_right.Right(m_right.GetLength()-(1+index));
42 return m_token;
43 }