commsfwtools/commstools/utracedecoder/inc/messagedefparser/integeridentifier.h
changeset 0 dfb7c4ff071f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsfwtools/commstools/utracedecoder/inc/messagedefparser/integeridentifier.h	Thu Dec 17 09:22:25 2009 +0200
@@ -0,0 +1,91 @@
+// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#ifndef INTEGERIDENTIFIER_H
+#define INTEGERIDENTIFIER_H
+
+#include "identifierbase.h"
+
+namespace Parser
+{
+struct TIntegerIdentifierOptions
+    {
+    public:
+        TIntegerIdentifierOptions()
+            : iFormatAsHex(true)
+            {
+            }
+
+        TIntegerIdentifierOptions(bool aFormatAsHex)
+            : iFormatAsHex(aFormatAsHex)
+            {
+            }
+
+        bool iFormatAsHex;
+    };
+
+class CIntegerTypeIdentifier : public CIdentifierBase
+    {
+    public:
+        explicit CIntegerTypeIdentifier(const char* aName, int aSize)
+            : CIdentifierBase(Parser::EIntegerTypeIdentifier, aName), iSigned(false)
+            {
+            iSize = aSize;
+            }
+
+        explicit CIntegerTypeIdentifier(const char* aName, int aSize, bool aSigned)
+            : CIdentifierBase(Parser::EIntegerTypeIdentifier, aName), iSigned(aSigned)
+            {
+            iSize = aSize;
+            }
+
+        virtual void Describe(const unsigned char* aData, unsigned int aLength, const void* aOptions, std::ostream& aDescription) const;
+
+    protected:
+        explicit CIntegerTypeIdentifier(Parser::TIdentifierType aType, const char* aName)
+            : CIdentifierBase(aType, aName), iSigned(false)
+            {
+            }
+
+        explicit CIntegerTypeIdentifier(Parser::TIdentifierType aType, const char* aName, bool aSigned)
+            : CIdentifierBase(aType, aName), iSigned(aSigned)
+            {
+            }
+
+    public:
+        bool ValueInRange(int aValue) const;
+        bool ValueInRange(unsigned int aValue) const;
+        static bool ValueInRange(unsigned int aSize, int aValue);
+        static bool ValueInRange(unsigned int aSize, unsigned int aValue);
+
+        inline void SetSigned(bool aSigned)
+            {
+            iSigned = aSigned;
+            }
+
+        inline bool Signed() const
+            {
+            return iSigned;
+            }
+
+    protected:
+        bool iSigned;
+    };
+    
+} // namespace Parser
+
+#endif
+// INTEGERIDENTIFIER_H
+