diff --git a/Log.mqh b/Log.mqh index 8980772db..9e7781d31 100644 --- a/Log.mqh +++ b/Log.mqh @@ -256,7 +256,7 @@ class Log : public Object { } */ - virtual string ToString() { + virtual const string ToString() { string result; unsigned int lid; diff --git a/Market.mqh b/Market.mqh index 388eee48c..b9a2bf9bc 100644 --- a/Market.mqh +++ b/Market.mqh @@ -245,7 +245,7 @@ class Market : public SymbolInfo { /** * Returns Market data in textual representation. */ - string ToString() { + string const ToString() { return StringFormat(string("Pip digits/value: %d/%g, Spread: %d pts (%g pips; %.4f%%), Pts/pip: %d, ") + "Volume digits: %d, " + "Delta: %g, Last change: %g pips", GetPipDigits(), GetPipValue(), GetSpreadInPts(), GetSpreadInPips(), GetSpreadInPct(), diff --git a/Object.mqh b/Object.mqh index afe03ec3d..4d79f0343 100644 --- a/Object.mqh +++ b/Object.mqh @@ -127,14 +127,14 @@ class Object : public Dynamic { /** * Returns text representation of the object. */ - virtual string ToString() { + virtual const string ToString() { return StringFormat("[Object #%04x]", GetPointer(this)); } /** * Returns text representation of the object. */ - virtual string ToJSON() { + virtual const string ToJSON() { return StringFormat("{ \"type\": \"%s\" }", typename(this)); } diff --git a/Order.mqh b/Order.mqh index dad74daad..e961061f7 100644 --- a/Order.mqh +++ b/Order.mqh @@ -2733,7 +2733,7 @@ class Order : public SymbolInfo { /** * Returns order details in text. */ - string ToString() { + string const ToString() { SerializerConverter stub(Serializer::MakeStubObject(SERIALIZER_FLAG_SKIP_HIDDEN)); return SerializerConverter::FromObject(THIS_REF, SERIALIZER_FLAG_SKIP_HIDDEN) .ToString(SERIALIZER_FLAG_SKIP_HIDDEN, &stub); diff --git a/Strategy.mqh b/Strategy.mqh index 0865112ce..bb2c24374 100644 --- a/Strategy.mqh +++ b/Strategy.mqh @@ -907,7 +907,7 @@ class Strategy : public Object { /** * Prints strategy's details. */ - string ToString() { return StringFormat("%s: %s", GetName(), sparams.ToString()); } + string const ToString() { return StringFormat("%s: %s", GetName(), sparams.ToString()); } /* Virtual methods */ diff --git a/SymbolInfo.mqh b/SymbolInfo.mqh index 3ace24b22..d4f1957ec 100644 --- a/SymbolInfo.mqh +++ b/SymbolInfo.mqh @@ -502,7 +502,7 @@ class SymbolInfo : public Object { /** * Returns symbol information in string format. */ - string ToString() { + const string ToString() { return StringFormat( string("Symbol: %s, Last Ask/Bid: %g/%g, Last Price/Session Volume: %d/%g, Point size: %g, Pip size: %g, ") + "Tick size: %g (%g pts), Tick value: %g (%g/%g), " + "Digits: %d, Spread: %d pts, Trade stops level: %d, " + @@ -517,7 +517,7 @@ class SymbolInfo : public Object { /** * Returns symbol information in CSV format. */ - string ToCSV(bool _header = false) { + const string ToCSV(bool _header = false) { return !_header ? StringFormat(string("%s,%g,%g,%d,%g,%g,%g,") + "%g,%g,%g,%g,%g," + "%d,%d,%d," + "%g,%g,%g,%g," + "%d,%g,%g,%d,%g,%g", @@ -537,7 +537,7 @@ class SymbolInfo : public Object { /** * Returns serialized representation of the object instance. */ - SerializerNodeType Serialize(Serializer &_s) { + const SerializerNodeType Serialize(Serializer &_s) { _s.Pass(THIS_REF, "symbol", symbol); _s.PassStruct(THIS_REF, "symbol-entry", s_entry); return SerializerNodeObject; diff --git a/Timer.mqh b/Timer.mqh index 528ec9d28..e772306d7 100644 --- a/Timer.mqh +++ b/Timer.mqh @@ -146,7 +146,7 @@ class Timer : public Object { /** * Print timer times. */ - virtual string ToString() { + virtual const string ToString() { return StringFormat("%s(%d)=%d-%dms,med=%dms,sum=%dms", GetName(), ArraySize(this.data),