-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMapzUtil.cpp
69 lines (59 loc) · 1.44 KB
/
MapzUtil.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#include <string>
#include <iostream>
#include "MapzUtil.h"
#include <vector>
using namespace std;
long MapzUtil::ver = 100000001l;
MapzUtil::MapzUtil():name(string("default")){
};
MapzUtil::MapzUtil(string &nm){
name = nm;
};
MapzUtil::MapzUtil(const MapzUtil &m){
name = m.name;
};
MapzUtil::~MapzUtil(){
};
ostream& operator<<(ostream &os, const MapzUtil &MU){
os << MU.name;
return os;
};
MapzUtil operator+(MapzUtil &mu1,MapzUtil &mu2){
string name_new = mu1.name + mu2.name;
MapzUtil mu3 = MapzUtil(name_new);
return mu3;
}
void MapzUtil::addStrToVec
(vector<string>::iterator &beg,vector<string>::iterator &end,strConvert func){
while(beg!=end){
*beg += func(*beg);
beg++;
}
}
string MapzUtil::eachPlusOne(string &str){
string::iterator si = str.begin();
while(si!=str.end()){
*si++ += 1;
}
return str;
}
void MapzUtil::showVector(vector<int> &iv){
vector<int>::iterator i = iv.begin();
cout << "======beginning of vector======" <<endl;
while(i!=iv.end())
cout<<*i++<<endl;
cout << "=========end of vector=========" <<endl;
};
void MapzUtil::showVector(vector<string> &sv){
vector<string>::iterator i = sv.begin();
cout << "======beginning of vector======" <<endl;
while(i!=sv.end())
cout<<*i++<<endl;
cout << "=========end of vector=========" <<endl;
};
long MapzUtil::getVer(){
return ver;
};
string MapzUtil::getName(){
return name;
};