summaryrefslogtreecommitdiff
path: root/src/libs/qtcreatorcdbext/symbolgroupvalue.h
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@nokia.com>2010-11-25 17:17:06 +0100
committerFriedemann Kleint <Friedemann.Kleint@nokia.com>2010-11-25 17:17:06 +0100
commit78fe22f4a3bf209cce1420d53bd17199fd11170c (patch)
treeec47272067f3fc58e4212df9619f1c1aeb533d2d /src/libs/qtcreatorcdbext/symbolgroupvalue.h
parent1b6d99661f56051864002a2777febf0540e1c1d2 (diff)
downloadqt-creator-78fe22f4a3bf209cce1420d53bd17199fd11170c.tar.gz
Debugger[New CDB]: Add SymbolGroupValue for simple dumping.
Diffstat (limited to 'src/libs/qtcreatorcdbext/symbolgroupvalue.h')
-rw-r--r--src/libs/qtcreatorcdbext/symbolgroupvalue.h83
1 files changed, 83 insertions, 0 deletions
diff --git a/src/libs/qtcreatorcdbext/symbolgroupvalue.h b/src/libs/qtcreatorcdbext/symbolgroupvalue.h
new file mode 100644
index 0000000000..bb18ab223c
--- /dev/null
+++ b/src/libs/qtcreatorcdbext/symbolgroupvalue.h
@@ -0,0 +1,83 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+
+#ifndef SYMBOLGROUPVALUE_H
+#define SYMBOLGROUPVALUE_H
+
+#include "common.h"
+
+#include <string>
+
+class SymbolGroupNode;
+
+// Structure to pass all IDebug interfaces used for SymbolGroupValue
+struct SymbolGroupValueContext
+{
+ SymbolGroupValueContext(CIDebugDataSpaces *ds);
+ SymbolGroupValueContext();
+
+ CIDebugDataSpaces *dataspaces;
+};
+
+/* SymbolGroupValue: Flyweight tied to a SymbolGroupNode
+ * providing a convenient operator[] + value getters for notation of dumpers.
+ * Inaccesible members return a SymbolGroupValue in state 'invalid'. */
+
+class SymbolGroupValue
+{
+public:
+ explicit SymbolGroupValue(SymbolGroupNode *node, const SymbolGroupValueContext &c);
+ SymbolGroupValue();
+
+ operator bool() const { return isValid(); }
+ bool isValid() const;
+
+ SymbolGroupValue operator[](const char *name) const;
+
+ std::string type() const;
+ std::wstring value() const;
+ int intValue(int defaultValue = -1) const;
+ ULONG64 pointerValue(ULONG64 defaultValue = 0) const;
+ // Return allocated array of data pointed to
+ unsigned char *pointerData(unsigned length) const;
+ // Return data pointed to as wchar_t/std::wstring (UTF16)
+ std::wstring wcharPointerData(unsigned charCount, unsigned maxCharCount = 512) const;
+
+ std::string error() const;
+
+private:
+ SymbolGroupNode *m_node;
+ SymbolGroupValueContext m_context;
+ mutable std::string m_errorMessage;
+};
+
+// Dump builtin simple types using SymbolGroupValue expressions.
+bool dumpSimpleType(SymbolGroupNode *n, const SymbolGroupValueContext &ctx, std::wstring *s);
+
+#endif // SYMBOLGROUPVALUE_H