| 1 |
/*************************************************************************** |
| 2 |
str.cpp - description |
| 3 |
------------------- |
| 4 |
begin : Tue Aug 1 2000 |
| 5 |
copyright : (C) 2000 by W. Baraldi & D. Scarpa |
| 6 |
email : [email protected] |
| 7 |
***************************************************************************/ |
| 8 |
|
| 9 |
#include "str.h"cxx . . $ `<file>/src/str.h`/ |
| 10 |
#include <string.h> |
| 11 |
|
| 12 |
const char Strcxx . . $ Str#::nulcxx . . $ Str#nul. = '\0'; |
| 13 |
|
| •14 |
Strcxx . . $ Str#::Strcxx . . $ Str#Str(85c52e162fed56f9).(const char * string){ |
| 15 |
scxx . . $ Str#s.=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 16 |
setcxx . . $ Str#set(85c52e162fed56f9).(string); |
| 17 |
} |
| 18 |
|
| 19 |
Strcxx . . $ Str#::Strcxx . . $ Str#Str(954ae62f9fac4410).(Strcxx . . $ Str# * str){ |
| 20 |
scxx . . $ Str#s.=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 21 |
if (str) setcxx . . $ Str#set(85c52e162fed56f9).(str->scxx . . $ Str#s.); |
| 22 |
} |
| 23 |
|
| 24 |
Strcxx . . $ Str#::~cxx . . $ Str#`~Str`(ced63f7c635d850d).Strcxx . . $ Str#(){ |
| 25 |
if (scxx . . $ Str#s.) delete[] scxx . . $ Str#s.; |
| 26 |
} |
| 27 |
|
| •28 |
void Strcxx . . $ Str#::setcxx . . $ Str#set(85c52e162fed56f9).(const char * string){ |
| 29 |
if (scxx . . $ Str#s.) delete[] scxx . . $ Str#s.; |
| 30 |
if (string){ |
| 31 |
scxx . . $ Str#s.=new char[strlen(string)+1]; |
| 32 |
strcpy(scxx . . $ Str#s., string); |
| 33 |
}else scxx . . $ Str#s.=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 34 |
} |
| 35 |
|
| 36 |
void Strcxx . . $ Str#::setcxx . . $ Str#set(17a3d48ed5ac432a).(const Strcxx . . $ Str# * str){ |
| 37 |
setcxx . . $ Str#set(85c52e162fed56f9).(((Strcxx . . $ Str#*)(str))->getcxx . . $ Str#get(33a1f659e94feb42).()); |
| 38 |
} |
| 39 |
|
| 40 |
const char * Strcxx . . $ Str#::getcxx . . $ Str#get(33a1f659e94feb42).(){ |
| 41 |
if (scxx . . $ Str#s.) |
| 42 |
return (scxx . . $ Str#s.); |
| 43 |
else |
| 44 |
return (&nulcxx . . $ Str#nul.); |
| 45 |
} |
| 46 |
|
| 47 |
bool Strcxx . . $ Str#::containscxx . . $ Str#contains(c5f7da30cbc0f4e9).(const char * string){ |
| 48 |
return (strstr(scxx . . $ Str#s., string)); |
| 49 |
} |
| 50 |
|
| 51 |
bool Strcxx . . $ Str#::containscxx . . $ Str#contains(60b62d289ca30444).(Strcxx . . $ Str# * str){ |
| 52 |
return (strstr(scxx . . $ Str#s., str->scxx . . $ Str#s.)); |
| 53 |
} |
| 54 |
|
| 55 |
void Strcxx . . $ Str#::concatcxx . . $ Str#concat(85c52e162fed56f9).(const char * string){ |
| 56 |
char * aux=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 57 |
if (string){ |
| 58 |
aux=new char[strlen(scxx . . $ Str#s.)+strlen(string)+1]; |
| 59 |
strcpy(aux, scxx . . $ Str#s.), |
| 60 |
strcat(aux, string); |
| 61 |
freecxx . . $ free(bd21765a0afc8e3c).(scxx . . $ Str#s.); |
| 62 |
} |
| 63 |
scxx . . $ Str#s.=aux; |
| 64 |
} |
| 65 |
|
| 66 |
void Strcxx . . $ Str#::concatcxx . . $ Str#concat(954ae62f9fac4410).(Strcxx . . $ Str# * str){ |
| 67 |
concatcxx . . $ Str#concat(85c52e162fed56f9).(str->scxx . . $ Str#s.); |
| 68 |
} |
| 69 |
|
| 70 |
int Strcxx . . $ Str#::lenghtcxx . . $ Str#lenght(b126dc7c1de90089).(){ |
| 71 |
return (strlen(scxx . . $ Str#s.)); |
| 72 |
} |
| 73 |
|
| •74 |
bool Strcxx . . $ Str#::isEqualcxx . . $ Str#isEqual(4ada0eb6abe2b819).(Strcxx . . $ Str# * str, bool case_sensitive){ |
| 75 |
if (case_sensitive){ |
| 76 |
return (!strcmp(scxx . . $ Str#s., str->scxx . . $ Str#s.)); |
| 77 |
} |
| 78 |
return (!strcasecmp(scxx . . $ Str#s., str->scxx . . $ Str#s.)); |
| 79 |
} |
| 80 |
|
| 81 |
void Strcxx . . $ Str#::cropcxx . . $ Str#crop(b4d55b1286ff73e8).(unsigned int start, unsigned int end){ |
| 82 |
if (end>strlen(scxx . . $ Str#s.)-1) end=strlen(scxx . . $ Str#s.)-1; |
| 83 |
if (start<end){ |
| 84 |
char * aux=new char[strlen(scxx . . $ Str#s.)+1]; |
| 85 |
char * aux2=scxx . . $ Str#s.+start; |
| 86 |
strncpy(aux, aux2, end-start); |
| 87 |
aux[end-start]='\0'; |
| 88 |
delete[] scxx . . $ Str#s.; |
| 89 |
scxx . . $ Str#s.=aux; |
| 90 |
}else |
| 91 |
setcxx . . $ Str#set(85c52e162fed56f9).(); |
| 92 |
} |
| 93 |
|
| 94 |
int Strcxx . . $ Str#::toIntcxx . . $ Str#toInt(b126dc7c1de90089).(){ |
| 95 |
return atoicxx . . $ atoi(f5ecf3191ed0cd93).(scxx . . $ Str#s.); |
| 96 |
} |
| 97 |
|
| 98 |
bool Strcxx . . $ Str#::toBoolcxx . . $ Str#toBool(c9857a73d68e59ba).(){ |
| 99 |
if (!strcasecmp("f", scxx . . $ Str#s.)) return (false); |
| 100 |
if (!strcasecmp("false", scxx . . $ Str#s.)) return (false); |
| 101 |
if (!strcasecmp("t", scxx . . $ Str#s.)) return (true); |
| 102 |
if (!strcasecmp("true", scxx . . $ Str#s.)) return (true); |
| 103 |
return false; |
| 104 |
} |
| 105 |
|
| 106 |
float Strcxx . . $ Str#::toFloatcxx . . $ Str#toFloat(9b8c9e39889c762c).(){ |
| 107 |
return (atofcxx . . $ atof(9b0361fcbc284e4f).(scxx . . $ Str#s.)); |
| 108 |
} |
| 109 |
|