Bincimap 2.0.16
Easy Imapping
Loading...
Searching...
No Matches
convert.cc
Go to the documentation of this file.
1
7#include "convert.h"
8#include <string>
9
10using namespace ::std;
11using namespace Binc;
12
13//------------------------------------------------------------------------
15{
16}
17
18//------------------------------------------------------------------------
20{
21 clear();
22}
23
24//------------------------------------------------------------------------
25string BincStream::popString(unsigned int size)
26{
27 if (size > nstr.length())
28 size = nstr.length();
29 string tmp = nstr.substr(0, size);
30 nstr = nstr.substr(size);
31 return tmp;
32}
33
34//------------------------------------------------------------------------
36{
37 if (nstr.length() == 0)
38 return '\0';
39
40 char c = nstr[0];
41 nstr = nstr.substr(1);
42 return c;
43}
44
45//------------------------------------------------------------------------
47{
48 nstr = c + nstr;
49}
50
51//------------------------------------------------------------------------
52void BincStream::unpopStr(const string &s)
53{
54 nstr = s + nstr;
55}
56
57//------------------------------------------------------------------------
58const string &BincStream::str(void) const
59{
60 return nstr;
61}
62
63//------------------------------------------------------------------------
65{
66 nstr = "";
67}
68
69//------------------------------------------------------------------------
70unsigned int BincStream::getSize(void) const
71{
72 return (unsigned int) nstr.length();
73}
74
75//------------------------------------------------------------------------
76BincStream &BincStream::operator << (std::ostream&(*)(std::ostream&))
77{
78 nstr += "\r\n";
79 return *this;
80}
81
82//------------------------------------------------------------------------
84{
85 nstr += t;
86 return *this;
87}
88
89//------------------------------------------------------------------------
91{
92 nstr += toString(t);
93 return *this;
94}
95
96//------------------------------------------------------------------------
98{
99 nstr += toString(t);
100 return *this;
101}
102
104{
105 nstr += toString(t);
106 return *this;
107}
108
109//------------------------------------------------------------------------
111{
112 nstr += t;
113 return *this;
114}
void unpopStr(const std::string &s)
Definition: convert.cc:52
const std::string & str(void) const
Definition: convert.cc:58
BincStream(void)
Definition: convert.cc:14
std::string popString(unsigned int size)
Definition: convert.cc:25
char popChar(void)
Definition: convert.cc:35
unsigned int getSize(void) const
Definition: convert.cc:70
void unpopChar(char c)
Definition: convert.cc:46
BincStream & operator<<(std::ostream &(*)(std::ostream &))
Definition: convert.cc:76
~BincStream(void)
Definition: convert.cc:19
void clear(void)
Definition: convert.cc:64
Declaration of miscellaneous convertion functions.
Definition: bincimapd.cc:9
std::string toString(int i_in)
Definition: convert.h:25