|
|
@@ -189,8 +189,8 @@ void Text::toLowerCase()
|
|
|
|
|
|
// non-constant
|
|
|
void Text::setSuchGrenzen(
|
|
|
-char gBeg, char gEnd) // for every search function, does not search between
|
|
|
- // the characters gBeg and gEnd
|
|
|
+ char gBeg, char gEnd) // for every search function, does not search between
|
|
|
+ // the characters gBeg and gEnd
|
|
|
{
|
|
|
suchGBeg = gBeg;
|
|
|
suchGEnd = gEnd;
|
|
|
@@ -243,7 +243,7 @@ void Text::appendHex(char num) // appends the number in hex to the text
|
|
|
stream << std::setfill('0') << std::setw((int)sizeof(char) * 2) << std::hex
|
|
|
<< (int)num;
|
|
|
std::string str = stream.str();
|
|
|
- for (int i = length; i < length + sizeof(char) * 2; ++i)
|
|
|
+ for (int i = length; i < length + (int)sizeof(char) * 2; ++i)
|
|
|
res[i] = str.c_str()[i - length];
|
|
|
res[length + sizeof(char) * 2] = 0;
|
|
|
setTextZ(res, length + sizeof(char) * 2);
|
|
|
@@ -258,7 +258,7 @@ void Framework::Text::appendHex(short num)
|
|
|
stream << std::setfill('0') << std::setw((int)sizeof(short) * 2) << std::hex
|
|
|
<< num;
|
|
|
std::string str = stream.str();
|
|
|
- for (int i = length; i < length + sizeof(short) * 2; ++i)
|
|
|
+ for (int i = length; i < length + (int)sizeof(short) * 2; ++i)
|
|
|
res[i] = str.c_str()[i - length];
|
|
|
res[length + sizeof(short) * 2] = 0;
|
|
|
setTextZ(res, length + sizeof(short) * 2);
|
|
|
@@ -273,7 +273,7 @@ void Text::appendHex(int num) // appends the number in hex to the text
|
|
|
stream << std::setfill('0') << std::setw((int)sizeof(int) * 2) << std::hex
|
|
|
<< num;
|
|
|
std::string str = stream.str();
|
|
|
- for (int i = length; i < length + sizeof(int) * 2; ++i)
|
|
|
+ for (int i = length; i < length + (int)sizeof(int) * 2; ++i)
|
|
|
res[i] = str.c_str()[i - length];
|
|
|
res[length + sizeof(int) * 2] = 0;
|
|
|
setTextZ(res, length + sizeof(int) * 2);
|
|
|
@@ -288,7 +288,7 @@ void Text::appendHex(__int64 num) // appends the number in hex to the text
|
|
|
stream << std::setfill('0') << std::setw((int)sizeof(__int64) * 2)
|
|
|
<< std::hex << num;
|
|
|
std::string str = stream.str();
|
|
|
- for (int i = length; i < length + sizeof(__int64) * 2; ++i)
|
|
|
+ for (int i = length; i < length + (int)sizeof(__int64) * 2; ++i)
|
|
|
res[i] = str.c_str()[i - length];
|
|
|
res[length + sizeof(__int64) * 2] = 0;
|
|
|
setTextZ(res, length + sizeof(__int64) * 2);
|
|
|
@@ -500,8 +500,7 @@ void Framework::Text::regexReplace(const char* regex,
|
|
|
matcher->release();
|
|
|
}
|
|
|
|
|
|
-void Text::replace(
|
|
|
- int p1, int p2, const char* t) // replaces text from p1 to p2
|
|
|
+void Text::replace(int p1, int p2, const char* t) // replaces text from p1 to p2
|
|
|
{
|
|
|
replace(p1, p2, t, textLength(t)); // replace text
|
|
|
}
|
|
|
@@ -575,9 +574,8 @@ void Framework::Text::replace(
|
|
|
end[i] = begin[i] + len1;
|
|
|
searchStart = end[i];
|
|
|
}
|
|
|
- int resl
|
|
|
- = (length - (anz * len1)) + (anz * len2) + 1; // length of result
|
|
|
- char* res = new char[resl]; // create new text
|
|
|
+ int resl = (length - (anz * len1)) + (anz * len2) + 1; // length of result
|
|
|
+ char* res = new char[resl]; // create new text
|
|
|
int rep = 0; // stores which t1 we are at
|
|
|
int last = 0; // fill position in txt
|
|
|
int neu = 0; // fill position in res
|
|
|
@@ -625,8 +623,7 @@ void Text::replace(const Text& t1, const Text& t2)
|
|
|
|
|
|
void Text::replace(int index, char c1, char c2) // replaces the i-th c1 with c2
|
|
|
{
|
|
|
- if (c1 == '\0' || c2 == '\0'
|
|
|
- || index < 0) // check for invalid argument
|
|
|
+ if (c1 == '\0' || c2 == '\0' || index < 0) // check for invalid argument
|
|
|
return;
|
|
|
if (!has(c1)) // check if c1 exists
|
|
|
return;
|
|
|
@@ -646,13 +643,12 @@ void Text::replace(int index,
|
|
|
void Framework::Text::replace(
|
|
|
int index, const char* t1, int len1, const char* t2, int len2)
|
|
|
{
|
|
|
- if (len1 >= length || len1 <= 0
|
|
|
- || index < 0) // check for invalid argument
|
|
|
+ if (len1 >= length || len1 <= 0 || index < 0) // check for invalid argument
|
|
|
return;
|
|
|
if (!has(t1)) // check if t1 exists
|
|
|
return;
|
|
|
int anz = countOf(t1, len1); // count of t1 in text
|
|
|
- if (index >= anz) // check if an i-th t1 exists
|
|
|
+ if (index >= anz) // check if an i-th t1 exists
|
|
|
return;
|
|
|
int begin = positionOf(index, len1, t1);
|
|
|
int end = begin + len1;
|
|
|
@@ -676,7 +672,7 @@ void Text::replace(int i, const Text& t1, const Text& t2)
|
|
|
}
|
|
|
|
|
|
void Text::fillText(
|
|
|
-char c, int len) // sets the text to as many c as len is large
|
|
|
+ char c, int len) // sets the text to as many c as len is large
|
|
|
{
|
|
|
char* res = new char[(__int64)len + 1];
|
|
|
for (int i = 0; i < len; ++i)
|
|
|
@@ -722,7 +718,7 @@ void Text::remove(char c) // deletes every c
|
|
|
{
|
|
|
if (!has(c)) // check if c exists
|
|
|
return;
|
|
|
- int anz = countOf(c); // count of c
|
|
|
+ int anz = countOf(c); // count of c
|
|
|
char* res = new char[(__int64)length - anz + 1]; // create new text
|
|
|
int anz2 = 0;
|
|
|
int suchGCount = 0;
|
|
|
@@ -790,7 +786,7 @@ void Text::remove(int index, char c)
|
|
|
if (index < 0 || !has(c)) // check for invalid argument
|
|
|
return;
|
|
|
int anz = countOf(c); // count of c's
|
|
|
- if (index >= anz) // check if an i-th c exists
|
|
|
+ if (index >= anz) // check if an i-th c exists
|
|
|
return;
|
|
|
int pos = positionOf(c, index); // position of the i-th c
|
|
|
if (pos < 0) return;
|
|
|
@@ -811,11 +807,10 @@ void Text::remove(int index, const char* t) // deletes the i-th t
|
|
|
|
|
|
void Framework::Text::remove(int index, const char* t, int len)
|
|
|
{
|
|
|
- if (index < 0 || !has(t, len)
|
|
|
- || len <= 0) // check for invalid argument
|
|
|
+ if (index < 0 || !has(t, len) || len <= 0) // check for invalid argument
|
|
|
return;
|
|
|
int anz = countOf(t, len); // count of t's
|
|
|
- if (index >= anz) // check if an i-th t exists
|
|
|
+ if (index >= anz) // check if an i-th t exists
|
|
|
return;
|
|
|
int pos = positionOf(index, len, t); // position of the i-th t
|
|
|
if (pos < 0) return;
|
|
|
@@ -866,8 +861,7 @@ int Text::removeWhitespaceBefore(int pos)
|
|
|
return length;
|
|
|
}
|
|
|
|
|
|
-void Text::setPrecision(
|
|
|
-int p) // sets the number of decimal places for doubles
|
|
|
+void Text::setPrecision(int p) // sets the number of decimal places for doubles
|
|
|
{
|
|
|
precision = p;
|
|
|
}
|
|
|
@@ -1066,8 +1060,7 @@ bool Text::isEqual(const char* t) const // checks if the text equals t
|
|
|
return isEqual(t, textLength(t)); // check text
|
|
|
}
|
|
|
|
|
|
-bool Text::isEqual(
|
|
|
- const char* t, int len) const // checks if the text equals t
|
|
|
+bool Text::isEqual(const char* t, int len) const // checks if the text equals t
|
|
|
{
|
|
|
if (length != len) // check for invalid argument
|
|
|
return 0;
|
|
|
@@ -1113,8 +1106,7 @@ int Text::countOf(char c) const // returns the count of c in the text
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
-int Text::countOf(
|
|
|
- const char* t) const // returns the count of t in the text
|
|
|
+int Text::countOf(const char* t) const // returns the count of t in the text
|
|
|
{
|
|
|
return countOf(t, textLength(t)); // check text
|
|
|
}
|
|
|
@@ -1169,8 +1161,7 @@ int Text::positionOf(char c) const // returns the position of the first c
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
|
-int Text::positionOf(
|
|
|
-const char* t) const // returns the position of the first t
|
|
|
+int Text::positionOf(const char* t) const // returns the position of the first t
|
|
|
{
|
|
|
return positionOf(textLength(t), t);
|
|
|
}
|
|
|
@@ -1182,8 +1173,7 @@ int Framework::Text::positionOf(int len, const char* t) const
|
|
|
|
|
|
int Text::positionOf(int searchStart, const char* t, int len) const
|
|
|
{
|
|
|
- if (len <= 0
|
|
|
- || len > length - searchStart) // check for invalid argument
|
|
|
+ if (len <= 0 || len > length - searchStart) // check for invalid argument
|
|
|
return -1;
|
|
|
int suchGCount = 0;
|
|
|
for (int i = searchStart; i + len <= length; ++i) // search
|
|
|
@@ -1294,8 +1284,7 @@ int Text::positionOf(const Text& t, int i) const
|
|
|
return positionOf(i, t.getLength(), t); // check text
|
|
|
}
|
|
|
|
|
|
-Text* Text::getTeilText(
|
|
|
- int p1, int p2) const // returns the text from p1 to p2
|
|
|
+Text* Text::getTeilText(int p1, int p2) const // returns the text from p1 to p2
|
|
|
{
|
|
|
if (p1 > p2) // swap p1 and p2
|
|
|
{
|
|
|
@@ -1520,7 +1509,8 @@ TextReader::~TextReader()
|
|
|
|
|
|
// Sets the position of the byte to be read next
|
|
|
// pos: The index of the byte
|
|
|
-// ende: 1 if the index counts from the end of the text. 0 if from the beginning
|
|
|
+// ende: 1 if the index counts from the end of the text. 0 if from the
|
|
|
+// beginning
|
|
|
void TextReader::setReadPosition(__int64 pos, bool ende)
|
|
|
{
|
|
|
int l = txt->getLength();
|
|
|
@@ -1578,9 +1568,9 @@ __int64 TextReader::getSize() const
|
|
|
|
|
|
// char* operationen
|
|
|
int Framework::stringPositionOfChar(const char* string,
|
|
|
-char c,
|
|
|
-int num) // finds the position of the num-th c
|
|
|
- // in string, -1 if not found
|
|
|
+ char c,
|
|
|
+ int num) // finds the position of the num-th c
|
|
|
+ // in string, -1 if not found
|
|
|
{
|
|
|
int gef = 0;
|
|
|
int p = 0;
|
|
|
@@ -1599,9 +1589,9 @@ int num) // finds the position of the num-th c
|
|
|
}
|
|
|
|
|
|
int Framework::stringPositionOfString(const char* string,
|
|
|
-char* suche,
|
|
|
-int sBegPos) // finds the position of 'suche' in 'string' starting at
|
|
|
- // position 'sBegPos', -1 if not found
|
|
|
+ char* suche,
|
|
|
+ int sBegPos) // finds the position of 'suche' in 'string' starting at
|
|
|
+ // position 'sBegPos', -1 if not found
|
|
|
{
|
|
|
for (int i = 0; i < sBegPos; ++i)
|
|
|
{
|
|
|
@@ -1624,7 +1614,7 @@ int sBegPos) // finds the position of 'suche' in 'string' starting at
|
|
|
|
|
|
//---Other Functions---
|
|
|
void Framework::TextKopieren(
|
|
|
-const char* txt) // copies the text to the clipboard
|
|
|
+ const char* txt) // copies the text to the clipboard
|
|
|
{
|
|
|
#ifdef WIN32
|
|
|
int laen = textLength(txt) + 1;
|
|
|
@@ -1640,8 +1630,7 @@ const char* txt) // copies the text to the clipboard
|
|
|
#endif
|
|
|
}
|
|
|
|
|
|
-const char*
|
|
|
-Framework::TextInsert() // returns the text from the clipboard
|
|
|
+const char* Framework::TextInsert() // returns the text from the clipboard
|
|
|
{
|
|
|
#ifdef WIN32
|
|
|
if (!OpenClipboard(0)) return "";
|
|
|
@@ -1694,7 +1683,7 @@ char Framework::smallOrBig(char c, bool gr)
|
|
|
return ';';
|
|
|
case '.':
|
|
|
return ':';
|
|
|
- case 'ß':
|
|
|
+ case SpecialCharacters::SZ:
|
|
|
return '?';
|
|
|
case '-':
|
|
|
return '_';
|
|
|
@@ -1772,7 +1761,7 @@ char Framework::smallOrBig(char c, bool gr)
|
|
|
}
|
|
|
|
|
|
bool Framework::isWritable(
|
|
|
-unsigned char zeichen) // checks if zeichen is a printable character
|
|
|
+ unsigned char zeichen) // checks if zeichen is a printable character
|
|
|
{
|
|
|
if (zeichen > 32 && zeichen < 127) return 1;
|
|
|
if (zeichen == 128 || zeichen == 181 || zeichen == 178 || zeichen == 179)
|
|
|
@@ -1790,7 +1779,7 @@ unsigned char zeichen) // checks if zeichen is a printable character
|
|
|
}
|
|
|
|
|
|
unsigned int Framework::TextZuInt(
|
|
|
-const char* c, int system) // converts c to int
|
|
|
+ const char* c, int system) // converts c to int
|
|
|
{
|
|
|
if (system == 16) return (unsigned int)strtoul(c, 0, system);
|
|
|
return (unsigned int)strtol(c, 0, system);
|