Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
15747 anikendra 1
/************************************************************************
2
The zlib/libpng License
3
 
4
Copyright (c) 2006 Joerg Wiedenmann
5
 
6
This software is provided 'as-is', without any express or implied warranty.
7
In no event will the authors be held liable for any damages arising from
8
the use of this software.
9
 
10
Permission is granted to anyone to use this software for any purpose,
11
including commercial applications, and to alter it and redistribute it
12
freely, subject to the following restrictions:
13
 
14
1. The origin of this software must not be misrepresented;
15
	you must not claim that you wrote the original software.
16
	If you use this software in a product, an acknowledgment
17
	in the product documentation would be appreciated but is
18
	not required.
19
 
20
2. Altered source versions must be plainly marked as such,
21
	and must not be misrepresented as being the original software.
22
 
23
3. This notice may not be removed or altered from any source distribution.
24
 
25
***********************************************************************/
26
 
27
/********************************************************************
28
	created:	2006-01-28
29
	filename: 	tokenizer.cpp
30
	author:		Jörg Wiedenmann
31
 
32
	purpose:	A tokenizer function which provides a very
33
				customizable way of breaking up strings.
34
*********************************************************************/
35
 
36
#include <vector>
37
#include <string>
38
using namespace std;
39
 
40
// Function to break up a string into tokens
41
//
42
// Parameters:
43
//-----------
44
// str = the input string that will be tokenized
45
// result = the tokens for str
46
// delimiters = the delimiter characters
47
// delimiters preserve = same as above, but the delimiter characters
48
//		will be put into the result as a token
49
// quote = characters to protect the enclosed characters
50
// esc = characters to protect a single character
51
//
52
 
53
void tokenize ( const string& str, vector<string>& result,
54
			const string& delimiters, const string& delimiters_preserve = "",
55
			const string& quote = "\"", const string& esc = "\\" );