File indexing completed on 2024-05-12 15:43:26

0001 /*
0002  *  Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
0003  *  Copyright (C) 2003, 2006, 2007, 2008 Apple Inc. All rights reserved.
0004  *  Copyright (C) 2007 Cameron Zwarich (cwzwarich@uwaterloo.ca)
0005  *  Copyright (C) 2007 Maks Orlovich
0006  *
0007  *  This library is free software; you can redistribute it and/or
0008  *  modify it under the terms of the GNU Library General Public
0009  *  License as published by the Free Software Foundation; either
0010  *  version 2 of the License, or (at your option) any later version.
0011  *
0012  *  This library is distributed in the hope that it will be useful,
0013  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
0014  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0015  *  Library General Public License for more details.
0016  *
0017  *  You should have received a copy of the GNU Library General Public License
0018  *  along with this library; see the file COPYING.LIB.  If not, write to
0019  *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0020  *  Boston, MA 02110-1301, USA.
0021  *
0022  */
0023 
0024 #ifndef KJS_LOCAL_STORAGE_H
0025 #define KJS_LOCAL_STORAGE_H
0026 
0027 #include "kjs/global.h"
0028 
0029 #if HAVE_STDINT_H
0030 #include <stdint.h>   // int32_t
0031 #endif
0032 #include <wtf/Vector.h>
0033 #include <wtf/VectorTraits.h>
0034 #include "scope_chain.h" // for ScopeChainLink
0035 
0036 namespace KJS
0037 {
0038 class JSValue;
0039 
0040 struct LocalStorageEntry {
0041     LocalStorageEntry()
0042     {
0043     }
0044 
0045     LocalStorageEntry(JSValue *v, unsigned a) :
0046         attributes(a)
0047     {
0048         val.valueVal = v;
0049     }
0050 
0051     union {
0052         double   numberVal; //### TODO: use 2 entries for this on 32-bit..
0053         JSValue *valueVal;
0054         bool     boolVal;
0055         int32_t  int32Val;
0056         ScopeChainLink scopeVal;
0057     } val;
0058     unsigned attributes;
0059 };
0060 
0061 typedef Vector<LocalStorageEntry, 32> LocalStorage;
0062 }
0063 
0064 namespace WTF
0065 {
0066 template<> struct VectorTraits<KJS::LocalStorageEntry> : VectorTraitsBase<true, KJS::LocalStorageEntry> { };
0067 }
0068 
0069 #endif // KJS_LOCAL_STORAGE_H