From: Ricardo Markiewicz Date: Tue, 1 Nov 2005 04:40:26 +0000 (+0000) Subject: Mas linda la muestra RAW en la GUI. X-Git-Tag: 1_0-pre2~11 X-Git-Url: https://git.llucax.com/z.facultad/75.52/treemulator.git/commitdiff_plain/f4eaa9c2418b7084cb973100495fb8290e1c4075 Mas linda la muestra RAW en la GUI. --- diff --git a/src/clave_fija.cpp b/src/clave_fija.cpp index 71f6f0d..d947e2a 100644 --- a/src/clave_fija.cpp +++ b/src/clave_fija.cpp @@ -46,7 +46,21 @@ bool ClaveFija::operator == (const Clave &c) const uchar *ClaveFija::ToRaw (uint &size) const { - size = Size (); - return ToArray (); + std::stringstream ss; + + ss << "["; + ss << data; + ss << "]"; + ss << "["; + ss << block_data; + ss << "]"; + + std::string s = ss.str (); + + uchar *out = new uchar[s.size ()]; + memcpy (out, s.c_str (), s.size ()); + + size = s.size (); + return out; } diff --git a/src/clave_variable.cpp b/src/clave_variable.cpp index c97b9d9..4479a15 100644 --- a/src/clave_variable.cpp +++ b/src/clave_variable.cpp @@ -124,12 +124,24 @@ std::string ClaveVariable::abreviar(std::string &p, std::string &a, int &iguales uchar *ClaveVariable::ToRaw (uint &size) const { - uchar *out; - size = raw_data.size ()*sizeof (uchar)+sizeof (uint); - uint len = raw_data.size (); - out = new uchar[size]; - memcpy (out, &len, sizeof (uint)); - memcpy (out+sizeof(uint), raw_data.c_str (), raw_data.size ()*sizeof (uchar)); + std::stringstream ss; + + ss << "["; + ss << data.size (); + ss << "]"; + ss << "["; + ss << raw_data; + ss << "]"; + ss << "["; + ss << block_data; + ss << "]"; + + std::string s = ss.str (); + + uchar *out = new uchar[s.size ()]; + memcpy (out, s.c_str (), s.size ()); + + size = s.size (); return out; } diff --git a/viewer/view_properties.cpp b/viewer/view_properties.cpp index 11498ba..0e789df 100644 --- a/viewer/view_properties.cpp +++ b/viewer/view_properties.cpp @@ -120,7 +120,8 @@ std::string ViewProperties::ToRaw (BTreeData *p) } for (i=0; i < size; i++) { - if (isalnum (arr[i])) + if (isalnum (arr[i]) || (arr[i] == ']') || (arr[i] == '|') || + (arr[i] == '[') || (arr[i] == '-')) ss << arr[i]; else ss << ".";