Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Add check if multiple properties should be found.
[xestiacalendar/.git] / source / common / text.cpp
1 #include "text.h"
3 using namespace std;
5 multimap<string, string> ProcessTextVectors(vector<string> *TextProperties,
6         vector<string> *TextValues,
7         bool SearchMultiple,
8         string Property){
9         
10         multimap<string,string> ProcessResult;
11                 
12         // Go through each of the values.
13                 
14         int TextSeekCount = 0;
15         int TextPropertySize = 0;
16         int PropertySeekCount = 0;
17         string PropertyName = "";
18         int PropertyNameSize = 0;
19         char BufferChar = 0;
20                 
21         for (vector<string>::iterator iter = TextProperties->begin();
22                 iter != TextProperties->end(); iter++){
23                 
24                 TextPropertySize = iter->size();
25                         
26                 if (TextPropertySize == 0){
27                         
28                         // Text property size is 0. Go to the next
29                         // pair.
30                         
31                         continue;
32                         
33                 }
34                         
35                 // Get the property data up to the first semi-colon.
36                 
37                 while (TextSeekCount < TextPropertySize){
38                 
39                         BufferChar = (*iter)[TextSeekCount];
40                         
41                         if (BufferChar == ';'){
42                                 break;
43                         }
44                         
45                         PropertyName += BufferChar;
46                         
47                         TextSeekCount++;
48                         
49                 }
50                 
51                 if (*iter == Property || PropertyName == Property){
52                         
53                         ProcessResult.insert(make_pair((*TextProperties)[PropertySeekCount], 
54                                 (*TextValues)[PropertySeekCount]));
55                         
56                         // Check to continue if one is found.
57                         
58                         if (SearchMultiple == false){
59                                 
60                                 // Found one, don't search for anymore.
61                                 
62                                 break;
63                                 
64                         }
65                         
66                 }
67                         
68                 PropertySeekCount++;
69                 TextPropertySize = 0;
70                 TextSeekCount = 0;
71                 PropertyName.clear();
72                         
73         }
74                 
75         return ProcessResult;
76                 
77 }
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy