git-svn-id: svn://db.shs.com.ru/pip@230 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5

This commit is contained in:
2016-08-19 12:21:34 +00:00
parent 5ab1ec1543
commit 6d7a7d3eb1
4 changed files with 46 additions and 6 deletions

View File

@@ -205,6 +205,11 @@ PIByteArray PIByteArray::fromBase64(const PIByteArray & base64) {
}
PIByteArray PIByteArray::fromBase64(const PIString & base64) {
return fromBase64(base64.toByteArray());
}
PIByteArray & PIByteArray::compressRLE(uchar threshold) {
PIByteArray t;
uchar fb, clen, mlen = 255 - threshold;

View File

@@ -108,7 +108,8 @@ public:
static PIByteArray fromString(PIString str);
static PIByteArray fromHex(PIString str);
static PIByteArray fromBase64(const PIByteArray &base64);
static PIByteArray fromBase64(const PIByteArray & base64);
static PIByteArray fromBase64(const PIString & base64);
};
inline bool operator <(const PIByteArray & v0, const PIByteArray & v1) {if (v0.size() == v1.size()) {for (uint i = 0; i < v0.size(); ++i) if (v0[i] != v1[i]) return v0[i] < v1[i]; return false;} return v0.size() < v1.size();}

View File

@@ -60,6 +60,11 @@ PIMutex PIObject::__eh_mutex;
PIMap<PIString, PIObject::__EHData> PIObject::__eh_data;
PIString PIObject::__EHFunc::arguments() const {
return types.join(",");
}
PIString PIObject::__EHFunc::fullFormat() const {
PIString ret = type_ret + " " + scope + "::" + func_name +"(";
for (int i = 0; i < types.size_s(); ++i) {
@@ -347,6 +352,34 @@ void PIObject::updateConnectors() {
}
PIString PIObject::simplifyType(const char * a) {
PIString ret = PIStringAscii(a).trim();
int white = -1;
for (int i = 0; i < ret.size_s(); ++i) {
bool iw = ret[i] == ' ' || ret[i] == '\t' || ret[i] == '\r' || ret[i] == '\n';
//piCout << i << iw << white;
if (white < 0) {
if (iw) {
white = i;
continue;
}
} else {
if (!iw) {
ret.replace(white, i - white, " ");
i = white;
white = -1;
//piCout << i;
}
}
}
ret.replaceAll(" &", "&");
ret.replaceAll(" *", "*");
if (ret.startsWith("const ") && ret.endsWith("&"))
ret.cutLeft(6).cutRight(1).trim();
return ret;
}
bool PIObject::execute(const PIString & method) {
if (method.isEmpty()) return false;
PIVector<__EHFunc> ml = findEH(method);

View File

@@ -245,7 +245,7 @@
f.func_name = PIStringAscii(#name); \
f.addr = fp; \
f.type_ret = PIStringAscii(#ret); \
f.types << PIStringAscii(#a0); \
f.types << PIObject::simplifyType(#a0); \
f.names << PIStringAscii(#n0); \
} \
}; \
@@ -265,7 +265,7 @@
f.func_name = PIStringAscii(#name); \
f.addr = fp; \
f.type_ret = PIStringAscii(#ret); \
f.types << PIStringAscii(#a0) << PIStringAscii(#a1); \
f.types << PIObject::simplifyType(#a0) << PIObject::simplifyType(#a1); \
f.names << PIStringAscii(#n0) << PIStringAscii(#n1); \
} \
}; \
@@ -285,7 +285,7 @@
f.func_name = PIStringAscii(#name); \
f.addr = fp; \
f.type_ret = PIStringAscii(#ret); \
f.types << PIStringAscii(#a0) << PIStringAscii(#a1) << PIStringAscii(#a2); \
f.types << PIObject::simplifyType(#a0) << PIObject::simplifyType(#a1) << PIObject::simplifyType(#a2); \
f.names << PIStringAscii(#n0) << PIStringAscii(#n1) << PIStringAscii(#n2); \
} \
}; \
@@ -305,7 +305,7 @@
f.func_name = PIStringAscii(#name); \
f.addr = fp; \
f.type_ret = PIStringAscii(#ret); \
f.types << PIStringAscii(#a0) << PIStringAscii(#a1) << PIStringAscii(#a2) << PIStringAscii(#a3); \
f.types << PIObject::simplifyType(#a0) << PIObject::simplifyType(#a1) << PIObject::simplifyType(#a2) << PIObject::simplifyType(#a3); \
f.names << PIStringAscii(#n0) << PIStringAscii(#n1) << PIStringAscii(#n2) << PIStringAscii(#n3); \
} \
}; \
@@ -669,11 +669,12 @@ public:
static bool isPIObject(const void * o) {return isPIObject((PIObject*)o);}
static bool execute(PIObject * o, const PIString & method) {return o->execute(method);}
static bool execute(void * o, const PIString & method) {return ((PIObject*)o)->execute(method);}
static PIString simplifyType(const char * a);
struct __EHFunc {
__EHFunc(): addr(0) {;}
bool isNull() const {return addr == 0;}
PIString arguments() const {return types.join(",").removeAll(" ").removeAll("\t");}
PIString arguments() const;
PIString fullFormat() const;
void * addr;
PIString func_name;