Changeset 785


Ignore:
Timestamp:
05/19/18 15:46:36 (3 months ago)
Author:
Maciej Komosinski
Message:

Very long string values are not printed shortened

Location:
cpp/frams/util
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/util/extvalue.cpp

    r753 r785  
    309309        case TInt: case TDouble: case TString: case TObj:
    310310                msg += " '";
    311                 msg += getString();
     311                msg += sstringShorten(getString(), 30);
    312312                msg += "'";
    313313        default:;
  • cpp/frams/util/sstringutils.cpp

    r691 r785  
    157157}
    158158
     159SString sstringShorten(const SString &in, int maxlen)
     160{
     161        SString out;
     162        if (in.len() > maxlen)
     163                out = in.substr(0, maxlen / 2) + "..." + in.substr(in.len() - maxlen + maxlen / 2) + SString::sprintf(" (length %d)", in.len());
     164        else
     165                out = in;
     166        sstringQuote(out);
     167        return out;
     168}
     169
    159170const char* skipQuoteString(const char* txt, const char* limit)
    160171{
  • cpp/frams/util/sstringutils.h

    r691 r785  
    1919bool strContainsOneOf(const char* str, const char* chars);
    2020bool sstringQuote(SString& target);
     21SString sstringShorten(const SString &in, int maxlen);
    2122const char* skipQuoteString(const char* txt, const char* limit);
    2223int sstringUnquote(SString &target);
Note: See TracChangeset for help on using the changeset viewer.